aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-08-01 08:39:38 +0200
committerChristian Schneppe <christian@pix-art.de>2017-08-01 08:41:51 +0200
commit3831b987f76e2b0b143b45619a455d7ec4625bcd (patch)
treed704403a136dd3f5f7c995c1bf56855255e232b1 /src/main/java/de/pixart/messenger
parent6c2479b29c93222f83a2e672531fb681143c6fd1 (diff)
use DND instead of XA when phone is silent
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java12
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java3
2 files changed, 8 insertions, 7 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,