content: package androidx.appcompat.widget;
  
  import android.content.Context;
  import android.content.res.ColorStateList;
  import android.graphics.PorterDuff;
  import android.graphics.drawable.Drawable;
  import android.text.InputFilter;
  import android.util.AttributeSet;
  import android.view.ActionMode;
  import android.view.accessibility.AccessibilityEvent;
  import android.view.accessibility.AccessibilityNodeInfo;
  import android.widget.Button;
  import androidx.appcompat.R;
  import androidx.core.view.TintableBackgroundView;
  import androidx.core.widget.AutoSizeableTextView;
  import androidx.core.widget.TextViewCompat;
  import androidx.core.widget.TintableCompoundDrawablesView;
  
  public class AppCompatButton extends Button implements TintableBackgroundView, AutoSizeableTextView, TintableCompoundDrawablesView, EmojiCompatConfigurationView {
      private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
      private final AppCompatBackgroundHelper mBackgroundTintHelper;
      private final AppCompatTextHelper mTextHelper;
  
      public AppCompatButton(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public AppCompatButton(Context context, AttributeSet attrs) {
          this(context, attrs, R.attr.buttonStyle);
      }
  
      public AppCompatButton(Context context, AttributeSet attrs, int defStyleAttr) {
          super(TintContextWrapper.wrap(context), attrs, defStyleAttr);
          ThemeUtils.checkAppCompatTheme(this, getContext());
          AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
          this.mBackgroundTintHelper = appCompatBackgroundHelper;
          appCompatBackgroundHelper.loadFromAttributes(attrs, defStyleAttr);
          AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
          this.mTextHelper = appCompatTextHelper;
          appCompatTextHelper.loadFromAttributes(attrs, defStyleAttr);
          appCompatTextHelper.applyCompoundDrawablesTints();
          getEmojiTextViewHelper().loadFromAttributes(attrs, defStyleAttr);
      }
  
      private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
          if (this.mAppCompatEmojiTextHelper == null) {
              this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
          }
          return this.mAppCompatEmojiTextHelper;
      }
  
      /* access modifiers changed from: protected */
      public void drawableStateChanged() {
          super.drawableStateChanged();
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              appCompatBackgroundHelper.applySupportBackgroundTint();
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.applyCompoundDrawablesTints();
          }
      }
  
      public int getAutoSizeMaxTextSize() {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              return super.getAutoSizeMaxTextSize();
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              return appCompatTextHelper.getAutoSizeMaxTextSize();
          }
          return -1;
      }
  
      public int getAutoSizeMinTextSize() {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              return super.getAutoSizeMinTextSize();
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              return appCompatTextHelper.getAutoSizeMinTextSize();
          }
          return -1;
      }
  
      public int getAutoSizeStepGranularity() {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              return super.getAutoSizeStepGranularity();
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              return appCompatTextHelper.getAutoSizeStepGranularity();
          }
          return -1;
      }
  
      public int[] getAutoSizeTextAvailableSizes() {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              return super.getAutoSizeTextAvailableSizes();
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          return appCompatTextHelper != null ? appCompatTextHelper.getAutoSizeTextAvailableSizes() : new int[0];
      }
  
      public int getAutoSizeTextType() {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              return super.getAutoSizeTextType() == 1 ? 1 : 0;
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              return appCompatTextHelper.getAutoSizeTextType();
          }
          return 0;
      }
  
      public ActionMode.Callback getCustomSelectionActionModeCallback() {
          return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
      }
  
      public ColorStateList getSupportBackgroundTintList() {
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              return appCompatBackgroundHelper.getSupportBackgroundTintList();
          }
          return null;
      }
  
      public PorterDuff.Mode getSupportBackgroundTintMode() {
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              return appCompatBackgroundHelper.getSupportBackgroundTintMode();
          }
          return null;
      }
  
      public ColorStateList getSupportCompoundDrawablesTintList() {
          return this.mTextHelper.getCompoundDrawableTintList();
      }
  
      public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
          return this.mTextHelper.getCompoundDrawableTintMode();
      }
  
      public boolean isEmojiCompatEnabled() {
          return getEmojiTextViewHelper().isEnabled();
      }
  
      public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
          super.onInitializeAccessibilityEvent(event);
          event.setClassName(Button.class.getName());
      }
  
      public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
          super.onInitializeAccessibilityNodeInfo(info);
          info.setClassName(Button.class.getName());
      }
  
      /* access modifiers changed from: protected */
      public void onLayout(boolean changed, int left, int top, int right, int bottom) {
          super.onLayout(changed, left, top, right, bottom);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onLayout(changed, left, top, right, bottom);
          }
      }
  
      /* access modifiers changed from: protected */
      public void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
          super.onTextChanged(text, start, lengthBefore, lengthAfter);
          if (this.mTextHelper != null && !PLATFORM_SUPPORTS_AUTOSIZE && this.mTextHelper.isAutoSizeEnabled()) {
              this.mTextHelper.autoSizeText();
          }
      }
  
      public void setAllCaps(boolean allCaps) {
          super.setAllCaps(allCaps);
          getEmojiTextViewHelper().setAllCaps(allCaps);
      }
  
      public void setAutoSizeTextTypeUniformWithConfiguration(int autoSizeMinTextSize, int autoSizeMaxTextSize, int autoSizeStepGranularity, int unit) throws IllegalArgumentException {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              super.setAutoSizeTextTypeUniformWithConfiguration(autoSizeMinTextSize, autoSizeMaxTextSize, autoSizeStepGranularity, unit);
              return;
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.setAutoSizeTextTypeUniformWithConfiguration(autoSizeMinTextSize, autoSizeMaxTextSize, autoSizeStepGranularity, unit);
          }
      }
  
      public void setAutoSizeTextTypeUniformWithPresetSizes(int[] presetSizes, int unit) throws IllegalArgumentException {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              super.setAutoSizeTextTypeUniformWithPresetSizes(presetSizes, unit);
              return;
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.setAutoSizeTextTypeUniformWithPresetSizes(presetSizes, unit);
          }
      }
  
      public void setAutoSizeTextTypeWithDefaults(int autoSizeTextType) {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              super.setAutoSizeTextTypeWithDefaults(autoSizeTextType);
              return;
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.setAutoSizeTextTypeWithDefaults(autoSizeTextType);
          }
      }
  
      public void setBackgroundDrawable(Drawable background) {
          super.setBackgroundDrawable(background);
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              appCompatBackgroundHelper.onSetBackgroundDrawable(background);
          }
      }
  
      public void setBackgroundResource(int resId) {
          super.setBackgroundResource(resId);
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              appCompatBackgroundHelper.onSetBackgroundResource(resId);
          }
      }
  
      public void setCustomSelectionActionModeCallback(ActionMode.Callback actionModeCallback) {
          super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, actionModeCallback));
      }
  
      public void setEmojiCompatEnabled(boolean enabled) {
          getEmojiTextViewHelper().setEnabled(enabled);
      }
  
      public void setFilters(InputFilter[] filters) {
          super.setFilters(getEmojiTextViewHelper().getFilters(filters));
      }
  
      public void setSupportAllCaps(boolean allCaps) {
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.setAllCaps(allCaps);
          }
      }
  
      public void setSupportBackgroundTintList(ColorStateList tint) {
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              appCompatBackgroundHelper.setSupportBackgroundTintList(tint);
          }
      }
  
      public void setSupportBackgroundTintMode(PorterDuff.Mode tintMode) {
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              appCompatBackgroundHelper.setSupportBackgroundTintMode(tintMode);
          }
      }
  
      public void setSupportCompoundDrawablesTintList(ColorStateList tint) {
          this.mTextHelper.setCompoundDrawableTintList(tint);
          this.mTextHelper.applyCompoundDrawablesTints();
      }
  
      public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode tintMode) {
          this.mTextHelper.setCompoundDrawableTintMode(tintMode);
          this.mTextHelper.applyCompoundDrawablesTints();
      }
  
      public void setTextAppearance(Context context, int resId) {
          super.setTextAppearance(context, resId);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onSetTextAppearance(context, resId);
          }
      }
  
      public void setTextSize(int unit, float size) {
          if (PLATFORM_SUPPORTS_AUTOSIZE) {
              super.setTextSize(unit, size);
              return;
          }
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.setTextSize(unit, size);
          }
      }
  }
  