This commit is contained in:
M66B
2018-09-05 20:39:47 +00:00
parent 86c9bea815
commit deaa30a5f3
3 changed files with 27 additions and 15 deletions

View File

@@ -134,6 +134,12 @@ public class FragmentIdentity extends FragmentEx {
Provider provider = (Provider) spProvider.getItemAtPosition(pos);
if (provider.imap_host.equals(account.host) && provider.imap_port == account.port) {
spProvider.setSelection(pos);
// This is needed because the spinner might be invisible
etHost.setText(provider.smtp_host);
etPort.setText(Integer.toString(provider.smtp_port));
cbStartTls.setChecked(provider.starttls);
break;
}
}
@@ -396,15 +402,15 @@ public class FragmentIdentity extends FragmentEx {
// Observe identity
db.identity().liveIdentity(id).observe(getViewLifecycleOwner(), new Observer<EntityIdentity>() {
boolean once = false;
private boolean once = false;
@Override
public void onChanged(@Nullable final EntityIdentity identity) {
if (savedInstanceState == null) {
if (once)
return;
once = true;
if (once)
return;
once = true;
if (savedInstanceState == null) {
etName.setText(identity == null ? null : identity.name);
etEmail.setText(identity == null ? null : identity.email);
etReplyTo.setText(identity == null ? null : identity.replyto);
@@ -433,8 +439,14 @@ public class FragmentIdentity extends FragmentEx {
db.account().liveAccounts().removeObservers(getViewLifecycleOwner());
db.account().liveAccounts().observe(getViewLifecycleOwner(), new Observer<List<EntityAccount>>() {
private boolean once = false;
@Override
public void onChanged(List<EntityAccount> accounts) {
if (once)
return;
once = true;
if (accounts == null)
accounts = new ArrayList<>();