mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 01:32:17 -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);
|
sendReadMarker(c);
|
||||||
break;
|
break;
|
||||||
case AudioManager.RINGER_MODE_CHANGED_ACTION:
|
case AudioManager.RINGER_MODE_CHANGED_ACTION:
|
||||||
if (xaOnSilentMode()) {
|
if (dndOnSilentMode()) {
|
||||||
refreshAllPresences();
|
refreshAllPresences();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -860,8 +860,8 @@ public class XmppConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean xaOnSilentMode() {
|
private boolean dndOnSilentMode() {
|
||||||
return getPreferences().getBoolean("xa_on_silent_mode", false);
|
return getPreferences().getBoolean(SettingsActivity.DND_ON_SILENT_MODE, getResources().getBoolean(R.bool.dnd_on_silent_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean manuallyChangePresence() {
|
private boolean manuallyChangePresence() {
|
||||||
@ -869,7 +869,7 @@ public class XmppConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean treatVibrateAsSilent() {
|
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() {
|
private boolean awayWhenScreenOff() {
|
||||||
@ -881,8 +881,8 @@ public class XmppConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Presence.Status getTargetPresence() {
|
private Presence.Status getTargetPresence() {
|
||||||
if (xaOnSilentMode() && isPhoneSilenced()) {
|
if (dndOnSilentMode() && isPhoneSilenced()) {
|
||||||
return Presence.Status.XA;
|
return Presence.Status.DND;
|
||||||
} else if (awayWhenScreenOff() && !isInteractive()) {
|
} else if (awayWhenScreenOff() && !isInteractive()) {
|
||||||
return Presence.Status.AWAY;
|
return Presence.Status.AWAY;
|
||||||
} else {
|
} 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 KEEP_FOREGROUND_SERVICE = "enable_foreground_service";
|
||||||
public static final String AWAY_WHEN_SCREEN_IS_OFF = "away_when_screen_off";
|
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 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 MANUALLY_CHANGE_PRESENCE = "manually_change_presence";
|
||||||
public static final String BLIND_TRUST_BEFORE_VERIFICATION = "btbv";
|
public static final String BLIND_TRUST_BEFORE_VERIFICATION = "btbv";
|
||||||
public static final String AUTOMATIC_MESSAGE_DELETION = "automatic_message_deletion";
|
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) {
|
public void onSharedPreferenceChanged(SharedPreferences preferences, String name) {
|
||||||
final List<String> resendPresence = Arrays.asList(
|
final List<String> resendPresence = Arrays.asList(
|
||||||
"confirm_messages",
|
"confirm_messages",
|
||||||
"xa_on_silent_mode",
|
DND_ON_SILENT_MODE,
|
||||||
AWAY_WHEN_SCREEN_IS_OFF,
|
AWAY_WHEN_SCREEN_IS_OFF,
|
||||||
"allow_message_correction",
|
"allow_message_correction",
|
||||||
TREAT_VIBRATE_AS_SILENT,
|
TREAT_VIBRATE_AS_SILENT,
|
||||||
|
@ -5,4 +5,6 @@
|
|||||||
<bool name="enter_is_send">false</bool>
|
<bool name="enter_is_send">false</bool>
|
||||||
<bool name="notifications_from_strangers">false</bool>
|
<bool name="notifications_from_strangers">false</bool>
|
||||||
<bool name="headsup_notifications">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>
|
</resources>
|
||||||
|
@ -558,10 +558,10 @@
|
|||||||
<string name="pref_presence_settings">Presence</string>
|
<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">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_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="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">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">Extended connection settings</string>
|
||||||
<string name="pref_show_connection_options_summary">Show hostname and port settings when setting up an account</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>
|
<string name="hostname_example">xmpp.example.com</string>
|
||||||
|
@ -256,17 +256,17 @@
|
|||||||
android:title="@string/pref_away_when_screen_off"
|
android:title="@string/pref_away_when_screen_off"
|
||||||
android:dependency="manually_change_presence"/>
|
android:dependency="manually_change_presence"/>
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="@bool/dnd_on_silent_mode"
|
||||||
android:key="xa_on_silent_mode"
|
android:key="dnd_on_silent_mode"
|
||||||
android:summary="@string/pref_xa_on_silent_mode_summary"
|
android:summary="@string/pref_dnd_on_silent_mode_summary"
|
||||||
android:title="@string/pref_xa_on_silent_mode"
|
android:title="@string/pref_dnd_on_silent_mode"
|
||||||
android:dependency="manually_change_presence"/>
|
android:dependency="manually_change_presence"/>
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:dependency="xa_on_silent_mode"
|
android:dependency="dnd_on_silent_mode"
|
||||||
android:defaultValue="false"
|
android:defaultValue="@bool/treat_vibrate_as_silent"
|
||||||
android:key="treat_vibrate_as_silent"
|
android:key="treat_vibrate_as_silent"
|
||||||
android:title="@string/pref_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>
|
||||||
<PreferenceCategory android:title="@string/pref_expert_options_other">
|
<PreferenceCategory android:title="@string/pref_expert_options_other">
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
|
Loading…
Reference in New Issue
Block a user