content: package androidx.appcompat.widget;
  
  import android.content.Context;
  import android.content.res.ColorStateList;
  import android.graphics.Bitmap;
  import android.graphics.PorterDuff;
  import android.graphics.drawable.Drawable;
  import android.net.Uri;
  import android.util.AttributeSet;
  import android.widget.ImageButton;
  import androidx.appcompat.R;
  import androidx.core.view.TintableBackgroundView;
  import androidx.core.widget.TintableImageSourceView;
  
  public class AppCompatImageButton extends ImageButton implements TintableBackgroundView, TintableImageSourceView {
      private final AppCompatBackgroundHelper mBackgroundTintHelper;
      private boolean mHasLevel;
      private final AppCompatImageHelper mImageHelper;
  
      public AppCompatImageButton(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public AppCompatImageButton(Context context, AttributeSet attrs) {
          this(context, attrs, R.attr.imageButtonStyle);
      }
  
      public AppCompatImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
          super(TintContextWrapper.wrap(context), attrs, defStyleAttr);
          this.mHasLevel = false;
          ThemeUtils.checkAppCompatTheme(this, getContext());
          AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
          this.mBackgroundTintHelper = appCompatBackgroundHelper;
          appCompatBackgroundHelper.loadFromAttributes(attrs, defStyleAttr);
          AppCompatImageHelper appCompatImageHelper = new AppCompatImageHelper(this);
          this.mImageHelper = appCompatImageHelper;
          appCompatImageHelper.loadFromAttributes(attrs, defStyleAttr);
      }
  
      /* access modifiers changed from: protected */
      public void drawableStateChanged() {
          super.drawableStateChanged();
          AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
          if (appCompatBackgroundHelper != null) {
              appCompatBackgroundHelper.applySupportBackgroundTint();
          }
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (appCompatImageHelper != null) {
              appCompatImageHelper.applySupportImageTint();
          }
      }
  
      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 getSupportImageTintList() {
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (appCompatImageHelper != null) {
              return appCompatImageHelper.getSupportImageTintList();
          }
          return null;
      }
  
      public PorterDuff.Mode getSupportImageTintMode() {
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (appCompatImageHelper != null) {
              return appCompatImageHelper.getSupportImageTintMode();
          }
          return null;
      }
  
      public boolean hasOverlappingRendering() {
          return this.mImageHelper.hasOverlappingRendering() && super.hasOverlappingRendering();
      }
  
      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 setImageBitmap(Bitmap bm) {
          super.setImageBitmap(bm);
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (appCompatImageHelper != null) {
              appCompatImageHelper.applySupportImageTint();
          }
      }
  
      public void setImageDrawable(Drawable drawable) {
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (!(appCompatImageHelper == null || drawable == null || this.mHasLevel)) {
              appCompatImageHelper.obtainLevelFromDrawable(drawable);
          }
          super.setImageDrawable(drawable);
          AppCompatImageHelper appCompatImageHelper2 = this.mImageHelper;
          if (appCompatImageHelper2 != null) {
              appCompatImageHelper2.applySupportImageTint();
              if (!this.mHasLevel) {
                  this.mImageHelper.applyImageLevel();
              }
          }
      }
  
      public void setImageLevel(int level) {
          super.setImageLevel(level);
          this.mHasLevel = true;
      }
  
      public void setImageResource(int resId) {
          this.mImageHelper.setImageResource(resId);
      }
  
      public void setImageURI(Uri uri) {
          super.setImageURI(uri);
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (appCompatImageHelper != null) {
              appCompatImageHelper.applySupportImageTint();
          }
      }
  
      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 setSupportImageTintList(ColorStateList tint) {
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (appCompatImageHelper != null) {
              appCompatImageHelper.setSupportImageTintList(tint);
          }
      }
  
      public void setSupportImageTintMode(PorterDuff.Mode tintMode) {
          AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
          if (appCompatImageHelper != null) {
              appCompatImageHelper.setSupportImageTintMode(tintMode);
          }
      }
  }
  