@Override protected void onRestoreInstanceState(Parcelable state) { if (state == null || !(state instanceof SavedState)) { super.onRestoreInstanceState(state); return; } SavedState ss = (SavedState) state; super.onRestoreInstanceState(ss.getSuperState()); setValue(ss.mValue); setMaxValue(ss.mMaxValue); }
@Override protected void onRestoreInstanceState(Parcelable state) { if (state == null || !state.getClass().equals(SavedState.class)) { // Didn't save state for us in onSaveInstanceState super.onRestoreInstanceState(state); return; } SavedState myState = (SavedState) state; super.onRestoreInstanceState(myState.getSuperState()); setValue(myState.value); }
/** * Sets the summary for this Preference with a CharSequence. If the summary has a {@linkplain * java.lang.String#format String formatting} marker in it (i.e. "%s" or "%1$s"), then the current * entry value will be substituted in its place when it's retrieved. * * @param summary The summary for the preference. */ @Override public void setSummary(CharSequence summary) { super.setSummary(summary); if (summary == null && mSummary != null) { mSummary = null; } else if (summary != null && !summary.equals(mSummary)) { mSummary = summary.toString(); } }
@Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); final int value; synchronized (mSeekBar) { value = mSeekBar.getProgress(); } if (positiveResult && callChangeListener(value)) { setValue(value); } }
@Override protected void onBindDialogView(View view) { super.onBindDialogView(view); synchronized (mSeekBar) { ViewParent oldParent = mSeekBar.getParent(); if (oldParent != view) { if (oldParent != null) { ((ViewGroup) oldParent).removeView(mSeekBar); } ((ViewGroup) view).addView(mSeekBar); } } }
/* * (non-Javadoc) * * @see android.preference.Preference#setDefaultValue(java.lang.Object) */ @Override public void setDefaultValue(Object defaultValue) { // BUG this method is never called if you use the 'android:defaultValue' attribute in your XML // preference file, // not sure why it isn't super.setDefaultValue(defaultValue); if (!(defaultValue instanceof String)) { return; } if (!((String) defaultValue).matches(VALIDATION_EXPRESSION)) { return; } this.defaultValue = (String) defaultValue; }
@Override protected void onBindView(View view) { super.onBindView(view); mColorIndicator.setColor(mValue); }
@Override protected void onBindDialogView(View view) { super.onBindDialogView(view); mColorPickerView.setOldCenterColor(mValue); mColorPickerView.setColor(mValue); }
@Override public void onDismiss(DialogInterface dialog) { mDatePickerDialog = null; super.onDismiss(dialog); }
// For saving keyboard changes @Override public void onClick(DialogInterface dialog, int which) { super.getDialog().getCurrentFocus().clearFocus(); super.onClick(dialog, which); }