diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-11-24 20:36:45 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-11-24 20:36:45 +0100 |
commit | b186a339b957332a9945f1706764bcc0e7d6334e (patch) | |
tree | 0e38b91530a83bfe521219aa6ea8fcbf0cbc6f71 /src | |
parent | f9a466a9d93543869deecaca08f6ee09597a4703 (diff) |
use constants for some preferences
Diffstat (limited to '')
3 files changed, 16 insertions, 10 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 92588e239..50701c8bc 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -101,6 +101,7 @@ import de.pixart.messenger.parser.MessageParser; import de.pixart.messenger.parser.PresenceParser; import de.pixart.messenger.persistance.DatabaseBackend; import de.pixart.messenger.persistance.FileBackend; +import de.pixart.messenger.ui.SettingsActivity; import de.pixart.messenger.ui.UiCallback; import de.pixart.messenger.utils.ConversationsFileObserver; import de.pixart.messenger.utils.CryptoHelper; @@ -882,15 +883,15 @@ public class XmppConnectionService extends Service { } private boolean manuallyChangePresence() { - return getPreferences().getBoolean("manually_change_presence", false); + return getPreferences().getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, false); } private boolean treatVibrateAsSilent() { - return getPreferences().getBoolean("treat_vibrate_as_silent", false); + return getPreferences().getBoolean(SettingsActivity.TREAT_VIBRATE_AS_SILENT, false); } private boolean awayWhenScreenOff() { - return getPreferences().getBoolean("away_when_screen_off", false); + return getPreferences().getBoolean(SettingsActivity.AWAY_WHEN_SCREEN_IS_OFF, false); } private String getCompressPicturesPreference() { diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index 51c41c2ea..9c712a553 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -35,6 +35,11 @@ import de.pixart.messenger.xmpp.jid.Jid; public class SettingsActivity extends XmppActivity implements OnSharedPreferenceChangeListener { + public static final String KEEP_FOREGROUND_SERVICE = "keep_foreground_service"; + public static final String AWAY_WHEN_SCREEN_IS_OFF = "away_when_screen_off"; + public static final String TREAT_VIBRATE_AS_SILENT = "treat_vibrate_as_silent"; + public static final String MANUALLY_CHANGE_PRESENCE = "manually_change_presence"; + public static final int REQUEST_WRITE_LOGS = 0xbf8701; private SettingsFragment mSettingsFragment; @@ -220,10 +225,10 @@ public class SettingsActivity extends XmppActivity implements final List<String> resendPresence = Arrays.asList( "confirm_messages", "xa_on_silent_mode", - "away_when_screen_off", + AWAY_WHEN_SCREEN_IS_OFF, "allow_message_correction", - "treat_vibrate_as_silent", - "manually_change_presence", + TREAT_VIBRATE_AS_SILENT, + MANUALLY_CHANGE_PRESENCE, "last_activity"); if (name.equals("resource")) { String resource = preferences.getString("resource", "mobile") @@ -243,11 +248,11 @@ public class SettingsActivity extends XmppActivity implements } } else if (resendPresence.contains(name)) { if (xmppConnectionServiceBound) { - if (name.equals("away_when_screen_off") - || name.equals("manually_change_presence")) { + if (name.equals(AWAY_WHEN_SCREEN_IS_OFF) + || name.equals(MANUALLY_CHANGE_PRESENCE)) { xmppConnectionService.toggleScreenEventReceiver(); } - if (name.equals("manually_change_presence") && !noAccountUsesPgp()) { + if (name.equals(MANUALLY_CHANGE_PRESENCE) && !noAccountUsesPgp()) { Toast.makeText(this, R.string.republish_pgp_keys, Toast.LENGTH_LONG).show(); } xmppConnectionService.refreshAllPresences(); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 8b3d26179..3246a1b28 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -1026,7 +1026,7 @@ public abstract class XmppActivity extends Activity { } protected boolean manuallyChangePresence() { - return getPreferences().getBoolean("manually_change_presence", true); + return getPreferences().getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, true); } protected void unregisterNdefPushMessageCallback() { |