mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-05 12:24:26 +01:00
Moved badge settings to notification tab
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user