Add disabled support to TextInputLayout

Also added ColorStateList text color support to
CollapsingTextHelper.

BUG: 28636203
Change-Id: Ibe719c0cfc5b17eaed0fb1aa95fdffee74e75c36
diff --git a/api/current.txt b/api/current.txt
index f26d1a6..84cab96 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -393,6 +393,7 @@
     method public void setCollapsedTitleGravity(int);
     method public void setCollapsedTitleTextAppearance(int);
     method public void setCollapsedTitleTextColor(int);
+    method public void setCollapsedTitleTextColor(android.content.res.ColorStateList);
     method public void setCollapsedTitleTypeface(android.graphics.Typeface);
     method public void setContentScrim(android.graphics.drawable.Drawable);
     method public void setContentScrimColor(int);
@@ -405,6 +406,7 @@
     method public void setExpandedTitleMarginStart(int);
     method public void setExpandedTitleMarginTop(int);
     method public void setExpandedTitleTextAppearance(int);
+    method public void setExpandedTitleTextColor(android.content.res.ColorStateList);
     method public void setExpandedTitleTypeface(android.graphics.Typeface);
     method public void setScrimAnimationDuration(long);
     method public void setScrimVisibleHeightTrigger(int);
diff --git a/design/res/color/design_error.xml b/design/res/color/design_error.xml
new file mode 100644
index 0000000..e28602f
--- /dev/null
+++ b/design/res/color/design_error.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false" android:color="?android:attr/textColorTertiary"/>
+    <item android:color="?attr/textColorError"/>
+</selector>
\ No newline at end of file
diff --git a/design/res/values/styles.xml b/design/res/values/styles.xml
index 888ae48..c8b9cd5 100644
--- a/design/res/values/styles.xml
+++ b/design/res/values/styles.xml
@@ -77,13 +77,13 @@
     </style>
 
     <style name="TextAppearance.Design.Error" parent="TextAppearance.AppCompat.Caption">
-        <item name="android:textColor">?attr/textColorError</item>
+        <item name="android:textColor">@color/design_error</item>
     </style>
 
     <style name="TextAppearance.Design.Counter" parent="TextAppearance.AppCompat.Caption"/>
 
     <style name="TextAppearance.Design.Counter.Overflow" parent="TextAppearance.AppCompat.Caption">
-        <item name="android:textColor">?attr/textColorError</item>
+        <item name="android:textColor">@color/design_error</item>
     </style>
 
     <style name="TextAppearance.Design.Snackbar.Message" parent="android:TextAppearance">
diff --git a/design/src/android/support/design/widget/CollapsingTextHelper.java b/design/src/android/support/design/widget/CollapsingTextHelper.java
index 79ff63d..8d88bbb 100644
--- a/design/src/android/support/design/widget/CollapsingTextHelper.java
+++ b/design/src/android/support/design/widget/CollapsingTextHelper.java
@@ -16,6 +16,7 @@
 
 package android.support.design.widget;
 
+import android.content.res.ColorStateList;
 import android.content.res.TypedArray;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
@@ -25,10 +26,12 @@
 import android.graphics.RectF;
 import android.graphics.Typeface;
 import android.os.Build;
+import android.support.annotation.ColorInt;
 import android.support.design.R;
 import android.support.v4.text.TextDirectionHeuristicsCompat;
 import android.support.v4.view.GravityCompat;
 import android.support.v4.view.ViewCompat;
+import android.support.v7.widget.TintTypedArray;
 import android.text.TextPaint;
 import android.text.TextUtils;
 import android.view.Gravity;
@@ -63,8 +66,8 @@
     private int mCollapsedTextGravity = Gravity.CENTER_VERTICAL;
     private float mExpandedTextSize = 15;
     private float mCollapsedTextSize = 15;
-    private int mExpandedTextColor;
-    private int mCollapsedTextColor;
+    private ColorStateList mExpandedTextColor;
+    private ColorStateList mCollapsedTextColor;
 
     private float mExpandedDrawY;
     private float mCollapsedDrawY;
@@ -89,6 +92,8 @@
     private float mScale;
     private float mCurrentTextSize;
 
+    private int[] mState;
+
     private boolean mBoundsChanged;
 
     private final TextPaint mTextPaint;
@@ -136,14 +141,14 @@
         }
     }
 
-    void setCollapsedTextColor(int textColor) {
+    void setCollapsedTextColor(ColorStateList textColor) {
         if (mCollapsedTextColor != textColor) {
             mCollapsedTextColor = textColor;
             recalculate();
         }
     }
 
-    void setExpandedTextColor(int textColor) {
+    void setExpandedTextColor(ColorStateList textColor) {
         if (mExpandedTextColor != textColor) {
             mExpandedTextColor = textColor;
             recalculate();
@@ -194,12 +199,11 @@
     }
 
     void setCollapsedTextAppearance(int resId) {
-        TypedArray a = mView.getContext().obtainStyledAttributes(resId,
+        TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId,
                 android.support.v7.appcompat.R.styleable.TextAppearance);
         if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
-            mCollapsedTextColor = a.getColor(
-                    android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor,
-                    mCollapsedTextColor);
+            mCollapsedTextColor = a.getColorStateList(
+                    android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
         }
         if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
             mCollapsedTextSize = a.getDimensionPixelSize(
@@ -224,12 +228,11 @@
     }
 
     void setExpandedTextAppearance(int resId) {
-        TypedArray a = mView.getContext().obtainStyledAttributes(resId,
+        TintTypedArray a = TintTypedArray.obtainStyledAttributes(mView.getContext(), resId,
                 android.support.v7.appcompat.R.styleable.TextAppearance);
         if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
-            mExpandedTextColor = a.getColor(
-                    android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor,
-                    mExpandedTextColor);
+            mExpandedTextColor = a.getColorStateList(
+                    android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
         }
         if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
             mExpandedTextSize = a.getDimensionPixelSize(
@@ -310,6 +313,22 @@
         }
     }
 
+    final boolean setState(final int[] state) {
+        mState = state;
+
+        if (isStateful()) {
+            recalculate();
+            return true;
+        }
+
+        return false;
+    }
+
+    final boolean isStateful() {
+        return (mCollapsedTextColor != null && mCollapsedTextColor.isStateful())
+                || (mExpandedTextColor != null && mExpandedTextColor.isStateful());
+    }
+
     float getExpansionFraction() {
         return mExpandedFraction;
     }
@@ -339,9 +358,10 @@
         if (mCollapsedTextColor != mExpandedTextColor) {
             // If the collapsed and expanded text colors are different, blend them based on the
             // fraction
-            mTextPaint.setColor(blendColors(mExpandedTextColor, mCollapsedTextColor, fraction));
+            mTextPaint.setColor(blendColors(
+                    getCurrentExpandedTextColor(), getCurrentCollapsedTextColor(), fraction));
         } else {
-            mTextPaint.setColor(mCollapsedTextColor);
+            mTextPaint.setColor(getCurrentCollapsedTextColor());
         }
 
         mTextPaint.setShadowLayer(
@@ -353,6 +373,24 @@
         ViewCompat.postInvalidateOnAnimation(mView);
     }
 
+    @ColorInt
+    private int getCurrentExpandedTextColor() {
+        if (mState != null) {
+            return mExpandedTextColor.getColorForState(mState, 0);
+        } else {
+            return mExpandedTextColor.getDefaultColor();
+        }
+    }
+
+    @ColorInt
+    private int getCurrentCollapsedTextColor() {
+        if (mState != null) {
+            return mCollapsedTextColor.getColorForState(mState, 0);
+        } else {
+            return mCollapsedTextColor.getDefaultColor();
+        }
+    }
+
     private void calculateBaseOffsets() {
         final float currentTextSize = mCurrentTextSize;
 
@@ -644,11 +682,11 @@
         return Math.abs(value - targetValue) < 0.001f;
     }
 
-    int getExpandedTextColor() {
+    ColorStateList getExpandedTextColor() {
         return mExpandedTextColor;
     }
 
-    int getCollapsedTextColor() {
+    ColorStateList getCollapsedTextColor() {
         return mCollapsedTextColor;
     }
 
diff --git a/design/src/android/support/design/widget/CollapsingToolbarLayout.java b/design/src/android/support/design/widget/CollapsingToolbarLayout.java
index 0a2cb97..803a326 100644
--- a/design/src/android/support/design/widget/CollapsingToolbarLayout.java
+++ b/design/src/android/support/design/widget/CollapsingToolbarLayout.java
@@ -17,6 +17,7 @@
 package android.support.design.widget;
 
 import android.content.Context;
+import android.content.res.ColorStateList;
 import android.content.res.TypedArray;
 import android.graphics.Canvas;
 import android.graphics.Rect;
@@ -724,6 +725,9 @@
         if (d != null && d.isStateful()) {
             changed |= d.setState(state);
         }
+        if (mCollapsingTextHelper != null) {
+            changed |= mCollapsingTextHelper.setState(state);
+        }
 
         if (changed) {
             invalidate();
@@ -801,7 +805,16 @@
      * @param color The new text color in ARGB format
      */
     public void setCollapsedTitleTextColor(@ColorInt int color) {
-        mCollapsingTextHelper.setCollapsedTextColor(color);
+        setCollapsedTitleTextColor(ColorStateList.valueOf(color));
+    }
+
+    /**
+     * Sets the text colors of the collapsed title.
+     *
+     * @param colors ColorStateList containing the new text colors
+     */
+    public void setCollapsedTitleTextColor(@NonNull ColorStateList colors) {
+        mCollapsingTextHelper.setCollapsedTextColor(colors);
     }
 
     /**
@@ -840,7 +853,16 @@
      * @param color The new text color in ARGB format
      */
     public void setExpandedTitleColor(@ColorInt int color) {
-        mCollapsingTextHelper.setExpandedTextColor(color);
+        setExpandedTitleTextColor(ColorStateList.valueOf(color));
+    }
+
+    /**
+     * Sets the text colors of the expanded title.
+     *
+     * @param colors ColorStateList containing the new text colors
+     */
+    public void setExpandedTitleTextColor(@NonNull ColorStateList colors) {
+        mCollapsingTextHelper.setExpandedTextColor(colors);
     }
 
     /**
diff --git a/design/src/android/support/design/widget/TextInputLayout.java b/design/src/android/support/design/widget/TextInputLayout.java
index 3ed1b6e..4933859 100644
--- a/design/src/android/support/design/widget/TextInputLayout.java
+++ b/design/src/android/support/design/widget/TextInputLayout.java
@@ -34,6 +34,7 @@
 import android.support.annotation.Nullable;
 import android.support.annotation.StringRes;
 import android.support.annotation.StyleRes;
+import android.support.annotation.VisibleForTesting;
 import android.support.design.R;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.graphics.drawable.DrawableCompat;
@@ -139,12 +140,16 @@
     private ColorStateList mDefaultTextColor;
     private ColorStateList mFocusedTextColor;
 
+    // Only used for testing
+    private boolean mHintExpanded;
+
     private final CollapsingTextHelper mCollapsingTextHelper = new CollapsingTextHelper(this);
 
     private boolean mHintAnimationEnabled;
     private ValueAnimatorCompat mAnimator;
 
     private boolean mHasReconstructedEditTextBackground;
+    private boolean mInDrawableStateChanged;
 
     public TextInputLayout(Context context) {
         this(context, null);
@@ -165,12 +170,15 @@
         setAddStatesFromChildren(true);
 
         mInputFrame = new FrameLayout(context);
+        mInputFrame.setAddStatesFromChildren(true);
         addView(mInputFrame);
 
         mCollapsingTextHelper.setTextSizeInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR);
         mCollapsingTextHelper.setPositionInterpolator(new AccelerateInterpolator());
         mCollapsingTextHelper.setCollapsedTextGravity(Gravity.TOP | GravityCompat.START);
 
+        mHintExpanded = mCollapsingTextHelper.getExpansionFraction() == 1f;
+
         final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
                 R.styleable.TextInputLayout, defStyleAttr, R.style.Widget_Design_TextInputLayout);
         mHintEnabled = a.getBoolean(R.styleable.TextInputLayout_hintEnabled, true);
@@ -363,23 +371,24 @@
     }
 
     private void updateLabelState(boolean animate) {
+        final boolean isEnabled = isEnabled();
         final boolean hasText = mEditText != null && !TextUtils.isEmpty(mEditText.getText());
         final boolean isFocused = arrayContains(getDrawableState(), android.R.attr.state_focused);
         final boolean isErrorShowing = !TextUtils.isEmpty(getError());
 
         if (mDefaultTextColor != null) {
-            mCollapsingTextHelper.setExpandedTextColor(mDefaultTextColor.getDefaultColor());
+            mCollapsingTextHelper.setExpandedTextColor(mDefaultTextColor);
         }
 
-        if (mCounterOverflowed && mCounterView != null) {
-            mCollapsingTextHelper.setCollapsedTextColor(mCounterView.getCurrentTextColor());
-        } else if (isFocused && mFocusedTextColor != null) {
-            mCollapsingTextHelper.setCollapsedTextColor(mFocusedTextColor.getDefaultColor());
+        if (isEnabled && mCounterOverflowed && mCounterView != null) {
+            mCollapsingTextHelper.setCollapsedTextColor(mCounterView.getTextColors());
+        } else if (isEnabled && isFocused && mFocusedTextColor != null) {
+            mCollapsingTextHelper.setCollapsedTextColor(mFocusedTextColor);
         } else if (mDefaultTextColor != null) {
-            mCollapsingTextHelper.setCollapsedTextColor(mDefaultTextColor.getDefaultColor());
+            mCollapsingTextHelper.setCollapsedTextColor(mDefaultTextColor);
         }
 
-        if (hasText || isFocused || isErrorShowing) {
+        if (hasText || (isEnabled() && (isFocused || isErrorShowing))) {
             // We should be showing the label so do so if it isn't already
             collapseHint(animate);
         } else {
@@ -488,7 +497,7 @@
      */
     public void setHintTextAppearance(@StyleRes int resId) {
         mCollapsingTextHelper.setCollapsedTextAppearance(resId);
-        mFocusedTextColor = ColorStateList.valueOf(mCollapsingTextHelper.getCollapsedTextColor());
+        mFocusedTextColor = mCollapsingTextHelper.getCollapsedTextColor();
 
         if (mEditText != null) {
             updateLabelState(false);
@@ -595,6 +604,12 @@
      * @see #getError()
      */
     public void setError(@Nullable final CharSequence error) {
+        // Only animate if we're enabled, laid out, and we have a different error message
+        setError(error, ViewCompat.isLaidOut(this) && isEnabled()
+                && (mErrorView == null || !TextUtils.equals(mErrorView.getText(), error)));
+    }
+
+    private void setError(@Nullable final CharSequence error, final boolean animate) {
         mError = error;
 
         if (!mErrorEnabled) {
@@ -606,9 +621,6 @@
             setErrorEnabled(true);
         }
 
-        // Only animate if we've been laid out already and we have a different error
-        final boolean animate = ViewCompat.isLaidOut(this)
-                && !TextUtils.equals(mErrorView.getText(), error);
         mErrorShown = !TextUtils.isEmpty(error);
 
         // Cancel any on-going animation
@@ -659,7 +671,7 @@
         }
 
         updateEditTextBackground();
-        updateLabelState(true);
+        updateLabelState(animate);
     }
 
     /**
@@ -727,6 +739,25 @@
         }
     }
 
+    @Override
+    public void setEnabled(boolean enabled) {
+        // Since we're set to addStatesFromChildren, we need to make sure that we set all
+        // children to enabled/disabled otherwise any enabled children will wipe out our disabled
+        // drawable state
+        recursiveSetEnabled(this, enabled);
+        super.setEnabled(enabled);
+    }
+
+    private static void recursiveSetEnabled(final ViewGroup vg, final boolean enabled) {
+        for (int i = 0, count = vg.getChildCount(); i < count; i++) {
+            final View child = vg.getChildAt(i);
+            child.setEnabled(enabled);
+            if (child instanceof ViewGroup) {
+                recursiveSetEnabled((ViewGroup) child, enabled);
+            }
+        }
+    }
+
     /**
      * Returns the max length shown at the character counter.
      *
@@ -757,13 +788,17 @@
     }
 
     private void updateEditTextBackground() {
-        ensureBackgroundDrawableStateWorkaround();
+        if (mEditText == null) {
+            return;
+        }
 
         Drawable editTextBackground = mEditText.getBackground();
         if (editTextBackground == null) {
             return;
         }
 
+        ensureBackgroundDrawableStateWorkaround();
+
         if (android.support.v7.widget.DrawableUtils.canSafelyMutateDrawable(editTextBackground)) {
             editTextBackground = editTextBackground.mutate();
         }
@@ -1215,13 +1250,6 @@
         }
     }
 
-    @Override
-    public void refreshDrawableState() {
-        super.refreshDrawableState();
-        // Drawable state has changed so see if we need to update the label
-        updateLabelState(ViewCompat.isLaidOut(this));
-    }
-
     private void collapseHint(boolean animate) {
         if (mAnimator != null && mAnimator.isRunning()) {
             mAnimator.cancel();
@@ -1231,6 +1259,39 @@
         } else {
             mCollapsingTextHelper.setExpansionFraction(1f);
         }
+        mHintExpanded = false;
+    }
+
+    @Override
+    protected void drawableStateChanged() {
+        if (mInDrawableStateChanged) {
+            // Some of the calls below will update the drawable state of child views. Since we're
+            // using addStatesFromChildren we can get into infinite recursion, hence we'll just
+            // exit in this instance
+            return;
+        }
+
+        mInDrawableStateChanged = true;
+
+        super.drawableStateChanged();
+
+        final int[] state = getDrawableState();
+        boolean changed = false;
+
+        // Drawable state has changed so see if we need to update the label
+        updateLabelState(ViewCompat.isLaidOut(this) && isEnabled());
+
+        updateEditTextBackground();
+
+        if (mCollapsingTextHelper != null) {
+            changed |= mCollapsingTextHelper.setState(state);
+        }
+
+        if (changed) {
+            invalidate();
+        }
+
+        mInDrawableStateChanged = false;
     }
 
     private void expandHint(boolean animate) {
@@ -1242,6 +1303,7 @@
         } else {
             mCollapsingTextHelper.setExpansionFraction(0f);
         }
+        mHintExpanded = true;
     }
 
     private void animateToExpansionFraction(final float target) {
@@ -1263,6 +1325,11 @@
         mAnimator.start();
     }
 
+    @VisibleForTesting
+    final boolean isHintExpanded() {
+        return mHintExpanded;
+    }
+
     private class TextInputAccessibilityDelegate extends AccessibilityDelegateCompat {
         @Override
         public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
diff --git a/design/tests/src/android/support/design/testutils/TestUtilsActions.java b/design/tests/src/android/support/design/testutils/TestUtilsActions.java
index 0ad7c88..f94c253 100644
--- a/design/tests/src/android/support/design/testutils/TestUtilsActions.java
+++ b/design/tests/src/android/support/design/testutils/TestUtilsActions.java
@@ -211,4 +211,27 @@
             }
         };
     }
+
+    public static ViewAction setEnabled(final boolean enabled) {
+        return new ViewAction() {
+            @Override
+            public Matcher<View> getConstraints() {
+                return isDisplayed();
+            }
+
+            @Override
+            public String getDescription() {
+                return "set enabled";
+            }
+
+            @Override
+            public void perform(UiController uiController, View view) {
+                uiController.loopMainThreadUntilIdle();
+
+                view.setEnabled(enabled);
+
+                uiController.loopMainThreadUntilIdle();
+            }
+        };
+    }
 }
diff --git a/design/tests/src/android/support/design/widget/TextInputLayoutTest.java b/design/tests/src/android/support/design/widget/TextInputLayoutTest.java
index d5236a4..840e8d5 100755
--- a/design/tests/src/android/support/design/widget/TextInputLayoutTest.java
+++ b/design/tests/src/android/support/design/widget/TextInputLayoutTest.java
@@ -16,28 +16,35 @@
 
 package android.support.design.widget;
 
-import android.app.Activity;
-import android.support.design.test.R;
-import android.support.test.annotation.UiThreadTest;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.widget.EditText;
-
-import org.junit.Test;
-
-import static android.support.design.testutils.TestUtilsActions.setText;
+import static android.support.design.testutils.TestUtilsActions.setEnabled;
 import static android.support.design.testutils.TextInputLayoutActions.setError;
 import static android.support.design.testutils.TextInputLayoutActions.setErrorEnabled;
-import static android.support.design.testutils.TextInputLayoutActions.setPasswordVisibilityToggleEnabled;
+import static android.support.design.testutils.TextInputLayoutActions
+        .setPasswordVisibilityToggleEnabled;
 import static android.support.test.espresso.Espresso.onView;
 import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.action.ViewActions.typeText;
 import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
 import static android.support.test.espresso.assertion.ViewAssertions.matches;
 import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static android.support.test.espresso.matcher.ViewMatchers.isEnabled;
 import static android.support.test.espresso.matcher.ViewMatchers.withId;
 import static android.support.test.espresso.matcher.ViewMatchers.withText;
+
 import static org.hamcrest.Matchers.not;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.app.Activity;
+import android.support.design.test.R;
+import android.support.test.espresso.NoMatchingViewException;
+import android.support.test.espresso.ViewAssertion;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.view.View;
+import android.widget.EditText;
+
+import org.junit.Test;
 
 @SmallTest
 public class TextInputLayoutTest extends BaseInstrumentationTestCase<TextInputLayoutActivity> {
@@ -52,6 +59,14 @@
     }
 
     @Test
+    public void testTypingTextCollapsesHint() {
+        // Type some text
+        onView(withId(R.id.textinput_edittext)).perform(typeText(INPUT_TEXT));
+        // ...and check that the hint has collapsed
+        onView(withId(R.id.textinput)).check(isHintExpanded(false));
+    }
+
+    @Test
     public void testSetErrorEnablesErrorIsDisplayed() {
         onView(withId(R.id.textinput)).perform(setError(ERROR_MESSAGE_1));
         onView(withText(ERROR_MESSAGE_1)).check(matches(isDisplayed()));
@@ -83,8 +98,8 @@
 
     @Test
     public void testPasswordToggleClick() {
-        // Set some text on the EditText
-        onView(withId(R.id.textinput_edittext_pwd)).perform(setText(INPUT_TEXT));
+        // Type some text on the EditText
+        onView(withId(R.id.textinput_edittext_pwd)).perform(typeText(INPUT_TEXT));
 
         final Activity activity = mActivityTestRule.getActivity();
         final EditText textInput = (EditText) activity.findViewById(R.id.textinput_edittext_pwd);
@@ -105,7 +120,8 @@
         final EditText textInput = (EditText) activity.findViewById(R.id.textinput_edittext_pwd);
 
         // Set some text on the EditText
-        onView(withId(R.id.textinput_edittext_pwd)).perform(setText(INPUT_TEXT));
+        onView(withId(R.id.textinput_edittext_pwd))
+                .perform(typeText(INPUT_TEXT));
         // Assert that the password is disguised
         assertNotEquals(INPUT_TEXT, textInput.getLayout().getText().toString());
 
@@ -124,8 +140,8 @@
         final Activity activity = mActivityTestRule.getActivity();
         final EditText textInput = (EditText) activity.findViewById(R.id.textinput_edittext_pwd);
 
-        // Set some text on the EditText
-        onView(withId(R.id.textinput_edittext_pwd)).perform(setText(INPUT_TEXT));
+        // Type some text on the EditText
+        onView(withId(R.id.textinput_edittext_pwd)).perform(typeText(INPUT_TEXT));
         // Assert that the password is disguised
         assertNotEquals(INPUT_TEXT, textInput.getLayout().getText().toString());
 
@@ -138,4 +154,39 @@
         // Check that the password is disguised again
         assertNotEquals(INPUT_TEXT, textInput.getLayout().getText().toString());
     }
+
+    @Test
+    public void testSetEnabledFalse() {
+        // First click on the EditText, so that it is focused and the hint collapses...
+        onView(withId(R.id.textinput_edittext)).perform(click());
+
+        // Now disable the TextInputLayout and check that the hint expands
+        onView(withId(R.id.textinput))
+                .perform(setEnabled(false))
+                .check(isHintExpanded(true));
+
+        // Finally check that the EditText is no longer enabled
+        onView(withId(R.id.textinput_edittext)).check(matches(not(isEnabled())));
+    }
+
+    @Test
+    public void testSetEnabledFalseWithText() {
+        // First set some text, then disable the TextInputLayout
+        onView(withId(R.id.textinput_edittext))
+                .perform(typeText(INPUT_TEXT));
+        onView(withId(R.id.textinput)).perform(setEnabled(false));
+
+        // Now check that the EditText is no longer enabled
+        onView(withId(R.id.textinput_edittext)).check(matches(not(isEnabled())));
+    }
+
+    static ViewAssertion isHintExpanded(final boolean expanded) {
+        return new ViewAssertion() {
+            @Override
+            public void check(View view, NoMatchingViewException noViewFoundException) {
+                assertTrue(view instanceof TextInputLayout);
+                assertEquals(expanded, ((TextInputLayout) view).isHintExpanded());
+            }
+        };
+    }
 }
diff --git a/samples/SupportDesignDemos/AndroidManifest.xml b/samples/SupportDesignDemos/AndroidManifest.xml
index 07c497b..13071ea 100644
--- a/samples/SupportDesignDemos/AndroidManifest.xml
+++ b/samples/SupportDesignDemos/AndroidManifest.xml
@@ -27,7 +27,7 @@
     <application android:label="@string/activity_sample_code"
             android:supportsRtl="true"
             android:icon="@drawable/app_sample_code"
-            android:theme="@style/Theme.FAB">
+            android:theme="@style/Theme.DesignDemos">
 
         <activity android:name="SupportDesignDemos">
             <intent-filter>
@@ -39,7 +39,7 @@
 
         <activity android:name=".widget.FloatingActionButtonUsage"
                   android:label="@string/design_fab"
-                  android:theme="@style/Theme.FAB">
+                  android:theme="@style/Theme.DesignDemos.FAB">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -48,7 +48,7 @@
 
         <activity android:name=".widget.NavigationViewUsage"
                   android:label="@string/design_navigation"
-                  android:theme="@style/Theme.Navigation">
+                  android:theme="@style/Theme.DesignDemos.Navigation">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -56,8 +56,7 @@
         </activity>
 
         <activity android:name=".widget.NavigationViewWithoutDrawer"
-                  android:label="@string/design_navigation_without_drawer"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_navigation_without_drawer">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -65,8 +64,7 @@
         </activity>
 
         <activity android:name=".widget.TabLayoutUsage"
-                  android:label="@string/design_tabs_viewpager"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_tabs_viewpager">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -74,8 +72,7 @@
         </activity>
 
         <activity android:name=".widget.TabLayoutPreselectedUsage"
-                  android:label="@string/design_tabs_preselected_viewpager"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_tabs_preselected_viewpager">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -83,8 +80,7 @@
         </activity>
 
         <activity android:name=".widget.TabLayoutLayoutItemsUsage"
-                  android:label="@string/design_tabs_layout_items"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_tabs_layout_items">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -92,8 +88,7 @@
         </activity>
 
         <activity android:name=".widget.TabLayoutCustomItemsUsage"
-                  android:label="@string/design_tabs_custom_items"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_tabs_custom_items">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -101,8 +96,7 @@
         </activity>
 
         <activity android:name=".widget.TextInputLayoutUsage"
-                  android:label="@string/design_text_input"
-                  android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
+                  android:label="@string/design_text_input">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -111,7 +105,7 @@
 
         <activity android:name=".widget.SnackbarUsage"
                   android:label="@string/design_snackbar_basic"
-                  android:theme="@style/Theme.Design.Snackbar">
+                  android:theme="@style/Theme.DesignDemos.Snackbar">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -119,8 +113,7 @@
         </activity>
 
         <activity android:name=".widget.SnackbarWithFloatingActionButton"
-                  android:label="@string/design_snackbar_fab"
-                  android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
+                  android:label="@string/design_snackbar_fab">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -128,8 +121,7 @@
         </activity>
 
         <activity android:name=".widget.SnackbarWithoutCoordinatorLayout"
-                  android:label="@string/design_snackbar_without_col"
-                  android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
+                  android:label="@string/design_snackbar_without_col">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -137,8 +129,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarScrollTabsScroll"
-                  android:label="@string/design_appbar_toolbar_scroll_tabs_scroll"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_toolbar_scroll_tabs_scroll">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -146,8 +137,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarScrollTabsScrollSnap"
-                  android:label="@string/design_appbar_toolbar_scroll_tabs_scroll_snap"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_toolbar_scroll_tabs_scroll_snap">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -155,8 +145,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarScrollTabsPin"
-                  android:label="@string/design_appbar_toolbar_scroll_tabs_pin"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_toolbar_scroll_tabs_pin">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -164,8 +153,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarScrollTabsPinWithSwipeRefresh"
-                  android:label="@string/design_appbar_toolbar_scroll_tabs_pin_with_swiperefresh"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_toolbar_scroll_tabs_pin_with_swiperefresh">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -173,8 +161,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarCollapseThenPin"
-                  android:label="@string/design_appbar_collapsing_toolbar_pin"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_collapsing_toolbar_pin">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -182,8 +169,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarCollapseThenPinWithFab"
-                  android:label="@string/design_appbar_collapsing_toolbar_pin_fab"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_collapsing_toolbar_pin_fab">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -191,8 +177,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarCollapseThenPinNested"
-                  android:label="@string/design_appbar_collapsing_toolbar_pin_nested"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_collapsing_toolbar_pin_nested">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -200,8 +185,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarCollapseThenScroll"
-                  android:label="@string/design_appbar_collapsing_toolbar_scroll"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_collapsing_toolbar_scroll">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -209,8 +193,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarCollapseThenScrollWithSwipeRefresh"
-                  android:label="@string/design_appbar_collapsing_toolbar_scroll_with_swiperefresh"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_collapsing_toolbar_scroll_with_swiperefresh">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -218,8 +201,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarCollapseWithImage"
-                  android:label="@string/design_appbar_collapsing_toolbar_with_image"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_collapsing_toolbar_with_image">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -228,7 +210,7 @@
 
         <activity android:name=".widget.AppBarLayoutToolbarCollapseWithImageWithInsets"
                   android:label="@string/design_appbar_collapsing_toolbar_with_image_insets"
-                  android:theme="@style/Theme.Design.TransparentStatus">
+                  android:theme="@style/Theme.DesignDemos.TransparentStatus">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -236,8 +218,7 @@
         </activity>
 
         <activity android:name=".widget.AppBarLayoutToolbarParallaxOverlapContent"
-                  android:label="@string/design_appbar_parallax_overlap"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_appbar_parallax_overlap">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -245,8 +226,7 @@
         </activity>
 
         <activity android:name=".widget.BottomSheetPersistent"
-                  android:label="@string/design_bottomsheet_persistent"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_bottomsheet_persistent">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -254,8 +234,7 @@
         </activity>
 
         <activity android:name=".widget.BottomSheetHideable"
-                  android:label="@string/design_bottomsheet_hideable"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_bottomsheet_hideable">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -263,8 +242,7 @@
         </activity>
 
         <activity android:name=".widget.BottomSheetWithFab"
-                  android:label="@string/design_bottomsheet_with_fab"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_bottomsheet_with_fab">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -272,8 +250,7 @@
         </activity>
 
         <activity android:name=".widget.BottomSheetScrollView"
-                  android:label="@string/design_bottomsheet_scroll"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_bottomsheet_scroll">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -281,8 +258,7 @@
         </activity>
 
         <activity android:name=".widget.BottomSheetWithFragment"
-                  android:label="@string/design_bottomsheet_with_fragment"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_bottomsheet_with_fragment">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -290,8 +266,7 @@
         </activity>
 
         <activity android:name=".widget.BottomSheetDynamicContent"
-                  android:label="@string/design_bottomsheet_dynamic_content"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_bottomsheet_dynamic_content">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -300,7 +275,7 @@
 
         <activity android:name=".widget.BottomSheetModal"
                   android:label="@string/design_bottomsheet_modal"
-                  android:theme="@style/Theme.BottomSheetModal">
+                  android:theme="@style/Theme.DesignDemos.BottomSheetModal">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -309,7 +284,7 @@
 
         <activity android:name=".widget.BottomSheetModalSkipCollapsed"
                   android:label="@string/design_bottomsheet_modal_skip_collapsed"
-                  android:theme="@style/Theme.BottomSheetModalSkipCollapsed">
+                  android:theme="@style/Theme.DesignDemos.BottomSheetModal.SkipCollapsed">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
@@ -317,8 +292,7 @@
         </activity>
 
         <activity android:name=".widget.BottomNavigationViewUsage"
-                  android:label="@string/design_bottom_navigation_view"
-                  android:theme="@style/Theme.Design">
+                  android:label="@string/design_bottom_navigation_view">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.example.android.support.design.SAMPLE_CODE" />
diff --git a/samples/SupportDesignDemos/res/layout/design_text_input.xml b/samples/SupportDesignDemos/res/layout/design_text_input.xml
index 0729d28..f948576 100644
--- a/samples/SupportDesignDemos/res/layout/design_text_input.xml
+++ b/samples/SupportDesignDemos/res/layout/design_text_input.xml
@@ -55,6 +55,12 @@
                 android:onClick="clearError"
                 android:text="@string/clear_error" />
 
+            <Button
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:onClick="toggleEnabled"
+                android:text="Toggle Enabled" />
+
         </LinearLayout>
 
         <android.support.design.widget.TextInputLayout
diff --git a/samples/SupportDesignDemos/res/values-v21/styles.xml b/samples/SupportDesignDemos/res/values-v21/styles.xml
index 866837f..02cbc28 100644
--- a/samples/SupportDesignDemos/res/values-v21/styles.xml
+++ b/samples/SupportDesignDemos/res/values-v21/styles.xml
@@ -17,17 +17,17 @@
 
 <resources>
 
-    <style name="Theme.Design.TransparentStatus">
+    <style name="Theme.DesignDemos.TransparentStatus">
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:windowTranslucentNavigation">true</item>
         <item name="android:windowDrawsSystemBarBackgrounds">true</item>
     </style>
 
-    <style name="Theme.Design.Snackbar">
+    <style name="Theme.DesignDemos.Snackbar">
         <item name="android:windowTranslucentNavigation">true</item>
     </style>
 
-    <style name="Theme.Navigation" parent="Theme.Navigation.Base">
+    <style name="Theme.DesignDemos.Navigation" parent="Theme.DesignDemos.Navigation.Base">
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:windowDrawsSystemBarBackgrounds">true</item>
     </style>
diff --git a/samples/SupportDesignDemos/res/values/styles.xml b/samples/SupportDesignDemos/res/values/styles.xml
index 38afe49..177bdc4 100644
--- a/samples/SupportDesignDemos/res/values/styles.xml
+++ b/samples/SupportDesignDemos/res/values/styles.xml
@@ -17,23 +17,23 @@
 
 <resources>
 
-    <style name="Theme.Design" parent="Theme.AppCompat.Light.NoActionBar">
+    <style name="Theme.DesignDemos" parent="Theme.Design.Light">
         <item name="colorPrimary">#607D8B</item>
         <item name="colorPrimaryDark">#455A64</item>
         <item name="colorAccent">#FFAB40</item>
     </style>
 
-    <style name="Theme.Design.TransparentStatus" />
+    <style name="Theme.DesignDemos.TransparentStatus" />
 
-    <style name="Theme.Design.Snackbar" />
+    <style name="Theme.DesignDemos.Snackbar" />
 
-    <style name="Theme.FAB" parent="Theme.AppCompat.Light.NoActionBar">
+    <style name="Theme.DesignDemos.FAB">
         <item name="colorPrimary">#ff00bcd4</item>
         <item name="colorPrimaryDark">#00838f</item>
         <item name="colorAccent">#ff0000</item>
     </style>
 
-    <style name="Theme.Navigation.Base" parent="Theme.AppCompat.Light.NoActionBar">
+    <style name="Theme.DesignDemos.Navigation.Base" parent="Theme.Design">
         <item name="colorPrimary">#607D8B</item>
         <item name="colorPrimaryDark">#455A64</item>
         <item name="colorAccent">#FFAB40</item>
@@ -44,13 +44,14 @@
         <item name="spinBars">false</item>
     </style>
 
-    <style name="Theme.Navigation" parent="Theme.Navigation.Base"/>
+    <style name="Theme.DesignDemos.Navigation" parent="Theme.DesignDemos.Navigation.Base"/>
 
-    <style name="Theme.BottomSheetModal" parent="Theme.Design">
-        <item name="bottomSheetDialogTheme">@style/Theme.BottomSheetModal.BottomSheetDialog</item>
+    <style name="Theme.DesignDemos.BottomSheetModal">
+        <item name="bottomSheetDialogTheme">@style/Theme.DesignDemos.BottomSheetModal.BottomSheetDialog</item>
     </style>
 
-    <style name="Theme.BottomSheetModal.BottomSheetDialog" parent="Theme.Design.BottomSheetDialog">
+    <style name="Theme.DesignDemos.BottomSheetModal.BottomSheetDialog"
+           parent="Theme.Design.BottomSheetDialog">
         <item name="android:colorBackground">#37474F</item>
         <item name="bottomSheetStyle">@style/BottomSheetStyle</item>
     </style>
@@ -60,15 +61,15 @@
         <item name="android:layout_marginRight">@dimen/bottom_sheet_horizontal_margin</item>
     </style>
 
-    <style name="Theme.BottomSheetModalSkipCollapsed" parent="Theme.BottomSheetModal">
-        <item name="bottomSheetDialogTheme">@style/Theme.BottomSheetModal.BottomSheetDialogSkipCollapsed</item>
+    <style name="Theme.DesignDemos.BottomSheetModal.SkipCollapsed">
+        <item name="bottomSheetDialogTheme">@style/Theme.DesignDemos.BottomSheetModal.BottomSheetDialog.SkipCollapsed</item>
     </style>
 
-    <style name="Theme.BottomSheetModal.BottomSheetDialogSkipCollapsed" parent="Theme.Design.BottomSheetDialog">
-        <item name="bottomSheetStyle">@style/BottomSheetStyleSkipCollapsed</item>
+    <style name="Theme.DesignDemos.BottomSheetModal.BottomSheetDialog.SkipCollapsed">
+        <item name="bottomSheetStyle">@style/BottomSheetStyle.SkipCollapsed</item>
     </style>
 
-    <style name="BottomSheetStyleSkipCollapsed" parent="BottomSheetStyle">
+    <style name="BottomSheetStyle.SkipCollapsed">
         <item name="behavior_skipCollapsed">true</item>
     </style>
 
diff --git a/samples/SupportDesignDemos/src/com/example/android/support/design/widget/TextInputLayoutUsage.java b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/TextInputLayoutUsage.java
index a5e382d..5fb61f5 100644
--- a/samples/SupportDesignDemos/src/com/example/android/support/design/widget/TextInputLayoutUsage.java
+++ b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/TextInputLayoutUsage.java
@@ -56,4 +56,8 @@
         mPasswordInputLayout.setPasswordVisibilityToggleEnabled(false);
     }
 
+    public void toggleEnabled(View view) {
+        mUsernameInputLayout.setEnabled(!mUsernameInputLayout.isEnabled());
+    }
+
 }