@Test public void testAllCaps() { final String text1 = mResources.getString(R.string.sample_text1); final String text2 = mResources.getString(R.string.sample_text2); final AppCompatButton button1 = (AppCompatButton) mContainer.findViewById(R.id.button_caps1); final AppCompatButton button2 = (AppCompatButton) mContainer.findViewById(R.id.button_caps2); assertEquals("Button starts in all caps on", text1.toUpperCase(), button1.getLayout().getText().toString()); assertEquals("Button starts in all caps off", text2, button2.getLayout().getText().toString()); onView(withId(R.id.button_caps1)).perform( setTextAppearance(R.style.TextStyleAllCapsOff)); assertEquals("Button is now in all caps off", text1, button1.getLayout().getText().toString()); onView(withId(R.id.button_caps2)).perform( setTextAppearance(R.style.TextStyleAllCapsOn)); assertEquals("Button is now in all caps on", text2.toUpperCase(), button2.getLayout().getText().toString()); }
@Override public void setTextAppearance(Context context, int resId) { super.setTextAppearance(context, resId); if (mTextHelper != null) { mTextHelper.onSetTextAppearance(context, resId); } }
AppCompatButton extends Button implements TintableBackgroundView,
        AutoSizeableTextView { @Override public void setTextAppearance(Context context, int resId) { super.setTextAppearance(context, resId); if (mTextHelper != null) { mTextHelper.onSetTextAppearance(context, resId); } } }
AppCompatButton extends Button implements TintableBackgroundView,
        AutoSizeableTextView { @Override public void setTextAppearance(Context context, int resId) { super.setTextAppearance(context, resId); if (mTextHelper != null) { mTextHelper.onSetTextAppearance(context, resId); } } AppCompatButton(Context context);  AppCompatButton(Context context, AttributeSet attrs);  AppCompatButton(Context context, AttributeSet attrs, int defStyleAttr); }
AppCompatButton extends Button implements TintableBackgroundView,
        AutoSizeableTextView { @Override public void setTextAppearance(Context context, int resId) { super.setTextAppearance(context, resId); if (mTextHelper != null) { mTextHelper.onSetTextAppearance(context, resId); } } AppCompatButton(Context context);  AppCompatButton(Context context, AttributeSet attrs);  AppCompatButton(Context context, AttributeSet attrs, int defStyleAttr); @Override void setBackgroundResource(@DrawableRes int resId); @Override void setBackgroundDrawable(Drawable background); @RestrictTo(LIBRARY_GROUP) @Override void setSupportBackgroundTintList(@Nullable ColorStateList tint); @RestrictTo(LIBRARY_GROUP) @Override @Nullable ColorStateList getSupportBackgroundTintList(); @RestrictTo(LIBRARY_GROUP) @Override void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode); @RestrictTo(LIBRARY_GROUP) @Override @Nullable PorterDuff.Mode getSupportBackgroundTintMode(); @Override void setTextAppearance(Context context, int resId); @Override void onInitializeAccessibilityEvent(AccessibilityEvent event); @Override void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info); @Override void setTextSize(int unit, float size); @RestrictTo(LIBRARY_GROUP) @Override void setAutoSizeTextTypeWithDefaults(
            @TextViewCompat.AutoSizeTextType int autoSizeTextType); @RestrictTo(LIBRARY_GROUP) @Override void setAutoSizeTextTypeUniformWithConfiguration(
            int autoSizeMinTextSize,
            int autoSizeMaxTextSize,
            int autoSizeStepGranularity,
            int unit); @RestrictTo(LIBRARY_GROUP) @Override void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull int[] presetSizes, int unit); @RestrictTo(LIBRARY_GROUP) @Override @TextViewCompat.AutoSizeTextType int getAutoSizeTextType(); @RestrictTo(LIBRARY_GROUP) @Override int getAutoSizeStepGranularity(); @RestrictTo(LIBRARY_GROUP) @Override int getAutoSizeMinTextSize(); @RestrictTo(LIBRARY_GROUP) @Override int getAutoSizeMaxTextSize(); @RestrictTo(LIBRARY_GROUP) @Override int[] getAutoSizeTextAvailableSizes(); void setSupportAllCaps(boolean allCaps); }
AppCompatButton extends Button implements TintableBackgroundView,
        AutoSizeableTextView { @Override public void setTextAppearance(Context context, int resId) { super.setTextAppearance(context, resId); if (mTextHelper != null) { mTextHelper.onSetTextAppearance(context, resId); } } AppCompatButton(Context context);  AppCompatButton(Context context, AttributeSet attrs);  AppCompatButton(Context context, AttributeSet attrs, int defStyleAttr); @Override void setBackgroundResource(@DrawableRes int resId); @Override void setBackgroundDrawable(Drawable background); @RestrictTo(LIBRARY_GROUP) @Override void setSupportBackgroundTintList(@Nullable ColorStateList tint); @RestrictTo(LIBRARY_GROUP) @Override @Nullable ColorStateList getSupportBackgroundTintList(); @RestrictTo(LIBRARY_GROUP) @Override void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode); @RestrictTo(LIBRARY_GROUP) @Override @Nullable PorterDuff.Mode getSupportBackgroundTintMode(); @Override void setTextAppearance(Context context, int resId); @Override void onInitializeAccessibilityEvent(AccessibilityEvent event); @Override void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info); @Override void setTextSize(int unit, float size); @RestrictTo(LIBRARY_GROUP) @Override void setAutoSizeTextTypeWithDefaults(
            @TextViewCompat.AutoSizeTextType int autoSizeTextType); @RestrictTo(LIBRARY_GROUP) @Override void setAutoSizeTextTypeUniformWithConfiguration(
            int autoSizeMinTextSize,
            int autoSizeMaxTextSize,
            int autoSizeStepGranularity,
            int unit); @RestrictTo(LIBRARY_GROUP) @Override void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull int[] presetSizes, int unit); @RestrictTo(LIBRARY_GROUP) @Override @TextViewCompat.AutoSizeTextType int getAutoSizeTextType(); @RestrictTo(LIBRARY_GROUP) @Override int getAutoSizeStepGranularity(); @RestrictTo(LIBRARY_GROUP) @Override int getAutoSizeMinTextSize(); @RestrictTo(LIBRARY_GROUP) @Override int getAutoSizeMaxTextSize(); @RestrictTo(LIBRARY_GROUP) @Override int[] getAutoSizeTextAvailableSizes(); void setSupportAllCaps(boolean allCaps);  }