Initial commit
This commit is contained in:
171
sources/androidx/appcompat/widget/AppCompatImageButton.java
Normal file
171
sources/androidx/appcompat/widget/AppCompatImageButton.java
Normal file
@@ -0,0 +1,171 @@
|
||||
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$attr;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableImageSourceView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageButton extends ImageButton implements TintableBackgroundView, TintableImageSourceView {
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatImageHelper b;
|
||||
|
||||
public AppCompatImageButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public ColorStateList getSupportImageTintList() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public PorterDuff.Mode getSupportImageTintMode() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
public boolean hasOverlappingRendering() {
|
||||
return this.b.d() && super.hasOverlappingRendering();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageBitmap(Bitmap bitmap) {
|
||||
super.setImageBitmap(bitmap);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
super.setImageDrawable(drawable);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
this.b.a(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.imageButtonStyle);
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatImageHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user