Improvements

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

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

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

@ -398,30 +398,31 @@ public class FragmentIdentity extends FragmentEx {
@Override
public void onChanged(@Nullable final EntityIdentity identity) {
if (savedInstanceState == null) {
if (!once) {
once = true;
etName.setText(identity == null ? null : identity.name);
etEmail.setText(identity == null ? null : identity.email);
etReplyTo.setText(identity == null ? null : identity.replyto);
etHost.setText(identity == null ? null : identity.host);
cbStartTls.setChecked(identity == null ? false : identity.starttls);
etPort.setText(identity == null ? null : Long.toString(identity.port));
etUser.setText(identity == null ? null : identity.user);
tilPassword.getEditText().setText(identity == null ? null : identity.password);
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
cbPrimary.setChecked(identity == null ? true : identity.primary);
etName.requestFocus();
}
if (once)
return;
once = true;
etName.setText(identity == null ? null : identity.name);
etEmail.setText(identity == null ? null : identity.email);
etReplyTo.setText(identity == null ? null : identity.replyto);
etHost.setText(identity == null ? null : identity.host);
cbStartTls.setChecked(identity == null ? false : identity.starttls);
etPort.setText(identity == null ? null : Long.toString(identity.port));
etUser.setText(identity == null ? null : identity.user);
tilPassword.getEditText().setText(identity == null ? null : identity.password);
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
cbPrimary.setChecked(identity == null ? true : identity.primary);
etName.requestFocus();
} else
tilPassword.getEditText().setText(savedInstanceState.getString("password"));
Helper.setViewsEnabled(view, true);
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);
pbWait.setVisibility(View.GONE);

Loading…
Cancel
Save