From 7d1bc4a7f38956101659f28e30adc282a58bd00d Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 15 Aug 2018 16:18:14 +0000 Subject: [PATCH] Fixed rotation problems - Using another obscure flag - Simplify state --- app/src/main/AndroidManifest.xml | 6 ++- .../eu/faircode/email/FragmentAccount.java | 43 +------------------ .../eu/faircode/email/FragmentIdentity.java | 3 +- 3 files changed, 7 insertions(+), 45 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c1f4499e..11d42aca 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,13 +40,15 @@ android:name=".ActivitySetup" android:exported="false" android:launchMode="singleInstance" - android:parentActivityName=".ActivityMain" /> + android:parentActivityName=".ActivityMain" + android:windowSoftInputMode="stateUnchanged" /> + android:parentActivityName=".ActivityMain" + android:windowSoftInputMode="stateUnchanged" /> 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 folders = savedInstanceState.getParcelableArrayList("folders"); - - ArrayAdapter 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); - } - } } }); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 1e9705a1..468d7374 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -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);