228 lines
7.4 KiB
Java
228 lines
7.4 KiB
Java
|
package androidx.cardview.widget;
|
||
|
|
||
|
import android.R;
|
||
|
import android.content.Context;
|
||
|
import android.content.res.ColorStateList;
|
||
|
import android.content.res.TypedArray;
|
||
|
import android.graphics.Color;
|
||
|
import android.graphics.Rect;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.view.View;
|
||
|
import android.widget.FrameLayout;
|
||
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||
|
import o.DAL;
|
||
|
import o.EaY;
|
||
|
import o.OoT;
|
||
|
import o.xVf;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class CardView extends FrameLayout {
|
||
|
public static final EaY e;
|
||
|
private static final int[] f = {R.attr.colorBackground};
|
||
|
public final OoT a;
|
||
|
final Rect b;
|
||
|
public boolean c;
|
||
|
public boolean d;
|
||
|
int h;
|
||
|
int i;
|
||
|
final Rect j;
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void setPadding(int i, int i2, int i3, int i4) {
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void setPaddingRelative(int i, int i2, int i3, int i4) {
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
xVf xvf = new xVf();
|
||
|
e = xvf;
|
||
|
xvf.c();
|
||
|
}
|
||
|
|
||
|
public CardView(Context context) {
|
||
|
this(context, null);
|
||
|
}
|
||
|
|
||
|
public CardView(Context context, AttributeSet attributeSet) {
|
||
|
this(context, attributeSet, DAL.IeS.cardViewStyle);
|
||
|
}
|
||
|
|
||
|
public CardView(Context context, AttributeSet attributeSet, int i) {
|
||
|
super(context, attributeSet, i);
|
||
|
int color;
|
||
|
ColorStateList valueOf;
|
||
|
Rect rect = new Rect();
|
||
|
this.b = rect;
|
||
|
this.j = new Rect();
|
||
|
OoT ooT = new OoT(this) { // from class: androidx.cardview.widget.CardView.5
|
||
|
final CardView b;
|
||
|
private Drawable c;
|
||
|
|
||
|
{
|
||
|
this.b = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.OoT
|
||
|
public final void kk_(Drawable drawable) {
|
||
|
this.c = drawable;
|
||
|
this.b.setBackgroundDrawable(drawable);
|
||
|
}
|
||
|
|
||
|
@Override // o.OoT
|
||
|
public final void c(int i2, int i3, int i4, int i5) {
|
||
|
this.b.j.set(i2, i3, i4, i5);
|
||
|
CardView cardView = this.b;
|
||
|
CardView.super.setPadding(i2 + cardView.b.left, i3 + this.b.b.top, i4 + this.b.b.right, i5 + this.b.b.bottom);
|
||
|
}
|
||
|
|
||
|
@Override // o.OoT
|
||
|
public final boolean c() {
|
||
|
return this.b.d;
|
||
|
}
|
||
|
|
||
|
@Override // o.OoT
|
||
|
public final boolean d() {
|
||
|
return this.b.c;
|
||
|
}
|
||
|
|
||
|
@Override // o.OoT
|
||
|
public final View b() {
|
||
|
return this.b;
|
||
|
}
|
||
|
|
||
|
@Override // o.OoT
|
||
|
public final Drawable kj_() {
|
||
|
return this.c;
|
||
|
}
|
||
|
};
|
||
|
this.a = ooT;
|
||
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, DAL.LWm.CardView, i, DAL.RVV.CardView);
|
||
|
if (obtainStyledAttributes.hasValue(DAL.LWm.CardView_cardBackgroundColor)) {
|
||
|
valueOf = obtainStyledAttributes.getColorStateList(DAL.LWm.CardView_cardBackgroundColor);
|
||
|
} else {
|
||
|
TypedArray obtainStyledAttributes2 = getContext().obtainStyledAttributes(f);
|
||
|
int color2 = obtainStyledAttributes2.getColor(0, 0);
|
||
|
obtainStyledAttributes2.recycle();
|
||
|
float[] fArr = new float[3];
|
||
|
Color.colorToHSV(color2, fArr);
|
||
|
if (fArr[2] > 0.5f) {
|
||
|
color = getResources().getColor(DAL.Sts.cardview_light_background);
|
||
|
} else {
|
||
|
color = getResources().getColor(DAL.Sts.cardview_dark_background);
|
||
|
}
|
||
|
valueOf = ColorStateList.valueOf(color);
|
||
|
}
|
||
|
ColorStateList colorStateList = valueOf;
|
||
|
float dimension = obtainStyledAttributes.getDimension(DAL.LWm.CardView_cardCornerRadius, BitmapDescriptorFactory.HUE_RED);
|
||
|
float dimension2 = obtainStyledAttributes.getDimension(DAL.LWm.CardView_cardElevation, BitmapDescriptorFactory.HUE_RED);
|
||
|
float dimension3 = obtainStyledAttributes.getDimension(DAL.LWm.CardView_cardMaxElevation, BitmapDescriptorFactory.HUE_RED);
|
||
|
this.c = obtainStyledAttributes.getBoolean(DAL.LWm.CardView_cardUseCompatPadding, false);
|
||
|
this.d = obtainStyledAttributes.getBoolean(DAL.LWm.CardView_cardPreventCornerOverlap, true);
|
||
|
int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(DAL.LWm.CardView_contentPadding, 0);
|
||
|
rect.left = obtainStyledAttributes.getDimensionPixelSize(DAL.LWm.CardView_contentPaddingLeft, dimensionPixelSize);
|
||
|
rect.top = obtainStyledAttributes.getDimensionPixelSize(DAL.LWm.CardView_contentPaddingTop, dimensionPixelSize);
|
||
|
rect.right = obtainStyledAttributes.getDimensionPixelSize(DAL.LWm.CardView_contentPaddingRight, dimensionPixelSize);
|
||
|
rect.bottom = obtainStyledAttributes.getDimensionPixelSize(DAL.LWm.CardView_contentPaddingBottom, dimensionPixelSize);
|
||
|
float f2 = dimension2 > dimension3 ? dimension2 : dimension3;
|
||
|
this.i = obtainStyledAttributes.getDimensionPixelSize(DAL.LWm.CardView_android_minWidth, 0);
|
||
|
this.h = obtainStyledAttributes.getDimensionPixelSize(DAL.LWm.CardView_android_minHeight, 0);
|
||
|
obtainStyledAttributes.recycle();
|
||
|
e.km_(ooT, context, colorStateList, dimension, dimension2, f2);
|
||
|
}
|
||
|
|
||
|
public void setUseCompatPadding(boolean z) {
|
||
|
if (this.c != z) {
|
||
|
this.c = z;
|
||
|
e.f(this.a);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setContentPadding(int i, int i2, int i3, int i4) {
|
||
|
this.b.set(i, i2, i3, i4);
|
||
|
e.h(this.a);
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.FrameLayout, android.view.View
|
||
|
public void onMeasure(int i, int i2) {
|
||
|
if (!(e instanceof xVf)) {
|
||
|
int mode = View.MeasureSpec.getMode(i);
|
||
|
if (mode == Integer.MIN_VALUE || mode == 1073741824) {
|
||
|
i = View.MeasureSpec.makeMeasureSpec(Math.max((int) Math.ceil(r0.a(this.a)), View.MeasureSpec.getSize(i)), mode);
|
||
|
}
|
||
|
int mode2 = View.MeasureSpec.getMode(i2);
|
||
|
if (mode2 == Integer.MIN_VALUE || mode2 == 1073741824) {
|
||
|
i2 = View.MeasureSpec.makeMeasureSpec(Math.max((int) Math.ceil(r0.b(this.a)), View.MeasureSpec.getSize(i2)), mode2);
|
||
|
}
|
||
|
super.onMeasure(i, i2);
|
||
|
return;
|
||
|
}
|
||
|
super.onMeasure(i, i2);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void setMinimumWidth(int i) {
|
||
|
this.i = i;
|
||
|
super.setMinimumWidth(i);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void setMinimumHeight(int i) {
|
||
|
this.h = i;
|
||
|
super.setMinimumHeight(i);
|
||
|
}
|
||
|
|
||
|
public void setCardBackgroundColor(int i) {
|
||
|
e.kn_(this.a, ColorStateList.valueOf(i));
|
||
|
}
|
||
|
|
||
|
public void setCardBackgroundColor(ColorStateList colorStateList) {
|
||
|
e.kn_(this.a, colorStateList);
|
||
|
}
|
||
|
|
||
|
public ColorStateList In_() {
|
||
|
return e.kl_(this.a);
|
||
|
}
|
||
|
|
||
|
public int r_() {
|
||
|
return this.b.left;
|
||
|
}
|
||
|
|
||
|
public int s_() {
|
||
|
return this.b.right;
|
||
|
}
|
||
|
|
||
|
public int t_() {
|
||
|
return this.b.top;
|
||
|
}
|
||
|
|
||
|
public int q_() {
|
||
|
return this.b.bottom;
|
||
|
}
|
||
|
|
||
|
public void setRadius(float f2) {
|
||
|
e.b(this.a, f2);
|
||
|
}
|
||
|
|
||
|
public float f() {
|
||
|
return e.g(this.a);
|
||
|
}
|
||
|
|
||
|
public void setCardElevation(float f2) {
|
||
|
e.e(this.a, f2);
|
||
|
}
|
||
|
|
||
|
public void setMaxCardElevation(float f2) {
|
||
|
e.a(this.a, f2);
|
||
|
}
|
||
|
|
||
|
public void setPreventCornerOverlap(boolean z) {
|
||
|
if (z != this.d) {
|
||
|
this.d = z;
|
||
|
e.i(this.a);
|
||
|
}
|
||
|
}
|
||
|
}
|