put settings defaults into resource file

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/parser/MessageParser.java               | 12 
src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java |  6 
src/main/java/eu/siacs/conversations/services/NotificationService.java       |  6 
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java     | 34 
src/main/java/eu/siacs/conversations/ui/ConversationActivity.java            |  6 
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java            |  2 
src/main/java/eu/siacs/conversations/ui/MagicCreateActivity.java             |  9 
src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java               |  2 
src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java       |  4 
src/main/java/eu/siacs/conversations/ui/WelcomeActivity.java                 |  9 
src/main/java/eu/siacs/conversations/ui/XmppActivity.java                    | 14 
src/main/res/values/defaults.xml                                             | 33 
src/main/res/xml/preferences.xml                                             | 66 
13 files changed, 132 insertions(+), 71 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/parser/MessageParser.java 🔗

@@ -17,6 +17,7 @@ import java.util.Set;
 import java.util.UUID;
 
 import eu.siacs.conversations.Config;
+import eu.siacs.conversations.R;
 import eu.siacs.conversations.crypto.OtrService;
 import eu.siacs.conversations.crypto.axolotl.AxolotlService;
 import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
@@ -750,8 +751,15 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
 	private static SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss");
 
 	private void activateGracePeriod(Account account) {
-		long duration = mXmppConnectionService.getPreferences().getLong("race_period_length", 144) * 1000;
-		Log.d(Config.LOGTAG,account.getJid().toBareJid()+": activating grace period till "+TIME_FORMAT.format(new Date(System.currentTimeMillis() + duration)));
+
+		long duration;
+		long defaultValue = mXmppConnectionService.getResources().getInteger(R.integer.grace_period);
+		try {
+			duration = Long.parseLong(mXmppConnectionService.getPreferences().getString("grace_period_length", String.valueOf(defaultValue))) * 1000;
+		} catch (NumberFormatException e) {
+			duration = defaultValue * 1000;
+		}
+		Log.d(Config.LOGTAG,account.getJid().toBareJid()+": activating grace period ("+duration+") till "+TIME_FORMAT.format(new Date(System.currentTimeMillis() + duration)));
 		account.activateGracePeriod(duration);
 	}
 }

src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java 🔗

@@ -33,6 +33,7 @@ import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
 import eu.siacs.conversations.Config;
+import eu.siacs.conversations.R;
 import eu.siacs.conversations.entities.DownloadableFile;
 
 public class AbstractConnectionManager {
@@ -50,12 +51,13 @@ public class AbstractConnectionManager {
 	}
 
 	public long getAutoAcceptFileSize() {
+		long defaultValue = this.getXmppConnectionService().getResources().getInteger(R.integer.auto_accept_filesize);
 		String config = this.mXmppConnectionService.getPreferences().getString(
-				"auto_accept_file_size", "524288");
+				"auto_accept_file_size", String.valueOf(defaultValue));
 		try {
 			return Long.parseLong(config);
 		} catch (NumberFormatException e) {
-			return 524288;
+			return defaultValue;
 		}
 	}
 

src/main/java/eu/siacs/conversations/services/NotificationService.java 🔗

@@ -85,7 +85,7 @@ public class NotificationService {
 	}
 
 	public boolean notificationsEnabled() {
-		return mXmppConnectionService.getPreferences().getBoolean("show_notification", true);
+		return mXmppConnectionService.getPreferences().getBoolean("show_notification", mXmppConnectionService.getResources().getBoolean(R.bool.show_notification));
 	}
 
 	private boolean notificationsFromStrangers() {
@@ -94,7 +94,7 @@ public class NotificationService {
 	}
 
 	public boolean isQuietHours() {
-		if (!mXmppConnectionService.getPreferences().getBoolean("enable_quiet_hours", false)) {
+		if (!mXmppConnectionService.getPreferences().getBoolean("enable_quiet_hours", mXmppConnectionService.getResources().getBoolean(R.bool.enable_quiet_hours))) {
 			return false;
 		}
 		final long startTime = mXmppConnectionService.getPreferences().getLong("quiet_hours_start", TimePreference.DEFAULT_VALUE) % Config.MILLISECONDS_IN_DAY;
@@ -725,7 +725,7 @@ public class NotificationService {
 				errors.add(account);
 			}
 		}
-		if (mXmppConnectionService.getPreferences().getBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE, false)) {
+		if (mXmppConnectionService.getPreferences().getBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE, mXmppConnectionService.getResources().getBoolean(R.bool.enable_foreground_service))) {
 			notificationManager.notify(FOREGROUND_NOTIFICATION_ID, createForegroundNotification());
 		}
 		final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -865,7 +865,7 @@ public class XmppConnectionService extends Service {
 	}
 
 	private boolean manuallyChangePresence() {
-		return getPreferences().getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, false);
+		return getPreferences().getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, getResources().getBoolean(R.bool.manually_change_presence));
 	}
 
 	private boolean treatVibrateAsSilent() {
@@ -873,11 +873,11 @@ public class XmppConnectionService extends Service {
 	}
 
 	private boolean awayWhenScreenOff() {
-		return getPreferences().getBoolean(SettingsActivity.AWAY_WHEN_SCREEN_IS_OFF, false);
+		return getPreferences().getBoolean(SettingsActivity.AWAY_WHEN_SCREEN_IS_OFF, getResources().getBoolean(R.bool.away_when_screen_off));
 	}
 
 	private String getCompressPicturesPreference() {
-		return getPreferences().getString("picture_compression", "auto");
+		return getPreferences().getString("picture_compression", getResources().getString(R.string.picture_compression));
 	}
 
 	private Presence.Status getTargetPresence() {
@@ -1091,7 +1091,7 @@ public class XmppConnectionService extends Service {
 	}
 
 	private boolean keepForegroundService() {
-		return getPreferences().getBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE,false);
+		return getPreferences().getBoolean(SettingsActivity.KEEP_FOREGROUND_SERVICE,getResources().getBoolean(R.bool.enable_foreground_service));
 	}
 
 	@Override
@@ -2746,7 +2746,7 @@ public class XmppConnectionService extends Service {
 	}
 
 	public void createContact(Contact contact) {
-		boolean autoGrant = getPreferences().getBoolean("grant_new_contacts", true);
+		boolean autoGrant = getPreferences().getBoolean("grant_new_contacts", getResources().getBoolean(R.bool.grant_new_contacts));
 		if (autoGrant) {
 			contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
 			contact.setOption(Contact.Options.ASKING);
@@ -3256,7 +3256,7 @@ public class XmppConnectionService extends Service {
 
 	public long getAutomaticMessageDeletionDate() {
 		try {
-			final long timeout = Long.parseLong(getPreferences().getString(SettingsActivity.AUTOMATIC_MESSAGE_DELETION, "0")) * 1000;
+			final long timeout = Long.parseLong(getPreferences().getString(SettingsActivity.AUTOMATIC_MESSAGE_DELETION, String.valueOf(getResources().getInteger(R.integer.automatic_message_deletion)))) * 1000;
 			return timeout == 0 ? timeout : System.currentTimeMillis() - timeout;
 		} catch (NumberFormatException e) {
 			return 0;
@@ -3264,35 +3264,35 @@ public class XmppConnectionService extends Service {
 	}
 
 	public boolean confirmMessages() {
-		return getPreferences().getBoolean("confirm_messages", true);
+		return getPreferences().getBoolean("confirm_messages", getResources().getBoolean(R.bool.confirm_messages));
 	}
 
 	public boolean allowMessageCorrection() {
-		return getPreferences().getBoolean("allow_message_correction", true);
+		return getPreferences().getBoolean("allow_message_correction", getResources().getBoolean(R.bool.allow_message_correction));
 	}
 
 	public boolean sendChatStates() {
-		return getPreferences().getBoolean("chat_states", false);
+		return getPreferences().getBoolean("chat_states", getResources().getBoolean(R.bool.chat_states));
 	}
 
 	private boolean respectAutojoin() {
-		return getPreferences().getBoolean("autojoin", true);
+		return getPreferences().getBoolean("autojoin", getResources().getBoolean(R.bool.autojoin));
 	}
 
 	public boolean indicateReceived() {
-		return getPreferences().getBoolean("indicate_received", false);
+		return getPreferences().getBoolean("indicate_received", getResources().getBoolean(R.bool.indicate_received));
 	}
 
 	public boolean useTorToConnect() {
-		return Config.FORCE_ORBOT || getPreferences().getBoolean("use_tor", false);
+		return Config.FORCE_ORBOT || getPreferences().getBoolean("use_tor", getResources().getBoolean(R.bool.use_tor));
 	}
 
 	public boolean showExtendedConnectionOptions() {
-		return getPreferences().getBoolean("show_connection_options", false);
+		return getPreferences().getBoolean("show_connection_options", getResources().getBoolean(R.bool.show_connection_options));
 	}
 
 	public boolean broadcastLastActivity() {
-		return getPreferences().getBoolean(SettingsActivity.BROADCAST_LAST_ACTIVITY, false);
+		return getPreferences().getBoolean(SettingsActivity.BROADCAST_LAST_ACTIVITY, getResources().getBoolean(R.bool.last_activity));
 	}
 
 	public int unreadCount() {
@@ -3446,7 +3446,7 @@ public class XmppConnectionService extends Service {
 
 	public void updateMemorizingTrustmanager() {
 		final MemorizingTrustManager tm;
-		final boolean dontTrustSystemCAs = getPreferences().getBoolean("dont_trust_system_cas", false);
+		final boolean dontTrustSystemCAs = getPreferences().getBoolean("dont_trust_system_cas", getResources().getBoolean(R.bool.dont_trust_system_cas));
 		if (dontTrustSystemCAs) {
 			tm = new MemorizingTrustManager(getApplicationContext(), null);
 		} else {
@@ -3903,7 +3903,7 @@ public class XmppConnectionService extends Service {
 		if (name != null && !name.trim().isEmpty()) {
 			bookmark.setBookmarkName(name.trim());
 		}
-		bookmark.setAutojoin(getPreferences().getBoolean("autojoin",true));
+		bookmark.setAutojoin(getPreferences().getBoolean("autojoin",getResources().getBoolean(R.bool.autojoin)));
 		account.getBookmarks().add(bookmark);
 		pushBookmarks(account);
 		conversation.setBookmark(bookmark);
@@ -3959,7 +3959,7 @@ public class XmppConnectionService extends Service {
 	}
 
 	public boolean blindTrustBeforeVerification() {
-		return getPreferences().getBoolean(SettingsActivity.BLIND_TRUST_BEFORE_VERIFICATION, true);
+		return getPreferences().getBoolean(SettingsActivity.BLIND_TRUST_BEFORE_VERIFICATION, getResources().getBoolean(R.bool.btbv));
 	}
 
 	public ShortcutService getShortcutService() {

src/main/java/eu/siacs/conversations/ui/ConversationActivity.java 🔗

@@ -1714,15 +1714,15 @@ public class ConversationActivity extends XmppActivity
 	}
 
 	public boolean useSendButtonToIndicateStatus() {
-		return getPreferences().getBoolean("send_button_status", false);
+		return getPreferences().getBoolean("send_button_status", getResources().getBoolean(R.bool.send_button_status));
 	}
 
 	public boolean indicateReceived() {
-		return getPreferences().getBoolean("indicate_received", false);
+		return getPreferences().getBoolean("indicate_received", getResources().getBoolean(R.bool.indicate_received));
 	}
 
 	public boolean useGreenBackground() {
-		return getPreferences().getBoolean("use_green_background",true);
+		return getPreferences().getBoolean("use_green_background",getResources().getBoolean(R.bool.use_green_background));
 	}
 
 	protected boolean trustKeysIfNeeded(int requestCode) {

src/main/java/eu/siacs/conversations/ui/ConversationFragment.java 🔗

@@ -1249,7 +1249,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
 				if (conference && c.getNextCounterpart() != null) {
 					action = SendButtonAction.CANCEL;
 				} else {
-					String setting = activity.getPreferences().getString("quick_action", "recent");
+					String setting = activity.getPreferences().getString("quick_action", activity.getResources().getString(R.string.quick_action));
 					if (!setting.equals("none") && UIHelper.receivedLocationQuestion(conversation.getLatestMessage())) {
 						setting = "location";
 					} else if (setting.equals("recent")) {

src/main/java/eu/siacs/conversations/ui/MagicCreateActivity.java 🔗

@@ -38,6 +38,15 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
 
 	}
 
+	@Override
+	public void onStart() {
+		super.onStart();
+		final int theme = findTheme();
+		if (this.mTheme != theme) {
+			recreate();
+		}
+	}
+
 	@Override
 	protected void onCreate(final Bundle savedInstanceState) {
 		if (getResources().getBoolean(R.bool.portrait_only)) {

src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java 🔗

@@ -194,7 +194,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
 		if (intent == null) {
 			return;
 		}
-		this.mReturnToPrevious = getPreferences().getBoolean("return_to_previous", false);
+		this.mReturnToPrevious = getPreferences().getBoolean("return_to_previous", getResources().getBoolean(R.bool.return_to_previous));
 		final String type = intent.getType();
 		final String action = intent.getAction();
 		Log.d(Config.LOGTAG, "action: "+action+ ", type:"+type);

src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java 🔗

@@ -361,7 +361,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
         }
         Conversation conversation = xmppConnectionService.findOrCreateConversation(bookmark.getAccount(), jid, true, true, true);
         conversation.setBookmark(bookmark);
-        if (!bookmark.autojoin() && getPreferences().getBoolean("autojoin", true)) {
+        if (!bookmark.autojoin() && getPreferences().getBoolean("autojoin", getResources().getBoolean(R.bool.autojoin))) {
             bookmark.setAutojoin(true);
             xmppConnectionService.pushBookmarks(bookmark.getAccount());
         }
@@ -507,7 +507,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
                                 jid.setError(getString(R.string.bookmark_already_exists));
                             } else {
                                 final Bookmark bookmark = new Bookmark(account, conferenceJid.toBareJid());
-                                bookmark.setAutojoin(getPreferences().getBoolean("autojoin", true));
+                                bookmark.setAutojoin(getPreferences().getBoolean("autojoin", getResources().getBoolean(R.bool.autojoin)));
                                 String nick = conferenceJid.getResourcepart();
                                 if (nick != null && !nick.isEmpty()) {
                                     bookmark.setNick(nick);

src/main/java/eu/siacs/conversations/ui/WelcomeActivity.java 🔗

@@ -24,6 +24,15 @@ public class WelcomeActivity extends XmppActivity {
 
 	}
 
+	@Override
+	public void onStart() {
+		super.onStart();
+		final int theme = findTheme();
+		if (this.mTheme != theme) {
+			recreate();
+		}
+	}
+
 	@Override
 	protected void onCreate(final Bundle savedInstanceState) {
 		if (getResources().getBoolean(R.bool.portrait_only)) {

src/main/java/eu/siacs/conversations/ui/XmppActivity.java 🔗

@@ -403,7 +403,7 @@ public abstract class XmppActivity extends Activity {
 		setTheme(this.mTheme);
 
 		this.mUsingEnterKey = usingEnterKey();
-		mUseSubject = getPreferences().getBoolean("use_subject", true);
+		mUseSubject = getPreferences().getBoolean("use_subject", getResources().getBoolean(R.bool.use_subject));
 		final ActionBar ab = getActionBar();
 		if (ab!=null) {
 			ab.setDisplayHomeAsUpEnabled(true);
@@ -411,7 +411,7 @@ public abstract class XmppActivity extends Activity {
 	}
 
 	public boolean isDarkTheme() {
-		return getPreferences().getString("theme", "light").equals("dark");
+		return getPreferences().getString("theme", getResources().getString(R.string.theme)).equals("dark");
 	}
 
 	public int getThemeResource(int r_attr_name, int r_drawable_def) {
@@ -444,7 +444,7 @@ public abstract class XmppActivity extends Activity {
 	}
 
 	protected boolean usingEnterKey() {
-		return getPreferences().getBoolean("display_enter_key", false);
+		return getPreferences().getBoolean("display_enter_key", getResources().getBoolean(R.bool.display_enter_key));
 	}
 
 	protected SharedPreferences getPreferences() {
@@ -984,11 +984,11 @@ public abstract class XmppActivity extends Activity {
 	}
 
 	protected boolean neverCompressPictures() {
-		return getPreferences().getString("picture_compression", "auto").equals("never");
+		return getPreferences().getString("picture_compression", getResources().getString(R.string.picture_compression)).equals("never");
 	}
 
 	protected boolean manuallyChangePresence() {
-		return getPreferences().getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, false);
+		return getPreferences().getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, getResources().getBoolean(R.bool.manually_change_presence));
 	}
 
 	protected void unregisterNdefPushMessageCallback() {
@@ -1038,8 +1038,8 @@ public abstract class XmppActivity extends Activity {
 	}
 
 	protected int findTheme() {
-		Boolean dark   = getPreferences().getString(SettingsActivity.THEME, "light").equals("dark");
-		Boolean larger = getPreferences().getBoolean("use_larger_font", false);
+		Boolean dark   = getPreferences().getString(SettingsActivity.THEME, getResources().getString(R.string.theme)).equals("dark");
+		Boolean larger = getPreferences().getBoolean("use_larger_font", getResources().getBoolean(R.bool.use_larger_font));
 
 		if(dark) {
 			if(larger)

src/main/res/values/defaults.xml 🔗

@@ -7,4 +7,37 @@
     <bool name="headsup_notifications">false</bool>
     <bool name="dnd_on_silent_mode">false</bool>
     <bool name="treat_vibrate_as_silent">false</bool>
+    <bool name="grant_new_contacts">true</bool>
+    <bool name="confirm_messages">true</bool>
+    <bool name="chat_states">false</bool>
+    <bool name="last_activity">false</bool>
+    <bool name="show_notification">true</bool>
+    <bool name="vibrate_on_notification">true</bool>
+    <bool name="led">true</bool>
+    <bool name="enable_quiet_hours">false</bool>
+    <string name="notification_ringtone">content://settings/system/notification_sound</string>
+    <integer name="grace_period">144</integer>
+    <integer name="auto_accept_filesize">524288</integer>
+    <string name="picture_compression">auto</string>
+    <string name="theme">light</string>
+    <bool name="use_subject">true</bool>
+    <bool name="use_green_background">true</bool>
+    <bool name="use_larger_font">false</bool>
+    <bool name="send_button_status">false</bool>
+    <string name="quick_action">recent</string>
+    <bool name="show_dynamic_tags">false</bool>
+    <bool name="btbv">true</bool>
+    <integer name="automatic_message_deletion">0</integer>
+    <bool name="dont_trust_system_cas">false</bool>
+    <bool name="allow_message_correction">false</bool>
+    <bool name="use_tor">false</bool>
+    <bool name="show_connection_options">false</bool>
+    <bool name="display_enter_key">false</bool>
+    <bool name="manually_change_presence">false</bool>
+    <bool name="away_when_screen_off">false</bool>
+    <bool name="autojoin">false</bool>
+    <bool name="indicate_received">false</bool>
+    <bool name="enable_foreground_service">false</bool>
+    <bool name="never_send">false</bool>
+    <bool name="return_to_previous">false</bool>
 </resources>

src/main/res/xml/preferences.xml 🔗

@@ -4,7 +4,7 @@
 
     <PreferenceCategory android:title="@string/pref_general">
         <CheckBoxPreference
-            android:defaultValue="true"
+            android:defaultValue="@bool/grant_new_contacts"
             android:key="grant_new_contacts"
             android:summary="@string/pref_grant_presence_updates_summary"
             android:title="@string/pref_grant_presence_updates"/>
@@ -19,25 +19,25 @@
     </PreferenceCategory>
     <PreferenceCategory android:title="@string/pref_privacy">
         <CheckBoxPreference
-            android:defaultValue="true"
+            android:defaultValue="@bool/confirm_messages"
             android:key="confirm_messages"
             android:summary="@string/pref_confirm_messages_summary"
             android:title="@string/pref_confirm_messages"/>
 
         <CheckBoxPreference
-            android:defaultValue="false"
+            android:defaultValue="@bool/chat_states"
             android:key="chat_states"
             android:summary="@string/pref_chat_states_summary"
             android:title="@string/pref_chat_states"/>
         <CheckBoxPreference
-            android:defaultValue="false"
+            android:defaultValue="@bool/last_activity"
             android:key="last_activity"
             android:title="@string/pref_broadcast_last_activity"
             android:summary="@string/pref_broadcast_last_activity_summary"/>
         </PreferenceCategory>
     <PreferenceCategory android:title="@string/pref_notification_settings">
         <CheckBoxPreference
-            android:defaultValue="true"
+            android:defaultValue="@bool/show_notification"
             android:key="show_notification"
             android:summary="@string/pref_notifications_summary"
             android:title="@string/pref_notifications"/>
@@ -54,19 +54,19 @@
             android:title="@string/pref_headsup_notifications"
             android:summary="@string/pref_headsup_notifications_summary"/>
         <CheckBoxPreference
-            android:defaultValue="true"
+            android:defaultValue="@bool/vibrate_on_notification"
             android:dependency="show_notification"
             android:key="vibrate_on_notification"
             android:summary="@string/pref_vibrate_summary"
             android:title="@string/pref_vibrate"/>
         <CheckBoxPreference
-            android:defaultValue="true"
+            android:defaultValue="@bool/led"
             android:dependency="show_notification"
             android:key="led"
             android:title="@string/pref_led"
             android:summary="@string/pref_led_summary"/>
         <RingtonePreference
-            android:defaultValue="content://settings/system/notification_sound"
+            android:defaultValue="@string/notification_ringtone"
             android:dependency="show_notification"
             android:key="notification_ringtone"
             android:ringtoneType="notification"
@@ -78,7 +78,7 @@
             android:summary="@string/pref_quiet_hours_summary"
             android:title="@string/title_pref_quiet_hours">
             <CheckBoxPreference
-                android:defaultValue="false"
+                android:defaultValue="@bool/enable_quiet_hours"
                 android:key="enable_quiet_hours"
                 android:summary="@string/pref_quiet_hours_summary"
                 android:title="@string/title_pref_enable_quiet_hours"/>
@@ -100,62 +100,62 @@
             android:key="grace_period_length"
             android:title="@string/pref_notification_grace_period"
             android:summary="@string/pref_notification_grace_period_summary"
-            android:defaultValue="144"
+            android:defaultValue="@integer/grace_period"
             android:entries="@array/grace_periods"
             android:entryValues="@array/grace_periods_values"
             />
     </PreferenceCategory>
     <PreferenceCategory android:title="@string/pref_attachments">
         <ListPreference
-            android:defaultValue="524288"
+            android:defaultValue="@integer/auto_accept_filesize"
             android:entries="@array/filesizes"
             android:entryValues="@array/filesizes_values"
             android:key="auto_accept_file_size"
             android:summary="@string/pref_accept_files_summary"
             android:title="@string/pref_accept_files"/>
         <ListPreference
-            android:defaultValue="auto"
+            android:defaultValue="@string/picture_compression"
             android:entries="@array/picture_compression_entries"
             android:entryValues="@array/picture_compression_values"
             android:key="picture_compression"
             android:summary="@string/pref_picture_compression_summary"
             android:title="@string/pref_picture_compression"/>
         <CheckBoxPreference
-            android:defaultValue="false"
+            android:defaultValue="@bool/return_to_previous"
             android:key="return_to_previous"
             android:title="@string/pref_return_to_previous"
             android:summary="@string/pref_return_to_previous_summary"/>
     </PreferenceCategory>
     <PreferenceCategory android:title="@string/pref_ui_options">
         <ListPreference
-            android:defaultValue="light"
+            android:defaultValue="@string/theme"
             android:entries="@array/themes"
             android:entryValues="@array/themes_values"
             android:key="theme"
             android:summary="@string/pref_theme_options_summary"
             android:title="@string/pref_theme_options"/>
         <CheckBoxPreference
-            android:defaultValue="true"
+            android:defaultValue="@bool/use_subject"
             android:key="use_subject"
             android:summary="@string/pref_conference_name_summary"
             android:title="@string/pref_conference_name"/>
         <CheckBoxPreference
-            android:defaultValue="true"
+            android:defaultValue="@bool/use_green_background"
             android:key="use_green_background"
             android:summary="@string/pref_use_green_background_summary"
             android:title="@string/pref_use_green_background"/>
         <CheckBoxPreference
-            android:defaultValue="false"
+            android:defaultValue="@bool/use_larger_font"
             android:key="use_larger_font"
             android:summary="@string/pref_use_larger_font_summary"
             android:title="@string/pref_use_larger_font"/>
         <CheckBoxPreference
-            android:defaultValue="false"
+            android:defaultValue="@bool/send_button_status"
             android:key="send_button_status"
             android:summary="@string/pref_use_send_button_to_indicate_status_summary"
             android:title="@string/pref_use_send_button_to_indicate_status"/>
         <ListPreference
-            android:defaultValue="recent"
+            android:defaultValue="@string/quick_action"
             android:dialogTitle="@string/choose_quick_action"
             android:entries="@array/quick_actions"
             android:entryValues="@array/quick_action_values"
@@ -163,7 +163,7 @@
             android:summary="@string/pref_quick_action_summary"
             android:title="@string/pref_quick_action"/>
         <CheckBoxPreference
-            android:defaultValue="false"
+            android:defaultValue="@bool/show_dynamic_tags"
             android:key="show_dynamic_tags"
             android:summary="@string/pref_show_dynamic_tags_summary"
             android:title="@string/pref_show_dynamic_tags"/>
@@ -178,7 +178,7 @@
             <PreferenceCategory android:title="@string/pref_security_settings"
                 android:key="security_options">
                 <CheckBoxPreference
-                    android:defaultValue="true"
+                    android:defaultValue="@bool/btbv"
                     android:key="btbv"
                     android:title="@string/pref_blind_trust_before_verification"
                     android:summary="@string/pref_blind_trust_before_verification_summary"/>
@@ -186,11 +186,11 @@
                     android:key="automatic_message_deletion"
                     android:title="@string/pref_automatically_delete_messages"
                     android:summary="@string/pref_automatically_delete_messages_description"
-                    android:defaultValue="0"
+                    android:defaultValue="@integer/automatic_message_deletion"
                     android:entries="@array/automatic_message_deletion"
                     android:entryValues="@array/automatic_message_deletion_values" />
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/dont_trust_system_cas"
                     android:key="dont_trust_system_cas"
                     android:summary="@string/pref_dont_trust_system_cas_summary"
                     android:title="@string/pref_dont_trust_system_cas_title"/>
@@ -199,7 +199,7 @@
                     android:summary="@string/pref_remove_trusted_certificates_summary"
                     android:title="@string/pref_remove_trusted_certificates_title"/>
                 <CheckBoxPreference
-                    android:defaultValue="true"
+                    android:defaultValue="@bool/allow_message_correction"
                     android:key="allow_message_correction"
                     android:title="@string/pref_allow_message_correction"
                     android:summary="@string/pref_allow_message_correction_summary"/>
@@ -220,12 +220,12 @@
                 android:key="connection_options"
                 android:title="@string/pref_connection_options">
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/use_tor"
                     android:key="use_tor"
                     android:summary="@string/pref_use_tor_summary"
                     android:title="@string/pref_use_tor"/>
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/show_connection_options"
                     android:key="show_connection_options"
                     android:summary="@string/pref_show_connection_options_summary"
                     android:title="@string/pref_show_connection_options"/>
@@ -237,20 +237,20 @@
                     android:summary="@string/pref_enter_is_send_summary"
                     android:title="@string/pref_enter_is_send"/>
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/display_enter_key"
                     android:key="display_enter_key"
                     android:summary="@string/pref_display_enter_key_summary"
                     android:title="@string/pref_display_enter_key"/>
             </PreferenceCategory>
             <PreferenceCategory android:title="@string/pref_presence_settings">
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/manually_change_presence"
                     android:key="manually_change_presence"
                     android:title="@string/pref_manually_change_presence"
                     android:summary="@string/pref_manually_change_presence_summary"
                     android:disableDependentsState="true"/>
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/away_when_screen_off"
                     android:key="away_when_screen_off"
                     android:summary="@string/pref_away_when_screen_off_summary"
                     android:title="@string/pref_away_when_screen_off"
@@ -271,17 +271,17 @@
             <PreferenceCategory android:title="@string/pref_expert_options_other">
                 <CheckBoxPreference
                     android:key="autojoin"
-                    android:defaultValue="true"
+                    android:defaultValue="@bool/autojoin"
                     android:title="@string/pref_autojoin"
                     android:summary="@string/pref_autojoin_summary"
                     />
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/indicate_received"
                     android:key="indicate_received"
                     android:summary="@string/pref_use_indicate_received_summary"
                     android:title="@string/pref_use_indicate_received"/>
                 <CheckBoxPreference
-                    android:defaultValue="false"
+                    android:defaultValue="@bool/enable_foreground_service"
                     android:key="enable_foreground_service"
                     android:summary="@string/pref_keep_foreground_service_summary"
                     android:title="@string/pref_keep_foreground_service"/>
@@ -293,7 +293,7 @@
         </PreferenceScreen>
 
         <CheckBoxPreference
-            android:defaultValue="false"
+            android:defaultValue="@bool/never_send"
             android:key="never_send"
             android:summary="@string/pref_never_send_crash_summary"
             android:title="@string/pref_never_send_crash"/>