mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-26 01:09:13 -05:00
use DND instead of XA when phone is silent
This commit is contained in:
parent
c85b3bbacc
commit
59e39304dd
@ -682,7 +682,7 @@ public class XmppConnectionService extends Service {
|
||||
sendReadMarker(c);
|
||||
break;
|
||||
case AudioManager.RINGER_MODE_CHANGED_ACTION:
|
||||
if (xaOnSilentMode()) {
|
||||
if (dndOnSilentMode()) {
|
||||
refreshAllPresences();
|
||||
}
|
||||
break;
|
||||
@ -860,8 +860,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() {
|
||||
@ -869,7 +869,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() {
|
||||
@ -881,8 +881,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 {
|
||||
|
@ -42,6 +42,7 @@ public class SettingsActivity extends XmppActivity implements
|
||||
public static final String KEEP_FOREGROUND_SERVICE = "enable_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";
|
||||
@ -332,7 +333,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,
|
||||
|
@ -5,4 +5,6 @@
|
||||
<bool name="enter_is_send">false</bool>
|
||||
<bool name="notifications_from_strangers">false</bool>
|
||||
<bool name="headsup_notifications">false</bool>
|
||||
<bool name="dnd_on_silent_mode">false</bool>
|
||||
<bool name="treat_vibrate_as_silent">false</bool>
|
||||
</resources>
|
||||
|
@ -558,10 +558,10 @@
|
||||
<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_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">“Do not disturb” 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="pref_show_connection_options">Extended connection settings</string>
|
||||
<string name="pref_show_connection_options_summary">Show hostname and port settings when setting up an account</string>
|
||||
<string name="hostname_example">xmpp.example.com</string>
|
||||
|
@ -256,17 +256,17 @@
|
||||
android:title="@string/pref_away_when_screen_off"
|
||||
android:dependency="manually_change_presence"/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="xa_on_silent_mode"
|
||||
android:summary="@string/pref_xa_on_silent_mode_summary"
|
||||
android:title="@string/pref_xa_on_silent_mode"
|
||||
android:defaultValue="@bool/dnd_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"
|
||||
android:dependency="manually_change_presence"/>
|
||||
<CheckBoxPreference
|
||||
android:dependency="xa_on_silent_mode"
|
||||
android:defaultValue="false"
|
||||
android:dependency="dnd_on_silent_mode"
|
||||
android:defaultValue="@bool/treat_vibrate_as_silent"
|
||||
android:key="treat_vibrate_as_silent"
|
||||
android:title="@string/pref_treat_vibrate_as_silent"
|
||||
android:summary="@string/pref_treat_vibrate_as_silent_summary"/>
|
||||
android:summary="@string/pref_treat_vibrate_as_dnd_summary"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_expert_options_other">
|
||||
<CheckBoxPreference
|
||||
|
Loading…
Reference in New Issue
Block a user