mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 19:10:11 +01:00
Added on demand sync setting
This commit is contained in:
@@ -94,6 +94,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
|
||||
private Button btnAdvanced;
|
||||
private CheckBox cbSynchronize;
|
||||
private CheckBox cbOnDemand;
|
||||
private CheckBox cbPrimary;
|
||||
private CheckBox cbNotify;
|
||||
private TextView tvNotifyPro;
|
||||
@@ -197,6 +198,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
|
||||
btnAdvanced = view.findViewById(R.id.btnAdvanced);
|
||||
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
||||
cbOnDemand = view.findViewById(R.id.cbOnDemand);
|
||||
cbPrimary = view.findViewById(R.id.cbPrimary);
|
||||
cbNotify = view.findViewById(R.id.cbNotify);
|
||||
tvNotifyPro = view.findViewById(R.id.tvNotifyPro);
|
||||
@@ -341,6 +343,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
cbOnDemand.setEnabled(checked);
|
||||
cbPrimary.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
@@ -701,6 +704,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
args.putInt("color", btnColor.getColor());
|
||||
|
||||
args.putBoolean("synchronize", cbSynchronize.isChecked());
|
||||
args.putBoolean("ondemand", cbOnDemand.isChecked());
|
||||
args.putBoolean("primary", cbPrimary.isChecked());
|
||||
args.putBoolean("notify", cbNotify.isChecked());
|
||||
args.putBoolean("browse", cbBrowse.isChecked());
|
||||
@@ -759,6 +763,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
Integer color = args.getInt("color");
|
||||
|
||||
boolean synchronize = args.getBoolean("synchronize");
|
||||
boolean ondemand = args.getBoolean("ondemand");
|
||||
boolean primary = args.getBoolean("primary");
|
||||
boolean notify = args.getBoolean("notify");
|
||||
boolean browse = args.getBoolean("browse");
|
||||
@@ -836,6 +841,8 @@ public class FragmentAccount extends FragmentBase {
|
||||
return true;
|
||||
if (!Objects.equals(account.synchronize, synchronize))
|
||||
return true;
|
||||
if (!Objects.equals(account.ondemand, ondemand))
|
||||
return true;
|
||||
if (!Objects.equals(account.primary, account.synchronize && primary))
|
||||
return true;
|
||||
if (!Objects.equals(account.notify, notify))
|
||||
@@ -963,6 +970,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
account.color = color;
|
||||
|
||||
account.synchronize = synchronize;
|
||||
account.ondemand = ondemand;
|
||||
account.primary = (account.synchronize && primary);
|
||||
account.notify = notify;
|
||||
account.browse = browse;
|
||||
@@ -1240,6 +1248,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
cbNotify.setEnabled(pro);
|
||||
|
||||
cbSynchronize.setChecked(account == null ? true : account.synchronize);
|
||||
cbOnDemand.setChecked(account == null ? false : account.ondemand);
|
||||
cbPrimary.setChecked(account == null ? false : account.primary);
|
||||
cbBrowse.setChecked(account == null ? true : account.browse);
|
||||
cbAutoSeen.setChecked(account == null ? true : account.auto_seen);
|
||||
@@ -1284,6 +1293,7 @@ public class FragmentAccount extends FragmentBase {
|
||||
tilPassword.setEnabled(false);
|
||||
}
|
||||
|
||||
cbOnDemand.setEnabled(cbSynchronize.isChecked());
|
||||
cbPrimary.setEnabled(cbSynchronize.isChecked());
|
||||
|
||||
// Consider previous check/save/delete as cancelled
|
||||
|
||||
Reference in New Issue
Block a user