Constructors Summary |
---|
public EditTextPreference(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(context, attrs, defStyleAttr, defStyleRes);
mEditText = new EditText(context, attrs);
// Give it an ID so it can be saved/restored
mEditText.setId(com.android.internal.R.id.edit);
/*
* The preference framework and view framework both have an 'enabled'
* attribute. Most likely, the 'enabled' specified in this XML is for
* the preference framework, but it was also given to the view framework.
* We reset the enabled state.
*/
mEditText.setEnabled(true);
|
public EditTextPreference(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
this(context, attrs, defStyleAttr, 0);
|
public EditTextPreference(android.content.Context context, android.util.AttributeSet attrs)
this(context, attrs, com.android.internal.R.attr.editTextPreferenceStyle);
|
public EditTextPreference(android.content.Context context)
this(context, null);
|
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 boolean | needInputMethod()
// We want the input method to show, if possible, when dialog is displayed
return true;
|
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.MATCH_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();
|