|
|
|
@ -68,6 +68,8 @@ import com.google.android.material.snackbar.Snackbar;
|
|
|
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
|
|
|
import com.sun.mail.imap.IMAPFolder;
|
|
|
|
|
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
import java.security.cert.X509Certificate;
|
|
|
|
@ -121,6 +123,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
private CheckBox cbPartialFetch;
|
|
|
|
|
private CheckBox cbIgnoreSize;
|
|
|
|
|
private RadioGroup rgDate;
|
|
|
|
|
private CheckBox cbUnmetered;
|
|
|
|
|
|
|
|
|
|
private Button btnCheck;
|
|
|
|
|
private ContentLoadingProgressBar pbCheck;
|
|
|
|
@ -228,6 +231,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
cbPartialFetch = view.findViewById(R.id.cbPartialFetch);
|
|
|
|
|
cbIgnoreSize = view.findViewById(R.id.cbIgnoreSize);
|
|
|
|
|
rgDate = view.findViewById(R.id.rgDate);
|
|
|
|
|
cbUnmetered = view.findViewById(R.id.cbUnmeteredOnly);
|
|
|
|
|
|
|
|
|
|
btnCheck = view.findViewById(R.id.btnCheck);
|
|
|
|
|
pbCheck = view.findViewById(R.id.pbCheck);
|
|
|
|
@ -881,6 +885,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
args.putBoolean("ignore_size", cbIgnoreSize.isChecked());
|
|
|
|
|
args.putBoolean("use_date", rgDate.getCheckedRadioButtonId() == R.id.radio_date_header);
|
|
|
|
|
args.putBoolean("use_received", rgDate.getCheckedRadioButtonId() == R.id.radio_received_header);
|
|
|
|
|
args.putBoolean("unmetered", cbUnmetered.isChecked());
|
|
|
|
|
|
|
|
|
|
args.putSerializable("drafts", drafts);
|
|
|
|
|
args.putSerializable("sent", sent);
|
|
|
|
@ -950,6 +955,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
boolean ignore_size = args.getBoolean("ignore_size");
|
|
|
|
|
boolean use_date = args.getBoolean("use_date");
|
|
|
|
|
boolean use_received = args.getBoolean("use_received");
|
|
|
|
|
boolean unmetered = args.getBoolean("unmetered");
|
|
|
|
|
|
|
|
|
|
EntityFolder drafts = (EntityFolder) args.getSerializable("drafts");
|
|
|
|
|
EntityFolder sent = (EntityFolder) args.getSerializable("sent");
|
|
|
|
@ -994,6 +1000,14 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
EntityAccount account = db.account().getAccount(id);
|
|
|
|
|
|
|
|
|
|
JSONObject jconditions = new JSONObject();
|
|
|
|
|
if (account != null && account.conditions != null)
|
|
|
|
|
try {
|
|
|
|
|
jconditions = new JSONObject(account.conditions);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (should) {
|
|
|
|
|
if (account == null)
|
|
|
|
|
return !TextUtils.isEmpty(host) && !TextUtils.isEmpty(user);
|
|
|
|
@ -1046,6 +1060,8 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
return true;
|
|
|
|
|
if (!Objects.equals(account.use_received, use_received))
|
|
|
|
|
return true;
|
|
|
|
|
if (unmetered != jconditions.optBoolean("unmetered"))
|
|
|
|
|
return true;
|
|
|
|
|
if (account.error != null && account.synchronize)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
@ -1184,6 +1200,9 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
account.use_date = use_date;
|
|
|
|
|
account.use_received = use_received;
|
|
|
|
|
|
|
|
|
|
jconditions.put("unmetered", unmetered);
|
|
|
|
|
account.conditions = jconditions.toString();
|
|
|
|
|
|
|
|
|
|
if (!update)
|
|
|
|
|
account.created = now;
|
|
|
|
|
|
|
|
|
@ -1530,6 +1549,15 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
cbPartialFetch.setChecked(account == null ? true : account.partial_fetch);
|
|
|
|
|
cbIgnoreSize.setChecked(account == null ? false : account.ignore_size);
|
|
|
|
|
|
|
|
|
|
JSONObject jcondition = new JSONObject();
|
|
|
|
|
try {
|
|
|
|
|
if (account != null && account.conditions != null)
|
|
|
|
|
jcondition = new JSONObject(account.conditions);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
cbUnmetered.setChecked(jcondition.optBoolean("unmetered"));
|
|
|
|
|
|
|
|
|
|
if (account != null && account.use_date)
|
|
|
|
|
rgDate.check(R.id.radio_date_header);
|
|
|
|
|
else if (account != null && account.use_received)
|
|
|
|
|