mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 06:38:29 +02:00
Added settings to include/exclude ignored new messages for widget/badge
This commit is contained in:
@@ -51,6 +51,7 @@ import static android.app.Activity.RESULT_OK;
|
||||
|
||||
public class FragmentOptionsNotifications extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swBadge;
|
||||
private SwitchCompat swUnseenIgnored;
|
||||
private SwitchCompat swNotifyPreview;
|
||||
private CheckBox cbNotifyActionTrash;
|
||||
private CheckBox cbNotifyActionArchive;
|
||||
@@ -67,7 +68,9 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
private Group grpNotification;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"badge", "notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen", "light", "sound"
|
||||
"badge", "unseen_ignored",
|
||||
"notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen",
|
||||
"light", "sound"
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -81,6 +84,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
// Get controls
|
||||
|
||||
swBadge = view.findViewById(R.id.swBadge);
|
||||
swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored);
|
||||
swNotifyPreview = view.findViewById(R.id.swNotifyPreview);
|
||||
cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash);
|
||||
cbNotifyActionArchive = view.findViewById(R.id.cbNotifyActionArchive);
|
||||
@@ -111,6 +115,14 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
}
|
||||
});
|
||||
|
||||
swUnseenIgnored.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("unseen_ignored", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "unseen_ignored");
|
||||
}
|
||||
});
|
||||
|
||||
swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -246,6 +258,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swBadge.setChecked(prefs.getBoolean("badge", true));
|
||||
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
|
||||
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
||||
|
||||
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true) || !pro);
|
||||
|
||||
Reference in New Issue
Block a user