Browse Source

Fixed rotation problems

- Using another obscure flag
- Simplify state
main
M66B 6 years ago
parent
commit
7d1bc4a7f3
3 changed files with 7 additions and 45 deletions
  1. +4
    -2
      app/src/main/AndroidManifest.xml
  2. +1
    -42
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  3. +2
    -1
      app/src/main/java/eu/faircode/email/FragmentIdentity.java

+ 4
- 2
app/src/main/AndroidManifest.xml View File

@ -40,13 +40,15 @@
android:name=".ActivitySetup"
android:exported="false"
android:launchMode="singleInstance"
android:parentActivityName=".ActivityMain" />
android:parentActivityName=".ActivityMain"
android:windowSoftInputMode="stateUnchanged" />
<activity
android:name=".ActivityView"
android:exported="false"
android:launchMode="singleTop"
android:parentActivityName=".ActivityMain" />
android:parentActivityName=".ActivityMain"
android:windowSoftInputMode="stateUnchanged" />
<activity
android:name=".ActivityCompose"


+ 1
- 42
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -583,23 +583,6 @@ public class FragmentAccount extends FragmentEx {
public void onSaveInstanceState(Bundle outState) {
outState.putInt("provider", spProvider.getSelectedItemPosition());
outState.putString("password", tilPassword.getEditText().getText().toString());
boolean checked = (btnSave.getVisibility() == View.VISIBLE);
outState.putBoolean("checked", checked);
if (checked) {
ArrayList<EntityFolder> folders = new ArrayList<>();
for (int i = 0; i < spDrafts.getAdapter().getCount(); i++)
folders.add((EntityFolder) spDrafts.getAdapter().getItem(i));
outState.putParcelableArrayList("folders", folders);
outState.putInt("drafts", spDrafts.getSelectedItemPosition());
outState.putInt("sent", spSent.getSelectedItemPosition());
outState.putInt("all", spAll.getSelectedItemPosition());
outState.putInt("trash", spTrash.getSelectedItemPosition());
outState.putInt("junk", spJunk.getSelectedItemPosition());
}
super.onSaveInstanceState(outState);
}
@ -631,7 +614,6 @@ public class FragmentAccount extends FragmentEx {
tilPassword.getEditText().setText(account == null ? null : account.password);
cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbPrimary.setChecked(account == null ? true : account.primary);
cbPrimary.setEnabled(account == null ? true : account.synchronize);
} else {
int provider = savedInstanceState.getInt("provider");
spProvider.setTag(provider);
@ -642,6 +624,7 @@ public class FragmentAccount extends FragmentEx {
Helper.setViewsEnabled(view, true);
cbPrimary.setEnabled(cbSynchronize.isChecked());
ibDelete.setVisibility(account == null ? View.GONE : View.VISIBLE);
btnCheck.setVisibility(cbSynchronize.isChecked() ? View.VISIBLE : View.GONE);
@ -649,30 +632,6 @@ public class FragmentAccount extends FragmentEx {
btnCheck.setEnabled(true);
pbWait.setVisibility(View.GONE);
if (savedInstanceState != null) {
boolean checked = savedInstanceState.getBoolean("checked");
if (checked) {
List<EntityFolder> folders = savedInstanceState.getParcelableArrayList("folders");
ArrayAdapter<EntityFolder> adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item, folders);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spDrafts.setAdapter(adapter);
spSent.setAdapter(adapter);
spAll.setAdapter(adapter);
spTrash.setAdapter(adapter);
spJunk.setAdapter(adapter);
spDrafts.setSelection(savedInstanceState.getInt("drafts"));
spSent.setSelection(savedInstanceState.getInt("sent"));
spAll.setSelection(savedInstanceState.getInt("all"));
spTrash.setSelection(savedInstanceState.getInt("trash"));
spJunk.setSelection(savedInstanceState.getInt("junk"));
grpFolders.setVisibility(View.VISIBLE);
btnSave.setVisibility(View.VISIBLE);
}
}
}
});
}


+ 2
- 1
app/src/main/java/eu/faircode/email/FragmentIdentity.java View File

@ -411,10 +411,11 @@ public class FragmentIdentity extends FragmentEx {
} else
tilPassword.getEditText().setText(savedInstanceState.getString("password"));
Helper.setViewsEnabled(view, true);
cbPrimary.setEnabled(cbSynchronize.isChecked());
ibDelete.setVisibility(identity == null ? View.GONE : View.VISIBLE);
Helper.setViewsEnabled(view, true);
btnSave.setEnabled(true);
pbWait.setVisibility(View.GONE);


Loading…
Cancel
Save