Merge "Fix bug in setText" into nyc-dev
am: eff0a83a23
* commit 'eff0a83a23d1c34ea8a330e461a5660f7de1d768':
Fix bug in setText
This commit is contained in:
@@ -49,6 +49,7 @@ public class EditTextPreference extends DialogPreference {
|
|||||||
private EditText mEditText;
|
private EditText mEditText;
|
||||||
|
|
||||||
private String mText;
|
private String mText;
|
||||||
|
private boolean mTextSet;
|
||||||
|
|
||||||
public EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
@@ -85,15 +86,16 @@ public class EditTextPreference extends DialogPreference {
|
|||||||
* @param text The text to save
|
* @param text The text to save
|
||||||
*/
|
*/
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
final boolean wasBlocking = shouldDisableDependents();
|
// Always persist/notify the first time.
|
||||||
|
final boolean changed = !TextUtils.equals(mText, text);
|
||||||
mText = text;
|
if (changed || !mTextSet) {
|
||||||
|
mText = text;
|
||||||
persistString(text);
|
mTextSet = true;
|
||||||
|
persistString(text);
|
||||||
final boolean isBlocking = shouldDisableDependents();
|
if(changed) {
|
||||||
if (isBlocking != wasBlocking) {
|
notifyDependencyChange(shouldDisableDependents());
|
||||||
notifyDependencyChange(isBlocking);
|
notifyChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user