Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eff0a83a authored by Maria Garcia Puyol's avatar Maria Garcia Puyol Committed by Android (Google) Code Review
Browse files

Merge "Fix bug in setText" into nyc-dev

parents d1631dcd 3dc88c8f
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public class EditTextPreference extends DialogPreference {
    private EditText mEditText;
    
    private String mText;
    private boolean mTextSet;

    public EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
@@ -85,15 +86,16 @@ public class EditTextPreference extends DialogPreference {
     * @param text The text to save
     */
    public void setText(String text) {
        final boolean wasBlocking = shouldDisableDependents();
        
        // Always persist/notify the first time.
        final boolean changed = !TextUtils.equals(mText, text);
        if (changed || !mTextSet) {
            mText = text;
        
            mTextSet = true;
            persistString(text);
        
        final boolean isBlocking = shouldDisableDependents(); 
        if (isBlocking != wasBlocking) {
            notifyDependencyChange(isBlocking);
            if(changed) {
                notifyDependencyChange(shouldDisableDependents());
                notifyChanged();
            }
        }
    }