1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Allow manual sync of POP accounts

This commit is contained in:
M66B 2019-12-10 16:51:21 +01:00
parent ba473504be
commit 085e3d44af
2 changed files with 20 additions and 3 deletions

View file

@ -69,6 +69,7 @@ public class FragmentPop extends FragmentBase {
private TextView tvColorPro;
private CheckBox cbSynchronize;
private CheckBox cbOnDemand;
private CheckBox cbPrimary;
private CheckBox cbLeave;
private EditText etInterval;
@ -117,6 +118,7 @@ public class FragmentPop extends FragmentBase {
tvColorPro = view.findViewById(R.id.tvColorPro);
cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbOnDemand = view.findViewById(R.id.cbOnDemand);
cbPrimary = view.findViewById(R.id.cbPrimary);
cbLeave = view.findViewById(R.id.cbLeave);
etInterval = view.findViewById(R.id.etInterval);
@ -149,6 +151,7 @@ public class FragmentPop extends FragmentBase {
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
cbOnDemand.setEnabled(checked);
cbPrimary.setEnabled(checked);
}
});
@ -184,6 +187,7 @@ public class FragmentPop extends FragmentBase {
args.putInt("color", btnColor.getColor());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("ondemand", cbOnDemand.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
args.putBoolean("leave", cbLeave.isChecked());
args.putString("interval", etInterval.getText().toString());
@ -220,6 +224,7 @@ public class FragmentPop extends FragmentBase {
Integer color = args.getInt("color");
boolean synchronize = args.getBoolean("synchronize");
boolean ondemand = args.getBoolean("ondemand");
boolean primary = args.getBoolean("primary");
boolean leave = args.getBoolean("leave");
String interval = args.getString("interval");
@ -303,6 +308,7 @@ public class FragmentPop extends FragmentBase {
account.color = color;
account.synchronize = synchronize;
account.ondemand = ondemand;
account.primary = (account.synchronize && primary);
account.browse = leave;
account.poll_interval = Integer.parseInt(interval);
@ -447,6 +453,7 @@ public class FragmentPop extends FragmentBase {
btnColor.setColor(account == null ? null : account.color);
cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbOnDemand.setChecked(account == null ? false : account.ondemand);
cbPrimary.setChecked(account == null ? false : account.primary);
cbLeave.setChecked(account == null ? true : account.browse);
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
@ -472,10 +479,11 @@ public class FragmentPop extends FragmentBase {
tilPassword.getEditText().setText(savedInstanceState.getString("fair:password"));
}
cbPrimary.setEnabled(cbSynchronize.isChecked());
Helper.setViewsEnabled(view, true);
cbOnDemand.setEnabled(cbSynchronize.isChecked());
cbPrimary.setEnabled(cbSynchronize.isChecked());
pbWait.setVisibility(View.GONE);
}

View file

@ -250,6 +250,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvColorPro" />
<CheckBox
android:id="@+id/cbOnDemand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_account_ondemand"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
<CheckBox
android:id="@+id/cbPrimary"
android:layout_width="wrap_content"
@ -257,7 +266,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_primary_account"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
app:layout_constraintTop_toBottomOf="@id/cbOnDemand" />
<CheckBox
android:id="@+id/cbLeave"