mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
tweak behavior
This commit is contained in:
parent
7a5eb6bea6
commit
478d937b3c
1 changed files with 7 additions and 7 deletions
|
@ -100,7 +100,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||||
notificationsEnabled.setOnPreferenceChangeListener((preference, newValue) -> {
|
notificationsEnabled.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
boolean enabled = (Boolean) newValue;
|
boolean enabled = (Boolean) newValue;
|
||||||
dcContext.setMuted(!enabled);
|
dcContext.setMuted(!enabled);
|
||||||
notificationsEnabled.setSummary(getSummary(getContext(), ""));
|
notificationsEnabled.setSummary(getSummary(getContext(), false));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||||
// update ignoreBattery in onResume() to reflects changes done in the system settings
|
// update ignoreBattery in onResume() to reflects changes done in the system settings
|
||||||
ignoreBattery.setChecked(isIgnoringBatteryOptimizations());
|
ignoreBattery.setChecked(isIgnoringBatteryOptimizations());
|
||||||
notificationsEnabled.setChecked(!dcContext.isMuted());
|
notificationsEnabled.setChecked(!dcContext.isMuted());
|
||||||
notificationsEnabled.setSummary(getSummary(getContext(), ""));
|
notificationsEnabled.setSummary(getSummary(getContext(), false));
|
||||||
mentionNotifEnabled.setChecked(dcContext.isMentionsEnabled());
|
mentionNotifEnabled.setChecked(dcContext.isMentionsEnabled());
|
||||||
|
|
||||||
// set without altering "unset" state of the preference
|
// set without altering "unset" state of the preference
|
||||||
|
@ -163,7 +163,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||||
} else {
|
} else {
|
||||||
context.stopService(new Intent(context, KeepAliveService.class));
|
context.stopService(new Intent(context, KeepAliveService.class));
|
||||||
}
|
}
|
||||||
notificationsEnabled.setSummary(getSummary(context, ""));
|
notificationsEnabled.setSummary(getSummary(context, false));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,19 +243,19 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CharSequence getSummary(Context context) {
|
public static CharSequence getSummary(Context context) {
|
||||||
return getSummary(context, context.getString(R.string.on));
|
return getSummary(context, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CharSequence getSummary(Context context, String defaultOnValue) {
|
public static CharSequence getSummary(Context context, boolean detailed) {
|
||||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || notificationManager.areNotificationsEnabled()) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || notificationManager.areNotificationsEnabled()) {
|
||||||
if (DcHelper.getContext(context).isMuted()) {
|
if (DcHelper.getContext(context).isMuted()) {
|
||||||
return "⚠️ " + context.getString(R.string.notifications_disabled);
|
return detailed? context.getString(R.string.off) : "";
|
||||||
}
|
}
|
||||||
if (FcmReceiveService.getToken() == null && !Prefs.reliableService(context)) {
|
if (FcmReceiveService.getToken() == null && !Prefs.reliableService(context)) {
|
||||||
return "⚠️ " + context.getString(R.string.unreliable_bg_notifications);
|
return "⚠️ " + context.getString(R.string.unreliable_bg_notifications);
|
||||||
}
|
}
|
||||||
return defaultOnValue;
|
return detailed? context.getString(R.string.on) : "";
|
||||||
} else {
|
} else {
|
||||||
return "⚠️ " + context.getString(R.string.disabled_in_system_settings);
|
return "⚠️ " + context.getString(R.string.disabled_in_system_settings);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue