1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Fixed rotation problems

- Using another obscure flag
- Simplify state
This commit is contained in:
M66B 2018-08-15 16:18:14 +00:00
parent 591dfa67b3
commit 7d1bc4a7f3
3 changed files with 7 additions and 45 deletions

View file

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

View file

@ -583,23 +583,6 @@ public class FragmentAccount extends FragmentEx {
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
outState.putInt("provider", spProvider.getSelectedItemPosition()); outState.putInt("provider", spProvider.getSelectedItemPosition());
outState.putString("password", tilPassword.getEditText().getText().toString()); 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); super.onSaveInstanceState(outState);
} }
@ -631,7 +614,6 @@ public class FragmentAccount extends FragmentEx {
tilPassword.getEditText().setText(account == null ? null : account.password); tilPassword.getEditText().setText(account == null ? null : account.password);
cbSynchronize.setChecked(account == null ? true : account.synchronize); cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbPrimary.setChecked(account == null ? true : account.primary); cbPrimary.setChecked(account == null ? true : account.primary);
cbPrimary.setEnabled(account == null ? true : account.synchronize);
} else { } else {
int provider = savedInstanceState.getInt("provider"); int provider = savedInstanceState.getInt("provider");
spProvider.setTag(provider); spProvider.setTag(provider);
@ -642,6 +624,7 @@ public class FragmentAccount extends FragmentEx {
Helper.setViewsEnabled(view, true); Helper.setViewsEnabled(view, true);
cbPrimary.setEnabled(cbSynchronize.isChecked());
ibDelete.setVisibility(account == null ? View.GONE : View.VISIBLE); ibDelete.setVisibility(account == null ? View.GONE : View.VISIBLE);
btnCheck.setVisibility(cbSynchronize.isChecked() ? View.VISIBLE : View.GONE); btnCheck.setVisibility(cbSynchronize.isChecked() ? View.VISIBLE : View.GONE);
@ -649,30 +632,6 @@ public class FragmentAccount extends FragmentEx {
btnCheck.setEnabled(true); btnCheck.setEnabled(true);
pbWait.setVisibility(View.GONE); 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);
}
}
} }
}); });
} }

View file

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