Refactoring

This commit is contained in:
M66B 2022-11-10 16:00:20 +01:00
parent 76cf2d5723
commit 0571cc07a1
3 changed files with 8 additions and 6 deletions

View File

@ -177,6 +177,10 @@ public class EntityAccount extends EntityOrder implements Serializable {
return "outlook.office365.com".equalsIgnoreCase(host); return "outlook.office365.com".equalsIgnoreCase(host);
} }
static boolean isOutlook(String id) {
return ("office365".equals(id) || "outlook".equals(id));
}
boolean isYahooJp() { boolean isYahooJp() {
return "imap.mail.yahoo.co.jp".equalsIgnoreCase(host); return "imap.mail.yahoo.co.jp".equalsIgnoreCase(host);
} }

View File

@ -319,9 +319,8 @@ public class FragmentAccount extends FragmentBase {
etUser.setTag(null); etUser.setTag(null);
etUser.setText(null); etUser.setText(null);
tilPassword.getEditText().setText(null); tilPassword.getEditText().setText(null);
tvAppPassword.setVisibility( tvAppPassword.setVisibility(EntityAccount.isOutlook(provider.id)
"office365".equals(provider.id) || "outlook".equals(provider.id) ? View.VISIBLE : View.GONE);
? View.VISIBLE : View.GONE);
certificate = null; certificate = null;
tvCertificate.setText(R.string.title_optional); tvCertificate.setText(R.string.title_optional);
etRealm.setText(null); etRealm.setText(null);
@ -1606,8 +1605,7 @@ public class FragmentAccount extends FragmentBase {
etUser.setText(account == null ? null : account.user); etUser.setText(account == null ? null : account.user);
tilPassword.getEditText().setText(account == null ? null : account.password); tilPassword.getEditText().setText(account == null ? null : account.password);
tvAppPassword.setVisibility(account != null && tvAppPassword.setVisibility(account != null && EntityAccount.isOutlook(account.provider)
("office365".equals(account.provider) || "outlook".equals(account.provider))
? View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE);
certificate = (account == null ? null : account.certificate_alias); certificate = (account == null ? null : account.certificate_alias);
tvCertificate.setText(certificate == null ? getString(R.string.title_optional) : certificate); tvCertificate.setText(certificate == null ? getString(R.string.title_optional) : certificate);

View File

@ -1006,7 +1006,7 @@ public class FragmentOAuth extends FragmentBase {
grpError.setVisibility(View.VISIBLE); grpError.setVisibility(View.VISIBLE);
if ("office365".equals(id) || "outlook".equals(id)) { if (EntityAccount.isOutlook(id)) {
if (ex instanceof AuthenticationFailedException) if (ex instanceof AuthenticationFailedException)
tvOfficeAuthHint.setVisibility(View.VISIBLE); tvOfficeAuthHint.setVisibility(View.VISIBLE);
} }