Improvements

pull/50/head
M66B 6 years ago
parent 9e602ca950
commit d727c2bb52

@ -609,33 +609,33 @@ public class FragmentAccount extends FragmentEx {
spProvider.setAdapter(padapter); spProvider.setAdapter(padapter);
if (savedInstanceState == null) { if (savedInstanceState == null) {
if (!once) { if (once)
once = true; return;
once = true;
etName.setText(account == null ? null : account.name);
etHost.setText(account == null ? null : account.host); etName.setText(account == null ? null : account.name);
etPort.setText(account == null ? null : Long.toString(account.port)); etHost.setText(account == null ? null : account.host);
etUser.setText(account == null ? null : account.user); etPort.setText(account == null ? null : Long.toString(account.port));
tilPassword.getEditText().setText(account == null ? null : account.password); etUser.setText(account == null ? null : account.user);
cbSynchronize.setChecked(account == null ? true : account.synchronize); tilPassword.getEditText().setText(account == null ? null : account.password);
cbPrimary.setChecked(account == null ? true : account.primary); cbSynchronize.setChecked(account == null ? true : account.synchronize);
} cbPrimary.setChecked(account == null ? true : account.primary);
} else { } else {
int provider = savedInstanceState.getInt("provider"); int provider = savedInstanceState.getInt("provider");
spProvider.setTag(provider); spProvider.setTag(provider);
spProvider.setSelection(provider); spProvider.setSelection(provider);
tilPassword.getEditText().setText(savedInstanceState.getString("password")); tilPassword.getEditText().setText(savedInstanceState.getString("password"));
} }
Helper.setViewsEnabled(view, true); Helper.setViewsEnabled(view, true);
cbPrimary.setEnabled(cbSynchronize.isChecked()); cbPrimary.setEnabled(cbSynchronize.isChecked());
ibDelete.setVisibility(account == null ? View.GONE : View.VISIBLE);
btnCheck.setVisibility(cbSynchronize.isChecked() ? View.VISIBLE : View.GONE); btnCheck.setVisibility(cbSynchronize.isChecked() ? View.VISIBLE : View.GONE);
btnSave.setVisibility(cbSynchronize.isChecked() ? View.GONE : View.VISIBLE); btnSave.setVisibility(cbSynchronize.isChecked() ? View.GONE : View.VISIBLE);
// Consider previous check/save/delete as cancelled
ibDelete.setVisibility(account == null ? View.GONE : View.VISIBLE);
btnCheck.setEnabled(true); btnCheck.setEnabled(true);
pbWait.setVisibility(View.GONE); pbWait.setVisibility(View.GONE);
} }

@ -133,11 +133,6 @@ public class FragmentFolder extends FragmentEx {
return view; return view;
} }
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override @Override
public void onActivityCreated(@Nullable final Bundle savedInstanceState) { public void onActivityCreated(@Nullable final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
@ -158,14 +153,15 @@ public class FragmentFolder extends FragmentEx {
} }
if (savedInstanceState == null) { if (savedInstanceState == null) {
if (!once) { if (once)
once = true; return;
once = true;
cbSynchronize.setChecked(folder.synchronize); cbSynchronize.setChecked(folder.synchronize);
etAfter.setText(Integer.toString(folder.after)); etAfter.setText(Integer.toString(folder.after));
}
} }
// Consider previous save as cancelled
pbWait.setVisibility(View.GONE); pbWait.setVisibility(View.GONE);
Helper.setViewsEnabled(view, true); Helper.setViewsEnabled(view, true);
btnSave.setEnabled(true); btnSave.setEnabled(true);

@ -398,30 +398,31 @@ public class FragmentIdentity extends FragmentEx {
@Override @Override
public void onChanged(@Nullable final EntityIdentity identity) { public void onChanged(@Nullable final EntityIdentity identity) {
if (savedInstanceState == null) { if (savedInstanceState == null) {
if (!once) { if (once)
once = true; return;
once = true;
etName.setText(identity == null ? null : identity.name);
etEmail.setText(identity == null ? null : identity.email); etName.setText(identity == null ? null : identity.name);
etReplyTo.setText(identity == null ? null : identity.replyto); etEmail.setText(identity == null ? null : identity.email);
etHost.setText(identity == null ? null : identity.host); etReplyTo.setText(identity == null ? null : identity.replyto);
cbStartTls.setChecked(identity == null ? false : identity.starttls); etHost.setText(identity == null ? null : identity.host);
etPort.setText(identity == null ? null : Long.toString(identity.port)); cbStartTls.setChecked(identity == null ? false : identity.starttls);
etUser.setText(identity == null ? null : identity.user); etPort.setText(identity == null ? null : Long.toString(identity.port));
tilPassword.getEditText().setText(identity == null ? null : identity.password); etUser.setText(identity == null ? null : identity.user);
cbSynchronize.setChecked(identity == null ? true : identity.synchronize); tilPassword.getEditText().setText(identity == null ? null : identity.password);
cbPrimary.setChecked(identity == null ? true : identity.primary); cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
cbPrimary.setChecked(identity == null ? true : identity.primary);
etName.requestFocus();
} etName.requestFocus();
} else } else
tilPassword.getEditText().setText(savedInstanceState.getString("password")); tilPassword.getEditText().setText(savedInstanceState.getString("password"));
Helper.setViewsEnabled(view, true); Helper.setViewsEnabled(view, true);
cbPrimary.setEnabled(cbSynchronize.isChecked()); cbPrimary.setEnabled(cbSynchronize.isChecked());
ibDelete.setVisibility(identity == null ? View.GONE : View.VISIBLE);
// Consider previous save/delete as cancelled
ibDelete.setVisibility(identity == null ? View.GONE : View.VISIBLE);
btnSave.setEnabled(true); btnSave.setEnabled(true);
pbWait.setVisibility(View.GONE); pbWait.setVisibility(View.GONE);

Loading…
Cancel
Save