|
|
@ -101,6 +101,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
private RadioGroup rgEncryption;
|
|
|
|
private RadioGroup rgEncryption;
|
|
|
|
private CheckBox cbInsecure;
|
|
|
|
private CheckBox cbInsecure;
|
|
|
|
private TextView tvInsecureRemark;
|
|
|
|
private TextView tvInsecureRemark;
|
|
|
|
|
|
|
|
private CheckBox cbDane;
|
|
|
|
private EditText etPort;
|
|
|
|
private EditText etPort;
|
|
|
|
private EditText etUser;
|
|
|
|
private EditText etUser;
|
|
|
|
private TextInputLayout tilPassword;
|
|
|
|
private TextInputLayout tilPassword;
|
|
|
@ -224,6 +225,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
rgEncryption = view.findViewById(R.id.rgEncryption);
|
|
|
|
rgEncryption = view.findViewById(R.id.rgEncryption);
|
|
|
|
cbInsecure = view.findViewById(R.id.cbInsecure);
|
|
|
|
cbInsecure = view.findViewById(R.id.cbInsecure);
|
|
|
|
tvInsecureRemark = view.findViewById(R.id.tvInsecureRemark);
|
|
|
|
tvInsecureRemark = view.findViewById(R.id.tvInsecureRemark);
|
|
|
|
|
|
|
|
cbDane = view.findViewById(R.id.cbDane);
|
|
|
|
etUser = view.findViewById(R.id.etUser);
|
|
|
|
etUser = view.findViewById(R.id.etUser);
|
|
|
|
tilPassword = view.findViewById(R.id.tilPassword);
|
|
|
|
tilPassword = view.findViewById(R.id.tilPassword);
|
|
|
|
tvAppPassword = view.findViewById(R.id.tvAppPassword);
|
|
|
|
tvAppPassword = view.findViewById(R.id.tvAppPassword);
|
|
|
@ -366,6 +368,13 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbInsecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
|
|
|
|
|
|
|
cbDane.setEnabled(!checked);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
tvInsecureRemark.setOnClickListener(new View.OnClickListener() {
|
|
|
|
tvInsecureRemark.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
@ -631,6 +640,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
if (!SSLHelper.customTrustManager()) {
|
|
|
|
if (!SSLHelper.customTrustManager()) {
|
|
|
|
Helper.hide(cbInsecure);
|
|
|
|
Helper.hide(cbInsecure);
|
|
|
|
Helper.hide(tvInsecureRemark);
|
|
|
|
Helper.hide(tvInsecureRemark);
|
|
|
|
|
|
|
|
Helper.hide(cbDane);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (id < 0)
|
|
|
|
if (id < 0)
|
|
|
@ -729,6 +739,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
args.putString("host", etHost.getText().toString().trim().replace(" ", ""));
|
|
|
|
args.putString("host", etHost.getText().toString().trim().replace(" ", ""));
|
|
|
|
args.putInt("encryption", encryption);
|
|
|
|
args.putInt("encryption", encryption);
|
|
|
|
args.putBoolean("insecure", cbInsecure.isChecked());
|
|
|
|
args.putBoolean("insecure", cbInsecure.isChecked());
|
|
|
|
|
|
|
|
args.putBoolean("dane", cbDane.isChecked());
|
|
|
|
args.putString("port", etPort.getText().toString());
|
|
|
|
args.putString("port", etPort.getText().toString());
|
|
|
|
args.putInt("auth", auth);
|
|
|
|
args.putInt("auth", auth);
|
|
|
|
args.putString("provider", provider);
|
|
|
|
args.putString("provider", provider);
|
|
|
@ -774,6 +785,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
String host = args.getString("host");
|
|
|
|
String host = args.getString("host");
|
|
|
|
int encryption = args.getInt("encryption");
|
|
|
|
int encryption = args.getInt("encryption");
|
|
|
|
boolean insecure = args.getBoolean("insecure");
|
|
|
|
boolean insecure = args.getBoolean("insecure");
|
|
|
|
|
|
|
|
boolean dane = args.getBoolean("dane");
|
|
|
|
String port = args.getString("port");
|
|
|
|
String port = args.getString("port");
|
|
|
|
int auth = args.getInt("auth");
|
|
|
|
int auth = args.getInt("auth");
|
|
|
|
String provider = args.getString("provider");
|
|
|
|
String provider = args.getString("provider");
|
|
|
@ -808,8 +820,8 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
// Check IMAP server / get folders
|
|
|
|
// Check IMAP server / get folders
|
|
|
|
String protocol = "imap" + (encryption == EmailService.ENCRYPTION_SSL ? "s" : "");
|
|
|
|
String protocol = "imap" + (encryption == EmailService.ENCRYPTION_SSL ? "s" : "");
|
|
|
|
try (EmailService iservice = new EmailService(
|
|
|
|
try (EmailService iservice = new EmailService(context,
|
|
|
|
context, protocol, realm, encryption, insecure, unicode,
|
|
|
|
protocol, realm, encryption, insecure, dane, unicode,
|
|
|
|
EmailService.PURPOSE_CHECK, true)) {
|
|
|
|
EmailService.PURPOSE_CHECK, true)) {
|
|
|
|
iservice.connect(
|
|
|
|
iservice.connect(
|
|
|
|
host, Integer.parseInt(port),
|
|
|
|
host, Integer.parseInt(port),
|
|
|
@ -938,6 +950,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
args.putString("host", etHost.getText().toString().trim().replace(" ", ""));
|
|
|
|
args.putString("host", etHost.getText().toString().trim().replace(" ", ""));
|
|
|
|
args.putInt("encryption", encryption);
|
|
|
|
args.putInt("encryption", encryption);
|
|
|
|
args.putBoolean("insecure", cbInsecure.isChecked());
|
|
|
|
args.putBoolean("insecure", cbInsecure.isChecked());
|
|
|
|
|
|
|
|
args.putBoolean("dane", cbDane.isChecked());
|
|
|
|
args.putString("port", etPort.getText().toString());
|
|
|
|
args.putString("port", etPort.getText().toString());
|
|
|
|
args.putInt("auth", auth);
|
|
|
|
args.putInt("auth", auth);
|
|
|
|
args.putString("provider", provider);
|
|
|
|
args.putString("provider", provider);
|
|
|
@ -1015,6 +1028,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
String host = args.getString("host");
|
|
|
|
String host = args.getString("host");
|
|
|
|
int encryption = args.getInt("encryption");
|
|
|
|
int encryption = args.getInt("encryption");
|
|
|
|
boolean insecure = args.getBoolean("insecure");
|
|
|
|
boolean insecure = args.getBoolean("insecure");
|
|
|
|
|
|
|
|
boolean dane = args.getBoolean("dane");
|
|
|
|
String port = args.getString("port");
|
|
|
|
String port = args.getString("port");
|
|
|
|
int auth = args.getInt("auth");
|
|
|
|
int auth = args.getInt("auth");
|
|
|
|
String provider = args.getString("provider");
|
|
|
|
String provider = args.getString("provider");
|
|
|
@ -1111,6 +1125,8 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(account.insecure, insecure))
|
|
|
|
if (!Objects.equals(account.insecure, insecure))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (!Objects.equals(account.dane, dane))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(account.port, Integer.parseInt(port)))
|
|
|
|
if (!Objects.equals(account.port, Integer.parseInt(port)))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
if (account.auth_type != auth)
|
|
|
|
if (account.auth_type != auth)
|
|
|
@ -1211,6 +1227,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
!account.host.equals(host) ||
|
|
|
|
!account.host.equals(host) ||
|
|
|
|
!account.encryption.equals(encryption) ||
|
|
|
|
!account.encryption.equals(encryption) ||
|
|
|
|
!account.insecure.equals(insecure) ||
|
|
|
|
!account.insecure.equals(insecure) ||
|
|
|
|
|
|
|
|
!account.dane.equals(dane) ||
|
|
|
|
!account.port.equals(Integer.parseInt(port)) ||
|
|
|
|
!account.port.equals(Integer.parseInt(port)) ||
|
|
|
|
!account.user.equals(user) ||
|
|
|
|
!account.user.equals(user) ||
|
|
|
|
!account.password.equals(password) ||
|
|
|
|
!account.password.equals(password) ||
|
|
|
@ -1228,8 +1245,8 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
EntityFolder inbox = null;
|
|
|
|
EntityFolder inbox = null;
|
|
|
|
if (check) {
|
|
|
|
if (check) {
|
|
|
|
String protocol = "imap" + (encryption == EmailService.ENCRYPTION_SSL ? "s" : "");
|
|
|
|
String protocol = "imap" + (encryption == EmailService.ENCRYPTION_SSL ? "s" : "");
|
|
|
|
try (EmailService iservice = new EmailService(
|
|
|
|
try (EmailService iservice = new EmailService(context,
|
|
|
|
context, protocol, realm, encryption, insecure, unicode,
|
|
|
|
protocol, realm, encryption, insecure, dane, unicode,
|
|
|
|
EmailService.PURPOSE_CHECK, true)) {
|
|
|
|
EmailService.PURPOSE_CHECK, true)) {
|
|
|
|
iservice.connect(
|
|
|
|
iservice.connect(
|
|
|
|
host, Integer.parseInt(port),
|
|
|
|
host, Integer.parseInt(port),
|
|
|
@ -1277,6 +1294,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
account.host = host;
|
|
|
|
account.host = host;
|
|
|
|
account.encryption = encryption;
|
|
|
|
account.encryption = encryption;
|
|
|
|
account.insecure = insecure;
|
|
|
|
account.insecure = insecure;
|
|
|
|
|
|
|
|
account.dane = dane;
|
|
|
|
account.port = Integer.parseInt(port);
|
|
|
|
account.port = Integer.parseInt(port);
|
|
|
|
account.auth_type = auth;
|
|
|
|
account.auth_type = auth;
|
|
|
|
account.user = user;
|
|
|
|
account.user = user;
|
|
|
@ -1673,6 +1691,8 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
rgEncryption.check(R.id.radio_ssl);
|
|
|
|
rgEncryption.check(R.id.radio_ssl);
|
|
|
|
|
|
|
|
|
|
|
|
cbInsecure.setChecked(account == null ? false : account.insecure);
|
|
|
|
cbInsecure.setChecked(account == null ? false : account.insecure);
|
|
|
|
|
|
|
|
cbDane.setChecked(account == null ? false : account.dane);
|
|
|
|
|
|
|
|
cbDane.setEnabled(!cbInsecure.isChecked());
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|