alexandroid/decompiled/jadx/sources/androidx/appcompat/widget/AppCompatImageButton.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

242 lines
10 KiB
Java

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.view.inspector.InspectionCompanion;
import android.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.ImageButton;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.core.view.TintableBackgroundView;
import androidx.core.widget.TintableImageSourceView;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes.dex */
public class AppCompatImageButton extends ImageButton implements TintableBackgroundView, TintableImageSourceView {
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private boolean mHasLevel;
private final AppCompatImageHelper mImageHelper;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion<AppCompatImageButton> {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private boolean mPropertiesMapped = false;
private int mTintId;
private int mTintModeId;
@Override // android.view.inspector.InspectionCompanion
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
this.mBackgroundTintId = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintModeId = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mTintId = propertyMapper.mapObject("tint", R.attr.tint);
this.mTintModeId = propertyMapper.mapObject("tintMode", R.attr.tintMode);
this.mPropertiesMapped = true;
}
@Override // android.view.inspector.InspectionCompanion
public void readProperties(@NonNull AppCompatImageButton appCompatImageButton, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw new InspectionCompanion.UninitializedPropertyMapException();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatImageButton.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatImageButton.getBackgroundTintMode());
propertyReader.readObject(this.mTintId, appCompatImageButton.getImageTintList());
propertyReader.readObject(this.mTintModeId, appCompatImageButton.getImageTintMode());
}
}
public AppCompatImageButton(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
super(TintContextWrapper.wrap(context), attributeSet, i);
this.mHasLevel = false;
ThemeUtils.checkAppCompatTheme(this, getContext());
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
this.mBackgroundTintHelper = appCompatBackgroundHelper;
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
AppCompatImageHelper appCompatImageHelper = new AppCompatImageHelper(this);
this.mImageHelper = appCompatImageHelper;
appCompatImageHelper.loadFromAttributes(attributeSet, i);
}
@Override // android.widget.ImageView, android.view.View
public void drawableStateChanged() {
super.drawableStateChanged();
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.applySupportBackgroundTint();
}
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.applySupportImageTint();
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // androidx.core.widget.TintableImageSourceView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportImageTintList() {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
return appCompatImageHelper.getSupportImageTintList();
}
return null;
}
@Override // androidx.core.widget.TintableImageSourceView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportImageTintMode() {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
return appCompatImageHelper.getSupportImageTintMode();
}
return null;
}
@Override // android.widget.ImageView, android.view.View
public boolean hasOverlappingRendering() {
return this.mImageHelper.hasOverlappingRendering() && super.hasOverlappingRendering();
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.widget.ImageView
public void setImageBitmap(Bitmap bitmap) {
super.setImageBitmap(bitmap);
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.applySupportImageTint();
}
}
@Override // android.widget.ImageView
public void setImageDrawable(@Nullable 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) {
return;
}
this.mImageHelper.applyImageLevel();
}
}
@Override // android.widget.ImageView
public void setImageLevel(int i) {
super.setImageLevel(i);
this.mHasLevel = true;
}
@Override // android.widget.ImageView
public void setImageResource(@DrawableRes int i) {
this.mImageHelper.setImageResource(i);
}
@Override // android.widget.ImageView
public void setImageURI(@Nullable Uri uri) {
super.setImageURI(uri);
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.applySupportImageTint();
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.widget.TintableImageSourceView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportImageTintList(@Nullable ColorStateList colorStateList) {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.setSupportImageTintList(colorStateList);
}
}
@Override // androidx.core.widget.TintableImageSourceView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportImageTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.setSupportImageTintMode(mode);
}
}
public AppCompatImageButton(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.imageButtonStyle);
}
public AppCompatImageButton(@NonNull Context context) {
this(context, null);
}
}