diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 12 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/SettingsActivity.java | 3 | ||||
-rw-r--r-- | src/main/res/values-de/strings.xml | 8 | ||||
-rw-r--r-- | src/main/res/values/defaults.xml | 2 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 6 | ||||
-rw-r--r-- | src/main/res/xml/preferences.xml | 14 |
6 files changed, 24 insertions, 21 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 243b9b4f5..6aea5c8cf 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -685,7 +685,7 @@ public class XmppConnectionService extends Service { sendReadMarker(c); break; case AudioManager.RINGER_MODE_CHANGED_ACTION: - if (xaOnSilentMode()) { + if (dndOnSilentMode()) { refreshAllPresences(); } break; @@ -870,8 +870,8 @@ public class XmppConnectionService extends Service { } } - private boolean xaOnSilentMode() { - return getPreferences().getBoolean("xa_on_silent_mode", false); + private boolean dndOnSilentMode() { + return getPreferences().getBoolean(SettingsActivity.DND_ON_SILENT_MODE, getResources().getBoolean(R.bool.dnd_on_silent_mode)); } private boolean manuallyChangePresence() { @@ -879,7 +879,7 @@ public class XmppConnectionService extends Service { } private boolean treatVibrateAsSilent() { - return getPreferences().getBoolean(SettingsActivity.TREAT_VIBRATE_AS_SILENT, false); + return getPreferences().getBoolean(SettingsActivity.TREAT_VIBRATE_AS_SILENT, getResources().getBoolean(R.bool.treat_vibrate_as_silent)); } private boolean awayWhenScreenOff() { @@ -943,8 +943,8 @@ public class XmppConnectionService extends Service { } private Presence.Status getTargetPresence() { - if (xaOnSilentMode() && isPhoneSilenced()) { - return Presence.Status.XA; + if (dndOnSilentMode() && isPhoneSilenced()) { + return Presence.Status.DND; } else if (awayWhenScreenOff() && !isInteractive()) { return Presence.Status.AWAY; } else { diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index feeec7c1c..9c92c8be5 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -39,6 +39,7 @@ public class SettingsActivity extends XmppActivity implements 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 DND_ON_SILENT_MODE = "dnd_on_silent_mode"; public static final String MANUALLY_CHANGE_PRESENCE = "manually_change_presence"; public static final String BLIND_TRUST_BEFORE_VERIFICATION = "btbv"; public static final String AUTOMATIC_MESSAGE_DELETION = "automatic_message_deletion"; @@ -238,7 +239,7 @@ public class SettingsActivity extends XmppActivity implements public void onSharedPreferenceChanged(SharedPreferences preferences, String name) { final List<String> resendPresence = Arrays.asList( "confirm_messages", - "xa_on_silent_mode", + DND_ON_SILENT_MODE, AWAY_WHEN_SCREEN_IS_OFF, "allow_message_correction", TREAT_VIBRATE_AS_SILENT, diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 7e9ff6420..0e15dbf4b 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -453,10 +453,10 @@ <string name="pref_presence_settings">Status</string> <string name="pref_away_when_screen_off">Abwesend bei abgeschaltetem Bildschirm</string> <string name="pref_away_when_screen_off_summary">Setzt deinen Status auf \"abwesend\", solange dein Bildschirm abgeschaltet ist</string> - <string name="pref_xa_on_silent_mode">Nicht verfügbar bei Stummschaltung</string> - <string name="pref_xa_on_silent_mode_summary">Setzt deinen Status auf \"nicht verfügbar\", solange dein Gerät lautlos ist</string> - <string name="pref_treat_vibrate_as_silent">Vibration als Lautlos behandeln</string> - <string name="pref_treat_vibrate_as_silent_summary">Setzt deinen Status auf \"nicht verfügbar\", solange das Gerät auf Vibration geschaltet ist</string> + <string name="pref_dnd_on_silent_mode">\"Bitte nicht stören\" bei Stummschaltung</string> + <string name="pref_dnd_on_silent_mode_summary">Setzt deinen Status auf \"Bitte nicht stören\", solange dein Gerät stummgeschaltet ist</string> + <string name="pref_treat_vibrate_as_dnd">Vibration als \"Lautlos\" behandeln</string> + <string name="pref_treat_vibrate_as_dnd_summary">Setzt deinen Status auf \"Bitte nicht stören\", solange das Gerät auf Vibration geschaltet ist</string> <string name="hostname_example">xmpp.pix-art.de</string> <string name="action_add_account_with_certificate">Profil mit Zertifikat hinzufügen</string> <string name="unable_to_parse_certificate">Zertifikat kann nicht gelesen werden</string> diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index 8cee33d5f..46f313da9 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -5,4 +5,6 @@ <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> </resources>
\ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index d8ff9fa52..e2c9c5873 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -529,11 +529,11 @@ <string name="pref_presence_settings">Presence</string> <string name="pref_away_when_screen_off">Away when screen is off</string> <string name="pref_away_when_screen_off_summary">Marks your resource as away when the screen is turned off</string> - <string name="pref_xa_on_silent_mode">Not available in silent mode</string> + <string name="pref_dnd_on_silent_mode">\"Do not disturb\" in silent mode</string> <string name="update_info">Pix-Art Messenger is checking for an update. If an update is available you will be asked, if you want to update your version. The update process is downloading and installing the new version automatically.\n\nPlease wait…</string> - <string name="pref_xa_on_silent_mode_summary">Marks your resource as not available when device is in silent mode</string> + <string name="pref_dnd_on_silent_mode_summary">Marks your resource as \"Do not disturb\" when device is in silent mode</string> <string name="pref_treat_vibrate_as_silent">Treat vibrate as silent mode</string> - <string name="pref_treat_vibrate_as_silent_summary">Marks your resource as not available when device is on vibrate</string> + <string name="pref_treat_vibrate_as_dnd_summary">Marks your resource as \"Do not disturb\" when device is on vibrate</string> <string name="hostname_example">xmpp.pix-art.de</string> <string name="action_add_account_with_certificate">Add account with certificate</string> <string name="unable_to_parse_certificate">Unable to parse certificate</string> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 877a9b05a..a9b3439b7 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -168,16 +168,16 @@ android:summary="@string/pref_away_when_screen_off_summary" android:title="@string/pref_away_when_screen_off" /> <CheckBoxPreference - android:defaultValue="false" + android:defaultValue="@bool/dnd_on_silent_mode" android:dependency="manually_change_presence" - android:key="xa_on_silent_mode" - android:summary="@string/pref_xa_on_silent_mode_summary" - android:title="@string/pref_xa_on_silent_mode" /> + android:key="dnd_on_silent_mode" + android:summary="@string/pref_dnd_on_silent_mode_summary" + android:title="@string/pref_dnd_on_silent_mode" /> <CheckBoxPreference - android:defaultValue="false" - android:dependency="xa_on_silent_mode" + android:defaultValue="@bool/treat_vibrate_as_silent" + android:dependency="dnd_on_silent_mode" android:key="treat_vibrate_as_silent" - android:summary="@string/pref_treat_vibrate_as_silent_summary" + android:summary="@string/pref_treat_vibrate_as_dnd_summary" android:title="@string/pref_treat_vibrate_as_silent" /> </PreferenceScreen> <!--Security--> |