remember state in key creation
This commit is contained in:
@@ -63,6 +63,7 @@ import java.util.regex.Pattern;
|
|||||||
public class CreateKeyFinalFragment extends Fragment {
|
public class CreateKeyFinalFragment extends Fragment {
|
||||||
|
|
||||||
public static final int REQUEST_EDIT_KEY = 0x00008007;
|
public static final int REQUEST_EDIT_KEY = 0x00008007;
|
||||||
|
public static final String STATE_CUSTOM_CONFIGURATION = "state_save_keyring_parcel";
|
||||||
|
|
||||||
TextView mNameEdit;
|
TextView mNameEdit;
|
||||||
TextView mEmailEdit;
|
TextView mEmailEdit;
|
||||||
@@ -72,7 +73,8 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
View mCustomKeyLayout;
|
View mCustomKeyLayout;
|
||||||
Button mCustomKeyRevertButton;
|
Button mCustomKeyRevertButton;
|
||||||
|
|
||||||
SaveKeyringParcel mSaveKeyringParcel;
|
private SaveKeyringParcel mSaveKeyringParcel;
|
||||||
|
private boolean isCustomConfiguration;
|
||||||
|
|
||||||
private CryptoOperationHelper<UploadKeyringParcel, UploadResult> mUploadOpHelper;
|
private CryptoOperationHelper<UploadKeyringParcel, UploadResult> mUploadOpHelper;
|
||||||
private CryptoOperationHelper<SaveKeyringParcel, EditKeyResult> mCreateOpHelper;
|
private CryptoOperationHelper<SaveKeyringParcel, EditKeyResult> mCreateOpHelper;
|
||||||
@@ -228,6 +230,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
public void keyConfigUseCustom(SaveKeyringParcel customKeyConfiguration) {
|
public void keyConfigUseCustom(SaveKeyringParcel customKeyConfiguration) {
|
||||||
mSaveKeyringParcel = customKeyConfiguration;
|
mSaveKeyringParcel = customKeyConfiguration;
|
||||||
mCustomKeyLayout.setVisibility(View.VISIBLE);
|
mCustomKeyLayout.setVisibility(View.VISIBLE);
|
||||||
|
isCustomConfiguration = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyConfigRevertToDefault() {
|
public void keyConfigRevertToDefault() {
|
||||||
@@ -237,6 +240,16 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
mSaveKeyringParcel = createDefaultSaveKeyringParcel((CreateKeyActivity) activity);
|
mSaveKeyringParcel = createDefaultSaveKeyringParcel((CreateKeyActivity) activity);
|
||||||
mCustomKeyLayout.setVisibility(View.GONE);
|
mCustomKeyLayout.setVisibility(View.GONE);
|
||||||
|
isCustomConfiguration = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
|
||||||
|
if (isCustomConfiguration) {
|
||||||
|
outState.putParcelable(STATE_CUSTOM_CONFIGURATION, mSaveKeyringParcel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -246,7 +259,9 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
// We have a menu item to show in action bar.
|
// We have a menu item to show in action bar.
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
if (mSaveKeyringParcel == null) {
|
if (savedInstanceState != null && savedInstanceState.containsKey(STATE_CUSTOM_CONFIGURATION)) {
|
||||||
|
keyConfigUseCustom(savedInstanceState.<SaveKeyringParcel>getParcelable(STATE_CUSTOM_CONFIGURATION));
|
||||||
|
} else {
|
||||||
keyConfigRevertToDefault();
|
keyConfigRevertToDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user