content: package androidx.appcompat.widget;
  
  import android.content.Context;
  import android.content.res.ColorStateList;
  import android.graphics.PorterDuff;
  import android.graphics.Typeface;
  import android.graphics.drawable.Drawable;
  import android.os.Build;
  import android.text.InputFilter;
  import android.util.AttributeSet;
  import android.view.ActionMode;
  import android.view.inputmethod.EditorInfo;
  import android.view.inputmethod.InputConnection;
  import android.view.textclassifier.TextClassifier;
  import android.widget.TextView;
  import androidx.appcompat.content.res.AppCompatResources;
  import androidx.core.graphics.TypefaceCompat;
  import androidx.core.text.PrecomputedTextCompat;
  import androidx.core.view.TintableBackgroundView;
  import androidx.core.widget.AutoSizeableTextView;
  import androidx.core.widget.TextViewCompat;
  import androidx.core.widget.TintableCompoundDrawablesView;
  import java.util.concurrent.ExecutionException;
  import java.util.concurrent.Future;
  
  public class AppCompatTextView extends TextView implements TintableBackgroundView, TintableCompoundDrawablesView, AutoSizeableTextView, EmojiCompatConfigurationView {
      private final AppCompatBackgroundHelper mBackgroundTintHelper;
      private AppCompatEmojiTextHelper mEmojiTextViewHelper;
      private boolean mIsSetTypefaceProcessing;
      private Future<PrecomputedTextCompat> mPrecomputedTextFuture;
      private final AppCompatTextClassifierHelper mTextClassifierHelper;
      private final AppCompatTextHelper mTextHelper;
  
      public AppCompatTextView(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public AppCompatTextView(Context context, AttributeSet attrs) {
          this(context, attrs, 16842884);
      }
  
      public AppCompatTextView(Context context, AttributeSet attrs, int defStyleAttr) {
          super(TintContextWrapper.wrap(context), attrs, defStyleAttr);
          this.mIsSetTypefaceProcessing = false;
          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();
          this.mTextClassifierHelper = new AppCompatTextClassifierHelper(this);
          getEmojiTextViewHelper().loadFromAttributes(attrs, defStyleAttr);
      }
  
      private void consumeTextFutureAndSetBlocking() {
          Future<PrecomputedTextCompat> future = this.mPrecomputedTextFuture;
          if (future != null) {
              try {
                  this.mPrecomputedTextFuture = null;
                  TextViewCompat.setPrecomputedText(this, future.get());
              } catch (InterruptedException | ExecutionException e) {
              }
          }
      }
  
      private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
          if (this.mEmojiTextViewHelper == null) {
              this.mEmojiTextViewHelper = new AppCompatEmojiTextHelper(this);
          }
          return this.mEmojiTextViewHelper;
      }
  
      /* 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 int getFirstBaselineToTopHeight() {
          return TextViewCompat.getFirstBaselineToTopHeight(this);
      }
  
      public int getLastBaselineToBottomHeight() {
          return TextViewCompat.getLastBaselineToBottomHeight(this);
      }
  
      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 CharSequence getText() {
          consumeTextFutureAndSetBlocking();
          return super.getText();
      }
  
      /* JADX WARNING: Code restructure failed: missing block: B:2:0x0006, code lost:
          r0 = r2.mTextClassifierHelper;
       */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      public android.view.textclassifier.TextClassifier getTextClassifier() {
          /*
              r2 = this;
              int r0 = android.os.Build.VERSION.SDK_INT
              r1 = 28
              if (r0 >= r1) goto L_0x0010
              androidx.appcompat.widget.AppCompatTextClassifierHelper r0 = r2.mTextClassifierHelper
              if (r0 != 0) goto L_0x000b
              goto L_0x0010
          L_0x000b:
              android.view.textclassifier.TextClassifier r0 = r0.getTextClassifier()
              return r0
          L_0x0010:
              android.view.textclassifier.TextClassifier r0 = super.getTextClassifier()
              return r0
          */
          throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatTextView.getTextClassifier():android.view.textclassifier.TextClassifier");
      }
  
      public PrecomputedTextCompat.Params getTextMetricsParamsCompat() {
          return TextViewCompat.getTextMetricsParams(this);
      }
  
      public boolean isEmojiCompatEnabled() {
          return getEmojiTextViewHelper().isEnabled();
      }
  
      public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
          InputConnection onCreateInputConnection = super.onCreateInputConnection(outAttrs);
          this.mTextHelper.populateSurroundingTextIfNeeded(this, onCreateInputConnection, outAttrs);
          return AppCompatHintHelper.onCreateInputConnection(onCreateInputConnection, outAttrs, this);
      }
  
      /* 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 onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          consumeTextFutureAndSetBlocking();
          super.onMeasure(widthMeasureSpec, heightMeasureSpec);
      }
  
      /* 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 setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
          super.setCompoundDrawables(left, top, right, bottom);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onSetCompoundDrawables();
          }
      }
  
      public void setCompoundDrawablesRelative(Drawable start, Drawable top, Drawable end, Drawable bottom) {
          super.setCompoundDrawablesRelative(start, top, end, bottom);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onSetCompoundDrawables();
          }
      }
  
      public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end, int bottom) {
          Context context = getContext();
          Drawable drawable = null;
          Drawable drawable2 = start != 0 ? AppCompatResources.getDrawable(context, start) : null;
          Drawable drawable3 = top != 0 ? AppCompatResources.getDrawable(context, top) : null;
          Drawable drawable4 = end != 0 ? AppCompatResources.getDrawable(context, end) : null;
          if (bottom != 0) {
              drawable = AppCompatResources.getDrawable(context, bottom);
          }
          setCompoundDrawablesRelativeWithIntrinsicBounds(drawable2, drawable3, drawable4, drawable);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onSetCompoundDrawables();
          }
      }
  
      public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start, Drawable top, Drawable end, Drawable bottom) {
          super.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onSetCompoundDrawables();
          }
      }
  
      public void setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom) {
          Context context = getContext();
          Drawable drawable = null;
          Drawable drawable2 = left != 0 ? AppCompatResources.getDrawable(context, left) : null;
          Drawable drawable3 = top != 0 ? AppCompatResources.getDrawable(context, top) : null;
          Drawable drawable4 = right != 0 ? AppCompatResources.getDrawable(context, right) : null;
          if (bottom != 0) {
              drawable = AppCompatResources.getDrawable(context, bottom);
          }
          setCompoundDrawablesWithIntrinsicBounds(drawable2, drawable3, drawable4, drawable);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onSetCompoundDrawables();
          }
      }
  
      public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom) {
          super.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
          AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
          if (appCompatTextHelper != null) {
              appCompatTextHelper.onSetCompoundDrawables();
          }
      }
  
      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 setFirstBaselineToTopHeight(int firstBaselineToTopHeight) {
          if (Build.VERSION.SDK_INT >= 28) {
              super.setFirstBaselineToTopHeight(firstBaselineToTopHeight);
          } else {
              TextViewCompat.setFirstBaselineToTopHeight(this, firstBaselineToTopHeight);
          }
      }
  
      public void setLastBaselineToBottomHeight(int lastBaselineToBottomHeight) {
          if (Build.VERSION.SDK_INT >= 28) {
              super.setLastBaselineToBottomHeight(lastBaselineToBottomHeight);
          } else {
              TextViewCompat.setLastBaselineToBottomHeight(this, lastBaselineToBottomHeight);
          }
      }
  
      public void setLineHeight(int lineHeight) {
          TextViewCompat.setLineHeight(this, lineHeight);
      }
  
      public void setPrecomputedText(PrecomputedTextCompat precomputed) {
          TextViewCompat.setPrecomputedText(this, precomputed);
      }
  
      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 tintList) {
          this.mTextHelper.setCompoundDrawableTintList(tintList);
          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 setTextClassifier(TextClassifier textClassifier) {
          AppCompatTextClassifierHelper appCompatTextClassifierHelper;
          if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
              super.setTextClassifier(textClassifier);
          } else {
              appCompatTextClassifierHelper.setTextClassifier(textClassifier);
          }
      }
  
      public void setTextFuture(Future<PrecomputedTextCompat> future) {
          this.mPrecomputedTextFuture = future;
          if (future != null) {
              requestLayout();
          }
      }
  
      public void setTextMetricsParamsCompat(PrecomputedTextCompat.Params params) {
          TextViewCompat.setTextMetricsParams(this, params);
      }
  
      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);
          }
      }
  
      public void setTypeface(Typeface tf, int style) {
          if (!this.mIsSetTypefaceProcessing) {
              Typeface typeface = null;
              if (tf != null && style > 0) {
                  typeface = TypefaceCompat.create(getContext(), tf, style);
              }
              this.mIsSetTypefaceProcessing = true;
              try {
                  super.setTypeface(typeface != null ? typeface : tf, style);
              } finally {
                  this.mIsSetTypefaceProcessing = false;
              }
          }
      }
  }
  