ProfileList: Fix state tracking

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Samuel Holland 2017-08-10 01:10:15 -05:00
parent de53a1b50a
commit 5fad89527d

View File

@ -58,8 +58,10 @@ public class ProfileListActivity extends ProfileActivity {
} }
public void onProfileSelected(String profile) { public void onProfileSelected(String profile) {
setIsEditing(false);
if (isSplitLayout) { if (isSplitLayout) {
if (isEditing())
getFragmentManager().popBackStack();
setIsEditing(false);
updateLayout(profile); updateLayout(profile);
setCurrentProfile(profile); setCurrentProfile(profile);
} else if (profile != null) { } else if (profile != null) {
@ -85,8 +87,6 @@ public class ProfileListActivity extends ProfileActivity {
public void updateLayout(String profile) { public void updateLayout(String profile) {
final Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_container); final Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_container);
if (isEditing() && profile == null)
throw new IllegalStateException();
if (isEditing()) { if (isEditing()) {
if (fragment instanceof ProfileEditFragment) { if (fragment instanceof ProfileEditFragment) {
final ProfileEditFragment editFragment = (ProfileEditFragment) fragment; final ProfileEditFragment editFragment = (ProfileEditFragment) fragment;