don't save state individually for OpenPgpKeyPreference
This commit is contained in:
parent
8472d64731
commit
764a98db32
1 changed files with 0 additions and 80 deletions
|
@ -23,8 +23,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.preference.Preference;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
@ -213,84 +211,6 @@ public class OpenPgpKeyPreference extends Preference implements OpenPgpApiManage
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Parcelable onSaveInstanceState() {
|
||||
/*
|
||||
* Suppose a client uses this preference type without persisting. We
|
||||
* must save the instance state so it is able to, for example, survive
|
||||
* orientation changes.
|
||||
*/
|
||||
|
||||
final Parcelable superState = super.onSaveInstanceState();
|
||||
if (isPersistent()) {
|
||||
// No need to save instance state since it's persistent
|
||||
return superState;
|
||||
}
|
||||
|
||||
// Save the instance state
|
||||
final SavedState myState = new SavedState(superState);
|
||||
myState.keyId = keyId;
|
||||
myState.defaultUserId = defaultUserId;
|
||||
return myState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Parcelable state) {
|
||||
if (!state.getClass().equals(SavedState.class)) {
|
||||
// Didn't save state for us in onSaveInstanceState
|
||||
super.onRestoreInstanceState(state);
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore the instance state
|
||||
SavedState myState = (SavedState) state;
|
||||
super.onRestoreInstanceState(myState.getSuperState());
|
||||
keyId = myState.keyId;
|
||||
defaultUserId = myState.defaultUserId;
|
||||
notifyChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* SavedState, a subclass of {@link BaseSavedState}, will store the state
|
||||
* of MyPreference, a subclass of Preference.
|
||||
* <p/>
|
||||
* It is important to always call through to super methods.
|
||||
*/
|
||||
private static class SavedState extends BaseSavedState {
|
||||
long keyId;
|
||||
String defaultUserId;
|
||||
|
||||
public SavedState(Parcel source) {
|
||||
super(source);
|
||||
|
||||
keyId = source.readLong();
|
||||
defaultUserId = source.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
|
||||
dest.writeLong(keyId);
|
||||
dest.writeString(defaultUserId);
|
||||
}
|
||||
|
||||
public SavedState(Parcelable superState) {
|
||||
super(superState);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR =
|
||||
new Parcelable.Creator<SavedState>() {
|
||||
public SavedState createFromParcel(Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
|
||||
public SavedState[] newArray(int size) {
|
||||
return new SavedState[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public boolean handleOnActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_API_MANAGER:
|
||||
|
|
Loading…
Reference in a new issue