am 60d880cf: Remove unnecessary code of CustomInputStylePreference

* commit '60d880cf5e08553257212aaf63b51b4ce7efb2ef':
  Remove unnecessary code of CustomInputStylePreference
main
Tadashi G. Takaoka 2014-11-28 02:44:07 +00:00 committed by Android Git Automerger
commit f463ffd3c2
1 changed files with 0 additions and 20 deletions

View File

@ -196,16 +196,6 @@ final class CustomInputStylePreference extends DialogPreference
} }
} }
private static int getSpinnerPosition(final Spinner spinner) {
if (spinner == null) return -1;
return spinner.getSelectedItemPosition();
}
private static void setSpinnerPosition(final Spinner spinner, final int position) {
if (spinner == null || position < 0) return;
spinner.setSelection(position);
}
@Override @Override
protected Parcelable onSaveInstanceState() { protected Parcelable onSaveInstanceState() {
final Parcelable superState = super.onSaveInstanceState(); final Parcelable superState = super.onSaveInstanceState();
@ -216,8 +206,6 @@ final class CustomInputStylePreference extends DialogPreference
final SavedState myState = new SavedState(superState); final SavedState myState = new SavedState(superState);
myState.mSubtype = mSubtype; myState.mSubtype = mSubtype;
myState.mSubtypeLocaleSelectedPos = getSpinnerPosition(mSubtypeLocaleSpinner);
myState.mKeyboardLayoutSetSelectedPos = getSpinnerPosition(mKeyboardLayoutSetSpinner);
return myState; return myState;
} }
@ -230,15 +218,11 @@ final class CustomInputStylePreference extends DialogPreference
final SavedState myState = (SavedState) state; final SavedState myState = (SavedState) state;
super.onRestoreInstanceState(myState.getSuperState()); super.onRestoreInstanceState(myState.getSuperState());
setSpinnerPosition(mSubtypeLocaleSpinner, myState.mSubtypeLocaleSelectedPos);
setSpinnerPosition(mKeyboardLayoutSetSpinner, myState.mKeyboardLayoutSetSelectedPos);
setSubtype(myState.mSubtype); setSubtype(myState.mSubtype);
} }
static final class SavedState extends Preference.BaseSavedState { static final class SavedState extends Preference.BaseSavedState {
InputMethodSubtype mSubtype; InputMethodSubtype mSubtype;
int mSubtypeLocaleSelectedPos;
int mKeyboardLayoutSetSelectedPos;
public SavedState(final Parcelable superState) { public SavedState(final Parcelable superState) {
super(superState); super(superState);
@ -247,15 +231,11 @@ final class CustomInputStylePreference extends DialogPreference
@Override @Override
public void writeToParcel(final Parcel dest, final int flags) { public void writeToParcel(final Parcel dest, final int flags) {
super.writeToParcel(dest, flags); super.writeToParcel(dest, flags);
dest.writeInt(mSubtypeLocaleSelectedPos);
dest.writeInt(mKeyboardLayoutSetSelectedPos);
dest.writeParcelable(mSubtype, 0); dest.writeParcelable(mSubtype, 0);
} }
public SavedState(final Parcel source) { public SavedState(final Parcel source) {
super(source); super(source);
mSubtypeLocaleSelectedPos = source.readInt();
mKeyboardLayoutSetSelectedPos = source.readInt();
mSubtype = (InputMethodSubtype)source.readParcelable(null); mSubtype = (InputMethodSubtype)source.readParcelable(null);
} }