aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-08-01 10:22:24 +0200
committerChristian Schneppe <christian@pix-art.de>2017-08-01 10:22:24 +0200
commitffd08658e1a9333b6af896aa3fc853c5184fc571 (patch)
tree3961115c310abb94c08344db719cdb316da96805 /src
parent7b6d679ea2c8557d732fdd79021ef3d2b7d84304 (diff)
put settings defaults into resource file
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java11
-rw-r--r--src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java13
-rw-r--r--src/main/java/de/pixart/messenger/services/ExportLogsService.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java4
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java46
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java9
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShareWithActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/WelcomeActivity.java9
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java12
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java2
-rw-r--r--src/main/java/de/pixart/messenger/utils/ExceptionHelper.java2
-rw-r--r--src/main/res/values/arrays.xml2
-rw-r--r--src/main/res/values/defaults.xml43
-rw-r--r--src/main/res/xml/preferences.xml70
19 files changed, 158 insertions, 87 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index d503eb95e..c5e818f1a 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -17,6 +17,7 @@ import java.util.Set;
import java.util.UUID;
import de.pixart.messenger.Config;
+import de.pixart.messenger.R;
import de.pixart.messenger.crypto.OtrService;
import de.pixart.messenger.crypto.axolotl.AxolotlService;
import de.pixart.messenger.crypto.axolotl.XmppAxolotlMessage;
@@ -736,8 +737,14 @@ 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);
}
}
diff --git a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
index 5a65d23c3..9232b2d7e 100644
--- a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
+++ b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java
@@ -33,6 +33,7 @@ import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import de.pixart.messenger.Config;
+import de.pixart.messenger.R;
import de.pixart.messenger.entities.DownloadableFile;
public class AbstractConnectionManager {
@@ -49,21 +50,25 @@ public class AbstractConnectionManager {
}
public long getAutoAcceptFileSize() {
+ long defaultValue_wifi = this.getXmppConnectionService().getResources().getInteger(R.integer.auto_accept_filesize_wifi);
+ long defaultValue_mobile = this.getXmppConnectionService().getResources().getInteger(R.integer.auto_accept_filesize_mobile);
+ long defaultValue_roaming = this.getXmppConnectionService().getResources().getInteger(R.integer.auto_accept_filesize_roaming);
+
String config = "0";
if (mXmppConnectionService.isWIFI()) {
config = this.mXmppConnectionService.getPreferences().getString(
- "auto_accept_file_size_wifi", "10485760");
+ "auto_accept_file_size_wifi", String.valueOf(defaultValue_wifi));
} else if (mXmppConnectionService.isMobile()) {
config = this.mXmppConnectionService.getPreferences().getString(
- "auto_accept_file_size_mobile", "262144");
+ "auto_accept_file_size_mobile", String.valueOf(defaultValue_mobile));
} else if (mXmppConnectionService.isMobileRoaming()) {
config = this.mXmppConnectionService.getPreferences().getString(
- "auto_accept_file_size_roaming", "1");
+ "auto_accept_file_size_roaming", String.valueOf(defaultValue_roaming));
}
try {
return Long.parseLong(config);
} catch (NumberFormatException e) {
- return 1048576;
+ return defaultValue_mobile;
}
}
diff --git a/src/main/java/de/pixart/messenger/services/ExportLogsService.java b/src/main/java/de/pixart/messenger/services/ExportLogsService.java
index ab1d223db..2337d04d0 100644
--- a/src/main/java/de/pixart/messenger/services/ExportLogsService.java
+++ b/src/main/java/de/pixart/messenger/services/ExportLogsService.java
@@ -55,7 +55,7 @@ public class ExportLogsService extends Service {
mDatabaseBackend = DatabaseBackend.getInstance(getBaseContext());
mAccounts = mDatabaseBackend.getAccounts();
final SharedPreferences ReadableLogs = PreferenceManager.getDefaultSharedPreferences(this);
- ReadableLogsEnabled = ReadableLogs.getBoolean("export_plain_text_logs", false);
+ ReadableLogsEnabled = ReadableLogs.getBoolean("export_plain_text_logs", getResources().getBoolean(R.bool.plain_text_logs));
pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ExportLogsService");
}
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index 0397a8950..ee5db3156 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -90,7 +90,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() {
@@ -99,7 +99,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;
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 5f075bf7e..ef83aa227 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -875,7 +875,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() {
@@ -883,15 +883,15 @@ 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));
}
public int getCompressImageResolutionPreference() {
- switch (getPreferences().getString("image_compression", "high")) {
+ switch (getPreferences().getString("image_compression", getResources().getString(R.string.picture_compression))) {
case "low":
return 720;
case "mid":
@@ -904,7 +904,7 @@ public class XmppConnectionService extends Service {
}
public int getCompressImageSizePreference() {
- switch (getPreferences().getString("image_compression", "high")) {
+ switch (getPreferences().getString("image_compression", getResources().getString(R.string.picture_compression))) {
case "low":
return 209715; // 0.2 * 1024 * 1024 = 209715 (0.2 MiB)
case "mid":
@@ -912,12 +912,12 @@ public class XmppConnectionService extends Service {
case "high":
return 1048576; // 1 * 1024 * 1024 = 1048576 (1 MiB)
default:
- return 1048576;
+ return 524288;
}
}
private int getCompressVideoResolutionPreference() {
- switch (getPreferences().getString("video_compression", "high")) {
+ switch (getPreferences().getString("video_compression", getResources().getString(R.string.video_compression))) {
case "low":
return 144;
case "mid":
@@ -925,12 +925,12 @@ public class XmppConnectionService extends Service {
case "high":
return 720;
default:
- return 720;
+ return 360;
}
}
private int getCompressVideoBitratePreference() {
- switch (getPreferences().getString("video_compression", "high")) {
+ switch (getPreferences().getString("video_compression", getResources().getString(R.string.video_compression))) {
case "low":
return 100000;
case "mid":
@@ -938,7 +938,7 @@ public class XmppConnectionService extends Service {
case "high":
return 2000000;
default:
- return 2000000;
+ return 500000;
}
}
@@ -2914,7 +2914,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);
@@ -3424,7 +3424,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;
@@ -3432,35 +3432,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", true);
+ 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", true);
+ 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, true);
+ return getPreferences().getBoolean(SettingsActivity.BROADCAST_LAST_ACTIVITY, getResources().getBoolean(R.bool.last_activity));
}
public int unreadCount() {
@@ -3622,7 +3622,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 {
@@ -4080,7 +4080,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);
@@ -4145,7 +4145,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 void pushMamPreferences(Account account, Element prefs) {
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index e47bb31e7..7dccdd8b9 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -2073,15 +2073,15 @@ public class ConversationActivity extends XmppActivity
}
public boolean useSendButtonToIndicateStatus() {
- return getPreferences().getBoolean("send_button_status", true);
+ return getPreferences().getBoolean("send_button_status", getResources().getBoolean(R.bool.send_button_status));
}
public boolean indicateReceived() {
- return getPreferences().getBoolean("indicate_received", true);
+ return getPreferences().getBoolean("indicate_received", getResources().getBoolean(R.bool.indicate_received));
}
public boolean useWhiteBackground() {
- return getPreferences().getBoolean("use_white_background", false);
+ return getPreferences().getBoolean("use_white_background", getResources().getBoolean(R.bool.use_white_background));
}
protected boolean trustKeysIfNeeded(int requestCode) {
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 1e1b51a93..9cf2120fa 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1281,7 +1281,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")) {
diff --git a/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java b/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java
index 5e41ad326..0d5759b6a 100644
--- a/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java
@@ -39,6 +39,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)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
index f8a414102..d269e4249 100644
--- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
@@ -212,7 +212,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
IntentReceived = true;
}
Log.d(Config.LOGTAG, "ShareWithActivity onStart() getIntent " + intent.toString());
- 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);
diff --git a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
index ca5ff3de1..3aba479e5 100644
--- a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
@@ -257,11 +257,11 @@ public class ShowFullscreenMessageActivity extends Activity {
}
public boolean useMaxBrightness() {
- return getPreferences().getBoolean("use_max_brightness", true);
+ return getPreferences().getBoolean("use_max_brightness", getResources().getBoolean(R.bool.use_max_brightness));
}
public boolean useAutoRotateScreen() {
- return getPreferences().getBoolean("use_auto_rotate", true);
+ return getPreferences().getBoolean("use_auto_rotate", getResources().getBoolean(R.bool.auto_rotate));
}
protected SharedPreferences getPreferences() {
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 784e511ef..aaae41e65 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -376,7 +376,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());
}
@@ -522,7 +522,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);
diff --git a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java
index 60f4636b0..b34cc22ae 100644
--- a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java
@@ -52,6 +52,15 @@ public class WelcomeActivity extends XmppActivity {
private static final int REQUEST_READ_EXTERNAL_STORAGE = 0XD737;
@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)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index 2187a467b..82cd46b51 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -417,7 +417,7 @@ public abstract class XmppActivity extends Activity {
this.mTheme = findTheme();
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);
@@ -454,7 +454,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() {
@@ -1021,11 +1021,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, true);
+ return getPreferences().getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, getResources().getBoolean(R.bool.manually_change_presence));
}
protected void unregisterNdefPushMessageCallback() {
@@ -1095,7 +1095,9 @@ public abstract class XmppActivity extends Activity {
}
protected int findTheme() {
- if (getPreferences().getBoolean("use_larger_font", false)) {
+ Boolean larger = getPreferences().getBoolean("use_larger_font", getResources().getBoolean(R.bool.use_larger_font));
+
+ if (larger) {
return R.style.ConversationsTheme_LargerText;
} else {
return R.style.ConversationsTheme;
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
index d2d001981..ee1ce4102 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -315,7 +315,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
}
public boolean ShowPresenceColoredNames() {
- return getPreferences().getBoolean("presence_colored_names", false);
+ return getPreferences().getBoolean("presence_colored_names", activity.getResources().getBoolean(R.bool.presence_colored_names));
}
protected SharedPreferences getPreferences() {
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java
index ce0649c56..0c3c3eb9e 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java
@@ -214,7 +214,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
}
public boolean ShowPresenceColoredNames() {
- return getPreferences().getBoolean("presence_colored_names", false);
+ return getPreferences().getBoolean("presence_colored_names", activity.getResources().getBoolean(R.bool.presence_colored_names));
}
protected SharedPreferences getPreferences() {
diff --git a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java
index ed58737ac..c511039cf 100644
--- a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java
@@ -44,7 +44,7 @@ public class ExceptionHelper {
try {
final SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(activity);
- boolean crashreport = preferences.getBoolean("crashreport", true);
+ boolean crashreport = preferences.getBoolean("crashreport", activity.getResources().getBoolean(R.bool.send_crashreport));
if (!crashreport || Config.BUG_REPORTS == null) {
return false;
}
diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml
index d56b12bae..6c0784aef 100644
--- a/src/main/res/values/arrays.xml
+++ b/src/main/res/values/arrays.xml
@@ -17,7 +17,7 @@
<item>10 MiB</item>
</string-array>
<string-array name="filesizes_values">
- <item>1</item>
+ <item>0</item>
<item>262144</item>
<item>524288</item>
<item>1048576</item>
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index 46f313da9..e191286a1 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -3,8 +3,47 @@
<string name="default_resource" translatable="false">Phone</string>
<bool name="portrait_only">true</bool>
<bool name="enter_is_send">false</bool>
- <bool name="notifications_from_strangers">false</bool>
- <bool name="headsup_notifications">true</bool>
<bool name="dnd_on_silent_mode">false</bool>
<bool name="treat_vibrate_as_silent">false</bool>
+ <integer name="auto_accept_filesize_wifi">10485760</integer>
+ <integer name="auto_accept_filesize_mobile">524288</integer>
+ <integer name="auto_accept_filesize_roaming">0</integer>
+ <bool name="show_notification">true</bool>
+ <bool name="vibrate_on_notification">true</bool>
+ <bool name="led">true</bool>
+ <string name="notification_ringtone">content://settings/system/notification_sound</string>
+ <bool name="notifications_from_strangers">false</bool>
+ <bool name="headsup_notifications">true</bool>
+ <bool name="enable_quiet_hours">false</bool>
+ <bool name="manually_change_presence">true</bool>
+ <bool name="away_when_screen_off">false</bool>
+ <string name="picture_compression">auto</string>
+ <string name="image_compression">mid</string>
+ <string name="video_compression">mid</string>
+ <bool name="grant_new_contacts">true</bool>
+ <integer name="automatic_message_deletion">0</integer>
+ <bool name="confirm_messages">true</bool>
+ <bool name="allow_message_correction">true</bool>
+ <bool name="chat_states">true</bool>
+ <bool name="autojoin">true</bool>
+ <bool name="indicate_received">true</bool>
+ <bool name="use_tor">false</bool>
+ <bool name="show_connection_options">false</bool>
+ <bool name="last_activity">true</bool>
+ <bool name="dont_trust_system_cas">false</bool>
+ <bool name="btbv">true</bool>
+ <bool name="send_button_status">true</bool>
+ <string name="quick_action">recent</string>
+ <bool name="return_to_previous">false</bool>
+ <bool name="use_subject">true</bool>
+ <bool name="display_enter_key">false</bool>
+ <bool name="show_dynamic_tags">false</bool>
+ <integer name="grace_period">144</integer>
+ <bool name="use_larger_font">false</bool>
+ <bool name="presence_colored_names">false</bool>
+ <bool name="use_max_brightness">true</bool>
+ <bool name="auto_rotate">true</bool>
+ <bool name="use_white_background">false</bool>
+ <bool name="send_crashreport">true</bool>
+ <bool name="plain_text_logs">false</bool>
</resources> \ No newline at end of file
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index a9b3439b7..60fa80f4a 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -6,27 +6,27 @@
android:key="userinterface"
android:title="@string/pref_ui_options">
<CheckBoxPreference
- android:defaultValue="false"
+ android:defaultValue="@bool/use_white_background"
android:key="use_white_background"
android:summary="@string/pref_use_white_background_summary"
android:title="@string/pref_use_white_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="true"
+ 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" />
<CheckBoxPreference
- android:defaultValue="false"
+ android:defaultValue="@bool/presence_colored_names"
android:key="presence_colored_names"
android:summary="@string/pref_use_colored_names_to_indicate_status_summary"
android:title="@string/pref_use_colored_names_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"
@@ -34,12 +34,12 @@
android:summary="@string/pref_quick_action_summary"
android:title="@string/pref_quick_action" />
<CheckBoxPreference
- android:defaultValue="true"
+ android:defaultValue="@bool/use_max_brightness"
android:key="use_max_brightness"
android:summary="@string/pref_use_max_brightness_summary"
android:title="@string/pref_use_max_brightness" />
<CheckBoxPreference
- android:defaultValue="true"
+ android:defaultValue="@bool/auto_rotate"
android:key="use_auto_rotate"
android:summary="@string/pref_use_auto_rotate_summary"
android:title="@string/pref_use_auto_rotate" />
@@ -50,7 +50,7 @@
android:key="notifications"
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" />
@@ -66,7 +66,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" />
@@ -84,19 +84,19 @@
android:title="@string/title_pref_quiet_hours_end_time" />
</PreferenceScreen>
<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:summary="@string/pref_led_summary"
android:title="@string/pref_led" />
<RingtonePreference
- android:defaultValue="content://settings/system/notification_sound"
+ android:defaultValue="@string/notification_ringtone"
android:dependency="show_notification"
android:key="notification_ringtone"
android:ringtoneType="notification"
@@ -115,35 +115,35 @@
android:key="attachments"
android:title="@string/pref_attachments">
<ListPreference
- android:defaultValue="10485760"
+ android:defaultValue="@integer/auto_accept_filesize_wifi"
android:entries="@array/filesizes"
android:entryValues="@array/filesizes_values"
android:key="auto_accept_file_size_wifi"
android:summary="@string/pref_accept_files_summary_wifi"
android:title="@string/pref_accept_files_wifi" />
<ListPreference
- android:defaultValue="262144"
+ android:defaultValue="@integer/auto_accept_filesize_mobile"
android:entries="@array/filesizes"
android:entryValues="@array/filesizes_values"
android:key="auto_accept_file_size_mobile"
android:summary="@string/pref_accept_files_summary_mobile"
android:title="@string/pref_accept_files_mobile" />
<ListPreference
- android:defaultValue="1"
+ android:defaultValue="@integer/auto_accept_filesize_roaming"
android:entries="@array/filesizes"
android:entryValues="@array/filesizes_values"
android:key="auto_accept_file_size_roaming"
android:summary="@string/pref_accept_files_summary_mobileroaming"
android:title="@string/pref_accept_files_mobileroaming" />
<ListPreference
- android:defaultValue="high"
+ android:defaultValue="@string/image_compression"
android:entries="@array/image_compression_entries"
android:entryValues="@array/image_compression_values"
android:key="image_compression"
android:summary="@string/pref_picture_compression_summary"
android:title="@string/pref_picture_compression" />
<ListPreference
- android:defaultValue="high"
+ android:defaultValue="@string/video_compression"
android:entries="@array/video_compression_entries"
android:entryValues="@array/video_compression_values"
android:key="video_compression"
@@ -156,13 +156,13 @@
android:key="presence"
android:title="@string/pref_presence_settings">
<CheckBoxPreference
- android:defaultValue="true"
+ android:defaultValue="@bool/manually_change_presence"
android:disableDependentsState="true"
android:key="manually_change_presence"
android:summary="@string/pref_manually_change_presence_summary"
android:title="@string/pref_manually_change_presence" />
<CheckBoxPreference
- android:defaultValue="false"
+ android:defaultValue="@bool/away_when_screen_off"
android:dependency="manually_change_presence"
android:key="away_when_screen_off"
android:summary="@string/pref_away_when_screen_off_summary"
@@ -186,37 +186,37 @@
android:key="security"
android:title="@string/pref_security_settings">
<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" />
<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="true"
+ 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="true"
+ android:defaultValue="@bool/allow_message_correction"
android:key="allow_message_correction"
android:summary="@string/pref_allow_message_correction_summary"
android:title="@string/pref_allow_message_correction" />
<CheckBoxPreference
- android:defaultValue="true"
+ 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="true"
+ android:defaultValue="@bool/last_activity"
android:key="last_activity"
android:title="@string/pref_broadcast_last_activity"
android:summary="@string/pref_broadcast_last_activity_summary" />
<CheckBoxPreference
- android:defaultValue="true"
+ android:defaultValue="@bool/send_crashreport"
android:key="crashreport"
android:summary="@string/pref_send_crash_summary"
android:title="@string/pref_send_crash" />
@@ -226,7 +226,7 @@
android:summary="@string/pref_export_logs_summary"
android:title="@string/pref_export_logs" />
<CheckBoxPreference
- android:defaultValue="false"
+ android:defaultValue="@bool/plain_text_logs"
android:key="export_plain_text_logs"
android:summary="@string/pref_export_plain_text_logs_summary"
android:title="@string/pref_export_plain_text_logs" />
@@ -248,19 +248,19 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_ui_options">
<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" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_security_settings">
<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" />
<ListPreference
- android:defaultValue="0"
+ android:defaultValue="@integer/automatic_message_deletion"
android:entries="@array/automatic_message_deletion"
android:entryValues="@array/automatic_message_deletion_values"
android:key="automatic_message_deletion"
@@ -271,7 +271,7 @@
android:title="@string/pref_delete_omemo_identities"
android:summary="@string/pref_delete_omemo_identities_summary" />
<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" />
@@ -284,12 +284,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"/>
@@ -301,14 +301,14 @@
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_expert_options_other">
<CheckBoxPreference
- android:defaultValue="true"
+ android:defaultValue="@bool/autojoin"
android:key="autojoin"
android:summary="@string/pref_autojoin_summary"
android:title="@string/pref_autojoin" />