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