mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 21:58:52 +02:00
Added experimental option to use background service
This commit is contained in:
@@ -52,6 +52,8 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
private Button btnManage;
|
||||
private Button btnManageDefault;
|
||||
private Button btnManageService;
|
||||
private SwitchCompat swBackground;
|
||||
|
||||
private CheckBox cbNotifyActionTrash;
|
||||
private CheckBox cbNotifyActionJunk;
|
||||
private CheckBox cbNotifyActionBlockSender;
|
||||
@@ -106,6 +108,8 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
btnManage = view.findViewById(R.id.btnManage);
|
||||
btnManageDefault = view.findViewById(R.id.btnManageDefault);
|
||||
btnManageService = view.findViewById(R.id.btnManageService);
|
||||
swBackground = view.findViewById(R.id.swBackground);
|
||||
|
||||
cbNotifyActionTrash = view.findViewById(R.id.cbNotifyActionTrash);
|
||||
cbNotifyActionJunk = view.findViewById(R.id.cbNotifyActionJunk);
|
||||
cbNotifyActionBlockSender = view.findViewById(R.id.cbNotifyActionBlockSender);
|
||||
@@ -180,6 +184,14 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
}
|
||||
});
|
||||
|
||||
swBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("background_service", checked).apply();
|
||||
ServiceSynchronize.eval(getContext(), "background=" + checked);
|
||||
}
|
||||
});
|
||||
|
||||
cbNotifyActionTrash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
||||
@@ -406,6 +418,8 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||
boolean pro = ActivityBilling.isPro(getContext());
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swBackground.setChecked(prefs.getBoolean("background_service", false));
|
||||
|
||||
cbNotifyActionTrash.setChecked(prefs.getBoolean("notify_trash", true) || !pro);
|
||||
cbNotifyActionJunk.setChecked(prefs.getBoolean("notify_junk", false) && pro);
|
||||
cbNotifyActionBlockSender.setChecked(prefs.getBoolean("notify_block_sender", false) && pro);
|
||||
|
||||
Reference in New Issue
Block a user