From 08c40d85e5710bc1cd208d7cea2d8268d98c42e6 Mon Sep 17 00:00:00 2001 From: leticiars Date: Mon, 29 Aug 2022 18:13:44 -0400 Subject: [PATCH] [TextInputLayout] Added method to set corner family programmatically and a setShapeAppearanceModel method for greater customizability of the box background shape. Resolves https://github.com/material-components/material-components-android/issues/1957 PiperOrigin-RevId: 470826160 --- .../material/textfield/TextInputLayout.java | 74 +++++- .../testutils/TextInputLayoutActions.java | 46 ++++ .../textfield/TextInputLayoutTest.java | 217 ++++++++++++++++-- 3 files changed, 313 insertions(+), 24 deletions(-) diff --git a/lib/java/com/google/android/material/textfield/TextInputLayout.java b/lib/java/com/google/android/material/textfield/TextInputLayout.java index 381ede2c26c..765df4ecc9c 100644 --- a/lib/java/com/google/android/material/textfield/TextInputLayout.java +++ b/lib/java/com/google/android/material/textfield/TextInputLayout.java @@ -98,6 +98,8 @@ import com.google.android.material.internal.ViewUtils; import com.google.android.material.motion.MotionUtils; import com.google.android.material.resources.MaterialResources; +import com.google.android.material.shape.CornerFamily; +import com.google.android.material.shape.CornerTreatment; import com.google.android.material.shape.MaterialShapeDrawable; import com.google.android.material.shape.ShapeAppearanceModel; import java.lang.annotation.Retention; @@ -1220,6 +1222,46 @@ public int getBoxBackgroundColor() { return boxBackgroundColor; } + /** + * Sets the {@link ShapeAppearanceModel} of the text field's box background. + * + * @param shapeAppearanceModel the desired shape appearance model. + * @see #getShapeAppearanceModel() + */ + public void setShapeAppearanceModel(@NonNull ShapeAppearanceModel shapeAppearanceModel) { + if (boxBackground != null && boxBackground.getShapeAppearanceModel() != shapeAppearanceModel) { + this.shapeAppearanceModel = shapeAppearanceModel; + applyBoxAttributes(); + } + } + + /** + * Returns the {@link ShapeAppearanceModel} of the text field's box background. + * + * @see #setShapeAppearanceModel(ShapeAppearanceModel) + */ + @NonNull + public ShapeAppearanceModel getShapeAppearanceModel() { + return shapeAppearanceModel; + } + + /** + * Sets the box's corner family for all corners of the text field. + * + * @param cornerFamily the {@link CornerFamily} to be used. May be one of {@link + * CornerFamily#ROUNDED} or {@link CornerFamily#CUT}. + */ + public void setBoxCornerFamily(@CornerFamily int cornerFamily) { + shapeAppearanceModel = + shapeAppearanceModel.toBuilder() + .setTopLeftCorner(cornerFamily, shapeAppearanceModel.getTopLeftCornerSize()) + .setTopRightCorner(cornerFamily, shapeAppearanceModel.getTopRightCornerSize()) + .setBottomLeftCorner(cornerFamily, shapeAppearanceModel.getBottomLeftCornerSize()) + .setBottomRightCorner(cornerFamily, shapeAppearanceModel.getBottomRightCornerSize()) + .build(); + applyBoxAttributes(); + } + /** * Set the resources used for the box's corner radii. * @@ -3040,9 +3082,8 @@ public void setExpandedHintEnabled(boolean enabled) { public void onRtlPropertiesChanged(int layoutDirection) { super.onRtlPropertiesChanged(layoutDirection); boolean isLayoutDirectionRtl = layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL; - if (isLayoutDirectionRtl != areCornerRadiiRtl) { + if (isLayoutDirectionRtl != areCornerRadiiRtl) { // Switch corner radius values from LTR to RTL or vice versa. - boolean shouldCornersBeRtl = isLayoutDirectionRtl && !areCornerRadiiRtl; float boxCornerRadiusTopLeft = shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(tmpRectF); float boxCornerRadiusTopRight = @@ -3051,12 +3092,29 @@ public void onRtlPropertiesChanged(int layoutDirection) { shapeAppearanceModel.getBottomLeftCornerSize().getCornerSize(tmpRectF); float boxCornerRadiusBottomRight = shapeAppearanceModel.getBottomRightCornerSize().getCornerSize(tmpRectF); - setBoxCornerRadii( - shouldCornersBeRtl ? boxCornerRadiusTopLeft : boxCornerRadiusTopRight, - shouldCornersBeRtl ? boxCornerRadiusTopRight : boxCornerRadiusTopLeft, - shouldCornersBeRtl ? boxCornerRadiusBottomLeft : boxCornerRadiusBottomRight, - shouldCornersBeRtl ? boxCornerRadiusBottomRight : boxCornerRadiusBottomLeft); - } + CornerTreatment topLeftTreatment = + shapeAppearanceModel.getTopLeftCorner(); + CornerTreatment topRightTreatment = + shapeAppearanceModel.getTopRightCorner(); + CornerTreatment bottomLeftTreatment = + shapeAppearanceModel.getBottomLeftCorner(); + CornerTreatment bottomRightTreatment = + shapeAppearanceModel.getBottomRightCorner(); + + ShapeAppearanceModel newShapeAppearanceModel = + ShapeAppearanceModel.builder() + .setTopLeftCorner(topRightTreatment) + .setTopRightCorner(topLeftTreatment) + .setBottomLeftCorner(bottomRightTreatment) + .setBottomRightCorner(bottomLeftTreatment) + .setTopLeftCornerSize(boxCornerRadiusTopRight) + .setTopRightCornerSize(boxCornerRadiusTopLeft) + .setBottomLeftCornerSize(boxCornerRadiusBottomRight) + .setBottomRightCornerSize(boxCornerRadiusBottomLeft) + .build(); + areCornerRadiiRtl = isLayoutDirectionRtl; + setShapeAppearanceModel(newShapeAppearanceModel); + } } @Override diff --git a/tests/javatests/com/google/android/material/testutils/TextInputLayoutActions.java b/tests/javatests/com/google/android/material/testutils/TextInputLayoutActions.java index 61d5c55bfd0..e98a3a4521c 100644 --- a/tests/javatests/com/google/android/material/testutils/TextInputLayoutActions.java +++ b/tests/javatests/com/google/android/material/testutils/TextInputLayoutActions.java @@ -31,10 +31,13 @@ import android.widget.AutoCompleteTextView; import androidx.annotation.ColorInt; import androidx.annotation.DimenRes; +import androidx.annotation.NonNull; import androidx.test.espresso.UiController; import androidx.test.espresso.ViewAction; import androidx.test.espresso.matcher.ViewMatchers; import com.google.android.material.internal.CheckableImageButton; +import com.google.android.material.shape.CornerFamily; +import com.google.android.material.shape.ShapeAppearanceModel; import com.google.android.material.testapp.R; import com.google.android.material.textfield.TextInputLayout; import org.hamcrest.Matcher; @@ -639,6 +642,49 @@ public void perform(UiController uiController, View view) { }; } + /** Sets the {@link ShapeAppearanceModel} of the text field's box background. */ + public static ViewAction setShapeAppearanceModel( + @NonNull ShapeAppearanceModel shapeAppearanceModel) { + return new ViewAction() { + @Override + public Matcher getConstraints() { + return isAssignableFrom(TextInputLayout.class); + } + + @Override + public String getDescription() { + return "Sets the box's shape appearance"; + } + + @Override + public void perform(UiController uiController, View view) { + TextInputLayout layout = (TextInputLayout) view; + layout.setShapeAppearanceModel(shapeAppearanceModel); + } + }; + } + + /** Sets the corner family for all corners of the text field. */ + public static ViewAction setBoxCornerFamily(@CornerFamily final int cornerFamily) { + return new ViewAction() { + @Override + public Matcher getConstraints() { + return isAssignableFrom(TextInputLayout.class); + } + + @Override + public String getDescription() { + return "Sets the box's corner family"; + } + + @Override + public void perform(UiController uiController, View view) { + TextInputLayout layout = (TextInputLayout) view; + layout.setBoxCornerFamily(cornerFamily); + } + }; + } + public static ViewAction setBoxCornerRadii( final float topLeftCornerRadius, final float topRightCornerRadius, diff --git a/tests/javatests/com/google/android/material/textfield/TextInputLayoutTest.java b/tests/javatests/com/google/android/material/textfield/TextInputLayoutTest.java index f098210c208..970892032bf 100644 --- a/tests/javatests/com/google/android/material/textfield/TextInputLayoutTest.java +++ b/tests/javatests/com/google/android/material/textfield/TextInputLayoutTest.java @@ -31,6 +31,7 @@ import static com.google.android.material.testutils.TestUtilsMatchers.withTextColor; import static com.google.android.material.testutils.TestUtilsMatchers.withTypeface; import static com.google.android.material.testutils.TextInputLayoutActions.setBoxBackgroundColor; +import static com.google.android.material.testutils.TextInputLayoutActions.setBoxCornerFamily; import static com.google.android.material.testutils.TextInputLayoutActions.setBoxCornerRadii; import static com.google.android.material.testutils.TextInputLayoutActions.setBoxStrokeColor; import static com.google.android.material.testutils.TextInputLayoutActions.setBoxStrokeErrorColor; @@ -48,6 +49,7 @@ import static com.google.android.material.testutils.TextInputLayoutActions.setHint; import static com.google.android.material.testutils.TextInputLayoutActions.setHintTextAppearance; import static com.google.android.material.testutils.TextInputLayoutActions.setPlaceholderText; +import static com.google.android.material.testutils.TextInputLayoutActions.setShapeAppearanceModel; import static com.google.android.material.testutils.TextInputLayoutActions.setTypeface; import static com.google.common.truth.Truth.assertThat; import static org.hamcrest.Matchers.not; @@ -72,6 +74,7 @@ import android.widget.EditText; import android.widget.TextView; import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; import androidx.core.view.ViewCompat; import androidx.core.widget.TextViewCompat; import androidx.test.annotation.UiThreadTest; @@ -80,6 +83,11 @@ import androidx.test.filters.SdkSuppress; import androidx.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4; +import com.google.android.material.shape.CornerFamily; +import com.google.android.material.shape.CornerTreatment; +import com.google.android.material.shape.CutCornerTreatment; +import com.google.android.material.shape.RoundedCornerTreatment; +import com.google.android.material.shape.ShapeAppearanceModel; import com.google.android.material.testapp.R; import com.google.android.material.testapp.TextInputLayoutActivity; import com.google.android.material.testutils.TestUtils; @@ -485,8 +493,7 @@ public void testSetErrorContentDescription() { .perform(setErrorContentDescription(errorContentDesc)); final Activity activity = activityTestRule.getActivity(); - final TextInputLayout textInputLayout = - activity.findViewById(R.id.textinput); + final TextInputLayout textInputLayout = activity.findViewById(R.id.textinput); // Assert the error content description is as expected. assertEquals(errorContentDesc, textInputLayout.getErrorContentDescription().toString()); @@ -660,6 +667,119 @@ public void testFilledBoxBackgroundChangesColor() { onView(withId(R.id.textinput_box_filled)).check(isBoxBackgroundColor(yellow)); } + @Test + public void testSetBoxCornerFamily() { + onView(withId(R.id.textinput_box_outline)).perform(setBoxCornerFamily(CornerFamily.CUT)); + + onView(withId(R.id.textinput_box_outline)).check(isCornerFamily(CutCornerTreatment.class)); + } + + @Test + public void testSetShapeAppearanceModel() { + float cornerRadius = 30; + ShapeAppearanceModel shapeAppearanceModel = + ShapeAppearanceModel.builder() + .setTopLeftCorner(CornerFamily.CUT, cornerRadius) + .setBottomRightCorner(CornerFamily.CUT, cornerRadius) + .build(); + + onView(withId(R.id.textinput_box_outline)) + .perform(setShapeAppearanceModel(shapeAppearanceModel)); + + // Assert the new shape appearance model set. + onView(withId(R.id.textinput_box_outline)).check(isShapeAppearanceModel(shapeAppearanceModel)); + // Assert corner radii values. + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopStart(cornerRadius)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopEnd(0)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomStart(0)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomEnd(cornerRadius)); + // Assert corner family values. + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyTopLeft(CutCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyTopRight(RoundedCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyBottomLeft(RoundedCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyBottomRight(CutCornerTreatment.class)); + } + + @Test + public void testSetShapeAppearanceModelSwitchFromLtrToRtl() { + float cornerRadius = 30; + final Activity activity = activityTestRule.getActivity(); + final TextInputLayout textInputLayout = activity.findViewById(R.id.textinput_box_outline); + ShapeAppearanceModel shapeAppearanceModel = + ShapeAppearanceModel.builder() + .setTopLeftCorner(CornerFamily.CUT, cornerRadius) + .setBottomRightCorner(CornerFamily.CUT, cornerRadius) + .build(); + + // Set the shape appearance model. + onView(withId(R.id.textinput_box_outline)) + .perform(setShapeAppearanceModel(shapeAppearanceModel)); + // Set to RTL. + onView(withId(R.id.textinput_box_outline)) + .perform(setLayoutDirection(ViewCompat.LAYOUT_DIRECTION_RTL)); + + if (ViewCompat.getLayoutDirection(textInputLayout) == ViewCompat.LAYOUT_DIRECTION_RTL) { + // Asserts corner radii values are RTL. + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopLeft(0)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopRight(cornerRadius)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomLeft(cornerRadius)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomRight(0)); + // Assert corner family values are RTL. + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyTopLeft(RoundedCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyTopRight(CutCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyBottomLeft(CutCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyBottomRight(RoundedCornerTreatment.class)); + } + } + + @Test + public void testSetShapeAppearanceModelSwitchFromRtlToLtr() { + float cornerRadius = 30; + final Activity activity = activityTestRule.getActivity(); + final TextInputLayout textInputLayout = activity.findViewById(R.id.textinput_box_outline); + ShapeAppearanceModel shapeAppearanceModel = + ShapeAppearanceModel.builder() + .setTopLeftCorner(CornerFamily.CUT, cornerRadius) + .setBottomRightCorner(CornerFamily.CUT, cornerRadius) + .build(); + + // Set the shape appearance model. + onView(withId(R.id.textinput_box_outline)) + .perform(setShapeAppearanceModel(shapeAppearanceModel)); + // Set to RTL. + onView(withId(R.id.textinput_box_outline)) + .perform(setLayoutDirection(ViewCompat.LAYOUT_DIRECTION_RTL)); + + if (ViewCompat.getLayoutDirection(textInputLayout) == ViewCompat.LAYOUT_DIRECTION_RTL) { + // Set back to LTR. + onView(withId(R.id.textinput_box_outline)) + .perform(setLayoutDirection(ViewCompat.LAYOUT_DIRECTION_LTR)); + + // Asserts corner radii values are LTR. + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopLeft(cornerRadius)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopRight(0)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomLeft(0)); + onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomRight(cornerRadius)); + // Assert corner family values are LTR. + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyTopLeft(CutCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyTopRight(RoundedCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyBottomLeft(RoundedCornerTreatment.class)); + onView(withId(R.id.textinput_box_outline)) + .check(isCornerFamilyBottomRight(CutCornerTreatment.class)); + } + } + @Test public void testSetBoxCornerRadii() { float boxCornerRadiusTopStart = 0.5f; @@ -677,10 +797,14 @@ public void testSetBoxCornerRadii() { boxCornerRadiusBottomEnd)); // Assert values match each respective corner. - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopStart(boxCornerRadiusTopStart)); - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopEnd(boxCornerRadiusTopEnd)); - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomStart(boxCornerRadiusBottomStart)); - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomEnd(boxCornerRadiusBottomEnd)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusTopStart(boxCornerRadiusTopStart)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusTopEnd(boxCornerRadiusTopEnd)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusBottomStart(boxCornerRadiusBottomStart)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusBottomEnd(boxCornerRadiusBottomEnd)); } @Test @@ -690,8 +814,7 @@ public void testSetBoxCornerRadiiInRtl() { float boxCornerRadiusBottomStart = 1.5f; float boxCornerRadiusBottomEnd = 2f; final Activity activity = activityTestRule.getActivity(); - final TextInputLayout textInputLayout = - activity.findViewById(R.id.textinput_box_outline); + final TextInputLayout textInputLayout = activity.findViewById(R.id.textinput_box_outline); // Set to RTL. onView(withId(R.id.textinput_box_outline)) @@ -717,10 +840,14 @@ public void testSetBoxCornerRadiiInRtl() { onView(withId(R.id.textinput_box_outline)) .check(isBoxCornerRadiusBottomRight(boxCornerRadiusBottomStart)); // Assert getCornerRadius methods return correct values. - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopStart(boxCornerRadiusTopStart)); - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusTopEnd(boxCornerRadiusTopEnd)); - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomStart(boxCornerRadiusBottomStart)); - onView(withId(R.id.textinput_box_outline)).check(isBoxCornerRadiusBottomEnd(boxCornerRadiusBottomEnd)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusTopStart(boxCornerRadiusTopStart)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusTopEnd(boxCornerRadiusTopEnd)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusBottomStart(boxCornerRadiusBottomStart)); + onView(withId(R.id.textinput_box_outline)) + .check(isBoxCornerRadiusBottomEnd(boxCornerRadiusBottomEnd)); } } @@ -731,8 +858,7 @@ public void testSetBoxCornerRadiiSwitchFromLtrToRtl() { float boxCornerRadiusBottomStart = 1.5f; float boxCornerRadiusBottomEnd = 2f; final Activity activity = activityTestRule.getActivity(); - final TextInputLayout textInputLayout = - activity.findViewById(R.id.textinput_box_outline); + final TextInputLayout textInputLayout = activity.findViewById(R.id.textinput_box_outline); // Set the outline box's corner radii. onView(withId(R.id.textinput_box_outline)) @@ -766,8 +892,7 @@ public void testSetBoxCornerRadiiSwitchFromRtlToLtr() { float boxCornerRadiusBottomStart = 1.5f; float boxCornerRadiusBottomEnd = 2f; final Activity activity = activityTestRule.getActivity(); - final TextInputLayout textInputLayout = - activity.findViewById(R.id.textinput_box_outline); + final TextInputLayout textInputLayout = activity.findViewById(R.id.textinput_box_outline); // Set to RTL. onView(withId(R.id.textinput_box_outline)) .perform(setLayoutDirection(ViewCompat.LAYOUT_DIRECTION_RTL)); @@ -911,6 +1036,66 @@ private static ViewAssertion isBoxBackgroundColor(@ColorInt final int boxBackgro }; } + private static ViewAssertion isShapeAppearanceModel( + @NonNull ShapeAppearanceModel shapeAppearanceModelt) { + return (view, noViewFoundException) -> { + assertThat(view).isInstanceOf(TextInputLayout.class); + assertEquals(shapeAppearanceModelt, ((TextInputLayout) view).getShapeAppearanceModel()); + }; + } + + private static ViewAssertion isCornerFamily(Class cornerFamily) { + return (view, noViewFoundException) -> { + assertThat(view).isInstanceOf(TextInputLayout.class); + ShapeAppearanceModel shapeAppearanceModel = + ((TextInputLayout) view).getShapeAppearanceModel(); + assertThat(shapeAppearanceModel.getTopLeftCorner()).isInstanceOf(cornerFamily); + assertThat(shapeAppearanceModel.getTopRightCorner()).isInstanceOf(cornerFamily); + assertThat(shapeAppearanceModel.getBottomRightCorner()).isInstanceOf(cornerFamily); + assertThat(shapeAppearanceModel.getBottomLeftCorner()).isInstanceOf(cornerFamily); + }; + } + + private static ViewAssertion isCornerFamilyTopLeft( + Class cornerFamily) { + return (view, noViewFoundException) -> { + assertThat(view).isInstanceOf(TextInputLayout.class); + ShapeAppearanceModel shapeAppearanceModel = + ((TextInputLayout) view).getShapeAppearanceModel(); + assertThat(shapeAppearanceModel.getTopLeftCorner()).isInstanceOf(cornerFamily); + }; + } + + private static ViewAssertion isCornerFamilyTopRight( + Class cornerFamily) { + return (view, noViewFoundException) -> { + assertThat(view).isInstanceOf(TextInputLayout.class); + ShapeAppearanceModel shapeAppearanceModel = + ((TextInputLayout) view).getShapeAppearanceModel(); + assertThat(shapeAppearanceModel.getTopRightCorner()).isInstanceOf(cornerFamily); + }; + } + + private static ViewAssertion isCornerFamilyBottomLeft( + Class cornerFamily) { + return (view, noViewFoundException) -> { + assertThat(view).isInstanceOf(TextInputLayout.class); + ShapeAppearanceModel shapeAppearanceModel = + ((TextInputLayout) view).getShapeAppearanceModel(); + assertThat(shapeAppearanceModel.getBottomLeftCorner()).isInstanceOf(cornerFamily); + }; + } + + private static ViewAssertion isCornerFamilyBottomRight( + Class cornerFamily) { + return (view, noViewFoundException) -> { + assertThat(view).isInstanceOf(TextInputLayout.class); + ShapeAppearanceModel shapeAppearanceModel = + ((TextInputLayout) view).getShapeAppearanceModel(); + assertThat(shapeAppearanceModel.getBottomRightCorner()).isInstanceOf(cornerFamily); + }; + } + private static ViewAssertion isBoxCornerRadiusTopStart(final float boxCornerRadiusTopStart) { return (view, noViewFoundException) -> { assertThat(view).isInstanceOf(TextInputLayout.class);