diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 1706335a28..685c3e2465 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -45,7 +45,6 @@ import androidx.constraintlayout.widget.Group; import androidx.preference.PreferenceManager; public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { - private SwitchCompat swBadge; private SwitchCompat swSubscriptions; private TextView tvSubscriptionPro; private SwitchCompat swSubscribedOnly; @@ -66,7 +65,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private Group grpDebug; private final static String[] RESET_OPTIONS = new String[]{ - "badge", "subscriptions", "subscribed_only", "biometrics_timeout", "double_back", "english", "watchdog", "updates", "crash_reports", "debug" + "subscriptions", "subscribed_only", "biometrics_timeout", "double_back", "english", "watchdog", "updates", "crash_reports", "debug" }; private final static String[] RESET_QUESTIONS = new String[]{ @@ -83,7 +82,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc // Get controls - swBadge = view.findViewById(R.id.swBadge); swSubscriptions = view.findViewById(R.id.swSubscriptions); tvSubscriptionPro = view.findViewById(R.id.tvSubscriptionPro); swSubscribedOnly = view.findViewById(R.id.swSubscribedOnly); @@ -109,14 +107,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - swBadge.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("badge", checked).apply(); - ServiceSynchronize.reload(getContext(), "badge"); - } - }); - swSubscriptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -287,8 +277,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private void setOptions() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - swBadge.setChecked(prefs.getBoolean("badge", true)); - boolean pro = ActivityBilling.isPro(getContext()); swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false) && pro); swSubscriptions.setEnabled(pro); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index bacfef5356..4260c192f8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -50,6 +50,7 @@ import androidx.preference.PreferenceManager; import static android.app.Activity.RESULT_OK; public class FragmentOptionsNotifications extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { + private SwitchCompat swBadge; private SwitchCompat swNotifyPreview; private CheckBox cbNotifyActionTrash; private CheckBox cbNotifyActionArchive; @@ -66,7 +67,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared private Group grpNotification; private final static String[] RESET_OPTIONS = new String[]{ - "notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen", "light", "sound" + "badge", "notify_preview", "notify_trash", "notify_archive", "notify_reply", "notify_flag", "notify_seen", "light", "sound" }; @Override @@ -79,6 +80,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared // Get controls + swBadge = view.findViewById(R.id.swBadge); swNotifyPreview = view.findViewById(R.id.swNotifyPreview); cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash); cbNotifyActionArchive = view.findViewById(R.id.cbNotifyActionArchive); @@ -101,6 +103,14 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared PackageManager pm = getContext().getPackageManager(); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + swBadge.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("badge", checked).apply(); + ServiceSynchronize.reload(getContext(), "badge"); + } + }); + swNotifyPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -235,6 +245,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared boolean pro = ActivityBilling.isPro(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + swBadge.setChecked(prefs.getBoolean("badge", true)); swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true)); cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true) || !pro); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 8ff1d6b0d7..5bed70ce0f 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -19,38 +19,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - + + + + Show a warning when the receiving server could not authenticate the message Automatically recognize and disable tracking images + Show launcher icon with number of new messages Show message preview in notifications Notification actions Trash @@ -256,12 +257,13 @@ Reply Star Read - At most three actions will be shown - Tap on the channel name \'Notifications\' to set the default notification sound, etc Use notification light Select notification sound - Show launcher icon with number of new messages + Only available on supported launchers + At most three actions will be shown + Tap on the channel name \'Notifications\' to set the default notification sound, etc + Manage folder subscriptions Synchronize subscribed folders only Biometric authentication timeout @@ -305,7 +307,6 @@ Automatically close conversations when all messages are archived, sent or trashed Most providers do not allow modified sender addresses - Only available on supported launchers Enabling this will delete all local folders without subscription This will restart the app Enable extra logging and show debug information at various places