Methods Summary |
---|
public android.widget.EditText | getEditText()Returns the {@link EditText} widget that will be shown in the dialog.
return mEditText;
|
public java.lang.String | getText()Gets the text from the {@link SharedPreferences}.
return mText;
|
protected void | onAddEditTextToDialogView(android.view.View dialogView, android.widget.EditText editText)Adds the EditText widget of this preference to the dialog's view.
ViewGroup container = (ViewGroup) dialogView
.findViewById(com.android.internal.R.id.edittext_container);
if (container != null) {
container.addView(editText, ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
|
protected void | onBindDialogView(android.view.View view)
super.onBindDialogView(view);
EditText editText = mEditText;
editText.setText(getText());
ViewParent oldParent = editText.getParent();
if (oldParent != view) {
if (oldParent != null) {
((ViewGroup) oldParent).removeView(editText);
}
onAddEditTextToDialogView(view, editText);
}
|
protected void | onDialogClosed(boolean positiveResult)
super.onDialogClosed(positiveResult);
if (positiveResult) {
String value = mEditText.getText().toString();
if (callChangeListener(value)) {
setText(value);
}
}
|
protected java.lang.Object | onGetDefaultValue(android.content.res.TypedArray a, int index)
return a.getString(index);
|
protected void | onRestoreInstanceState(android.os.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());
setText(myState.text);
|
protected android.os.Parcelable | onSaveInstanceState()
final Parcelable superState = super.onSaveInstanceState();
if (isPersistent()) {
// No need to save instance state since it's persistent
return superState;
}
final SavedState myState = new SavedState(superState);
myState.text = getText();
return myState;
|
protected void | onSetInitialValue(boolean restoreValue, java.lang.Object defaultValue)
setText(restoreValue ? getPersistedString(mText) : (String) defaultValue);
|
public void | setText(java.lang.String text)Saves the text to the {@link SharedPreferences}.
final boolean wasBlocking = shouldDisableDependents();
mText = text;
persistString(text);
final boolean isBlocking = shouldDisableDependents();
if (isBlocking != wasBlocking) {
notifyDependencyChange(isBlocking);
}
|
public boolean | shouldDisableDependents()
return TextUtils.isEmpty(mText) || super.shouldDisableDependents();
|