Initial commit
This commit is contained in:
363
sources/com/google/android/material/button/MaterialButton.java
Normal file
363
sources/com/google/android/material/button/MaterialButton.java
Normal file
@@ -0,0 +1,363 @@
|
||||
package com.google.android.material.button;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import com.google.android.material.R$attr;
|
||||
import com.google.android.material.R$style;
|
||||
import com.google.android.material.R$styleable;
|
||||
import com.google.android.material.internal.ThemeEnforcement;
|
||||
import com.google.android.material.internal.ViewUtils;
|
||||
import com.google.android.material.resources.MaterialResources;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MaterialButton extends AppCompatButton {
|
||||
private final MaterialButtonHelper c;
|
||||
private int d;
|
||||
private PorterDuff.Mode e;
|
||||
private ColorStateList f;
|
||||
private Drawable g;
|
||||
private int h;
|
||||
private int i;
|
||||
private int j;
|
||||
|
||||
public MaterialButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.materialButtonStyle);
|
||||
}
|
||||
|
||||
private boolean a() {
|
||||
return ViewCompat.k(this) == 1;
|
||||
}
|
||||
|
||||
private boolean b() {
|
||||
MaterialButtonHelper materialButtonHelper = this.c;
|
||||
return (materialButtonHelper == null || materialButtonHelper.g()) ? false : true;
|
||||
}
|
||||
|
||||
private void c() {
|
||||
Drawable drawable = this.g;
|
||||
if (drawable != null) {
|
||||
this.g = drawable.mutate();
|
||||
DrawableCompat.a(this.g, this.f);
|
||||
PorterDuff.Mode mode = this.e;
|
||||
if (mode != null) {
|
||||
DrawableCompat.a(this.g, mode);
|
||||
}
|
||||
int i = this.h;
|
||||
if (i == 0) {
|
||||
i = this.g.getIntrinsicWidth();
|
||||
}
|
||||
int i2 = this.h;
|
||||
if (i2 == 0) {
|
||||
i2 = this.g.getIntrinsicHeight();
|
||||
}
|
||||
Drawable drawable2 = this.g;
|
||||
int i3 = this.i;
|
||||
drawable2.setBounds(i3, 0, i + i3, i2);
|
||||
}
|
||||
TextViewCompat.a(this, this.g, null, null, null);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public ColorStateList getBackgroundTintList() {
|
||||
return getSupportBackgroundTintList();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public PorterDuff.Mode getBackgroundTintMode() {
|
||||
return getSupportBackgroundTintMode();
|
||||
}
|
||||
|
||||
public int getCornerRadius() {
|
||||
if (b()) {
|
||||
return this.c.a();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Drawable getIcon() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public int getIconGravity() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public int getIconPadding() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public int getIconSize() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public ColorStateList getIconTint() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public PorterDuff.Mode getIconTintMode() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public ColorStateList getRippleColor() {
|
||||
if (b()) {
|
||||
return this.c.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ColorStateList getStrokeColor() {
|
||||
if (b()) {
|
||||
return this.c.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getStrokeWidth() {
|
||||
if (b()) {
|
||||
return this.c.d();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatButton, androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
return b() ? this.c.e() : super.getSupportBackgroundTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatButton, androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
return b() ? this.c.f() : super.getSupportBackgroundTintMode();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (Build.VERSION.SDK_INT >= 21 || !b()) {
|
||||
return;
|
||||
}
|
||||
this.c.a(canvas);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatButton, android.widget.TextView, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
MaterialButtonHelper materialButtonHelper;
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
if (Build.VERSION.SDK_INT != 21 || (materialButtonHelper = this.c) == null) {
|
||||
return;
|
||||
}
|
||||
materialButtonHelper.a(i4 - i2, i3 - i);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
if (this.g == null || this.j != 2) {
|
||||
return;
|
||||
}
|
||||
int measureText = (int) getPaint().measureText(getText().toString());
|
||||
int i3 = this.h;
|
||||
if (i3 == 0) {
|
||||
i3 = this.g.getIntrinsicWidth();
|
||||
}
|
||||
int measuredWidth = (((((getMeasuredWidth() - measureText) - ViewCompat.n(this)) - i3) - this.d) - ViewCompat.o(this)) / 2;
|
||||
if (a()) {
|
||||
measuredWidth = -measuredWidth;
|
||||
}
|
||||
if (this.i != measuredWidth) {
|
||||
this.i = measuredWidth;
|
||||
c();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackground(Drawable drawable) {
|
||||
setBackgroundDrawable(drawable);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundColor(int i) {
|
||||
if (b()) {
|
||||
this.c.a(i);
|
||||
} else {
|
||||
super.setBackgroundColor(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatButton, android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
if (!b()) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
} else {
|
||||
if (drawable == getBackground()) {
|
||||
getBackground().setState(drawable.getState());
|
||||
return;
|
||||
}
|
||||
Log.i("MaterialButton", "Setting a custom background is not supported.");
|
||||
this.c.h();
|
||||
super.setBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatButton, android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
setBackgroundDrawable(i != 0 ? AppCompatResources.c(getContext(), i) : null);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundTintList(ColorStateList colorStateList) {
|
||||
setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
|
||||
public void setCornerRadius(int i) {
|
||||
if (b()) {
|
||||
this.c.b(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCornerRadiusResource(int i) {
|
||||
if (b()) {
|
||||
setCornerRadius(getResources().getDimensionPixelSize(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void setIcon(Drawable drawable) {
|
||||
if (this.g != drawable) {
|
||||
this.g = drawable;
|
||||
c();
|
||||
}
|
||||
}
|
||||
|
||||
public void setIconGravity(int i) {
|
||||
this.j = i;
|
||||
}
|
||||
|
||||
public void setIconPadding(int i) {
|
||||
if (this.d != i) {
|
||||
this.d = i;
|
||||
setCompoundDrawablePadding(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void setIconResource(int i) {
|
||||
setIcon(i != 0 ? AppCompatResources.c(getContext(), i) : null);
|
||||
}
|
||||
|
||||
public void setIconSize(int i) {
|
||||
if (i < 0) {
|
||||
throw new IllegalArgumentException("iconSize cannot be less than 0");
|
||||
}
|
||||
if (this.h != i) {
|
||||
this.h = i;
|
||||
c();
|
||||
}
|
||||
}
|
||||
|
||||
public void setIconTint(ColorStateList colorStateList) {
|
||||
if (this.f != colorStateList) {
|
||||
this.f = colorStateList;
|
||||
c();
|
||||
}
|
||||
}
|
||||
|
||||
public void setIconTintMode(PorterDuff.Mode mode) {
|
||||
if (this.e != mode) {
|
||||
this.e = mode;
|
||||
c();
|
||||
}
|
||||
}
|
||||
|
||||
public void setIconTintResource(int i) {
|
||||
setIconTint(AppCompatResources.b(getContext(), i));
|
||||
}
|
||||
|
||||
void setInternalBackground(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
}
|
||||
|
||||
public void setRippleColor(ColorStateList colorStateList) {
|
||||
if (b()) {
|
||||
this.c.a(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRippleColorResource(int i) {
|
||||
if (b()) {
|
||||
setRippleColor(AppCompatResources.b(getContext(), i));
|
||||
}
|
||||
}
|
||||
|
||||
public void setStrokeColor(ColorStateList colorStateList) {
|
||||
if (b()) {
|
||||
this.c.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStrokeColorResource(int i) {
|
||||
if (b()) {
|
||||
setStrokeColor(AppCompatResources.b(getContext(), i));
|
||||
}
|
||||
}
|
||||
|
||||
public void setStrokeWidth(int i) {
|
||||
if (b()) {
|
||||
this.c.c(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStrokeWidthResource(int i) {
|
||||
if (b()) {
|
||||
setStrokeWidth(getResources().getDimensionPixelSize(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatButton, androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
if (b()) {
|
||||
this.c.c(colorStateList);
|
||||
} else if (this.c != null) {
|
||||
super.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatButton, androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
if (b()) {
|
||||
this.c.a(mode);
|
||||
} else if (this.c != null) {
|
||||
super.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
public MaterialButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
TypedArray c = ThemeEnforcement.c(context, attributeSet, R$styleable.MaterialButton, i, R$style.Widget_MaterialComponents_Button, new int[0]);
|
||||
this.d = c.getDimensionPixelSize(R$styleable.MaterialButton_iconPadding, 0);
|
||||
this.e = ViewUtils.a(c.getInt(R$styleable.MaterialButton_iconTintMode, -1), PorterDuff.Mode.SRC_IN);
|
||||
this.f = MaterialResources.a(getContext(), c, R$styleable.MaterialButton_iconTint);
|
||||
this.g = MaterialResources.b(getContext(), c, R$styleable.MaterialButton_icon);
|
||||
this.j = c.getInteger(R$styleable.MaterialButton_iconGravity, 1);
|
||||
this.h = c.getDimensionPixelSize(R$styleable.MaterialButton_iconSize, 0);
|
||||
this.c = new MaterialButtonHelper(this);
|
||||
this.c.a(c);
|
||||
c.recycle();
|
||||
setCompoundDrawablePadding(this.d);
|
||||
c();
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.google.android.material.button;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
|
||||
@TargetApi(21)
|
||||
/* loaded from: classes.dex */
|
||||
class MaterialButtonBackgroundDrawable extends RippleDrawable {
|
||||
MaterialButtonBackgroundDrawable(ColorStateList colorStateList, InsetDrawable insetDrawable, Drawable drawable) {
|
||||
super(colorStateList, insetDrawable, drawable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.LayerDrawable, android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
if (getDrawable(0) != null) {
|
||||
((GradientDrawable) ((LayerDrawable) ((InsetDrawable) getDrawable(0)).getDrawable()).getDrawable(0)).setColorFilter(colorFilter);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,310 @@
|
||||
package com.google.android.material.button;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.os.Build;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.google.android.material.R$styleable;
|
||||
import com.google.android.material.internal.ViewUtils;
|
||||
import com.google.android.material.resources.MaterialResources;
|
||||
import com.google.android.material.ripple.RippleUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class MaterialButtonHelper {
|
||||
private static final boolean w;
|
||||
private final MaterialButton a;
|
||||
private int b;
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private int g;
|
||||
private PorterDuff.Mode h;
|
||||
private ColorStateList i;
|
||||
private ColorStateList j;
|
||||
private ColorStateList k;
|
||||
private GradientDrawable o;
|
||||
private Drawable p;
|
||||
private GradientDrawable q;
|
||||
private Drawable r;
|
||||
private GradientDrawable s;
|
||||
private GradientDrawable t;
|
||||
private GradientDrawable u;
|
||||
private final Paint l = new Paint(1);
|
||||
private final Rect m = new Rect();
|
||||
private final RectF n = new RectF();
|
||||
private boolean v = false;
|
||||
|
||||
static {
|
||||
w = Build.VERSION.SDK_INT >= 21;
|
||||
}
|
||||
|
||||
public MaterialButtonHelper(MaterialButton materialButton) {
|
||||
this.a = materialButton;
|
||||
}
|
||||
|
||||
private Drawable i() {
|
||||
this.o = new GradientDrawable();
|
||||
this.o.setCornerRadius(this.f + 1.0E-5f);
|
||||
this.o.setColor(-1);
|
||||
this.p = DrawableCompat.h(this.o);
|
||||
DrawableCompat.a(this.p, this.i);
|
||||
PorterDuff.Mode mode = this.h;
|
||||
if (mode != null) {
|
||||
DrawableCompat.a(this.p, mode);
|
||||
}
|
||||
this.q = new GradientDrawable();
|
||||
this.q.setCornerRadius(this.f + 1.0E-5f);
|
||||
this.q.setColor(-1);
|
||||
this.r = DrawableCompat.h(this.q);
|
||||
DrawableCompat.a(this.r, this.k);
|
||||
return a(new LayerDrawable(new Drawable[]{this.p, this.r}));
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private Drawable j() {
|
||||
this.s = new GradientDrawable();
|
||||
this.s.setCornerRadius(this.f + 1.0E-5f);
|
||||
this.s.setColor(-1);
|
||||
n();
|
||||
this.t = new GradientDrawable();
|
||||
this.t.setCornerRadius(this.f + 1.0E-5f);
|
||||
this.t.setColor(0);
|
||||
this.t.setStroke(this.g, this.j);
|
||||
InsetDrawable a = a(new LayerDrawable(new Drawable[]{this.s, this.t}));
|
||||
this.u = new GradientDrawable();
|
||||
this.u.setCornerRadius(this.f + 1.0E-5f);
|
||||
this.u.setColor(-1);
|
||||
return new MaterialButtonBackgroundDrawable(RippleUtils.a(this.k), a, this.u);
|
||||
}
|
||||
|
||||
private GradientDrawable k() {
|
||||
if (!w || this.a.getBackground() == null) {
|
||||
return null;
|
||||
}
|
||||
return (GradientDrawable) ((LayerDrawable) ((InsetDrawable) ((RippleDrawable) this.a.getBackground()).getDrawable(0)).getDrawable()).getDrawable(0);
|
||||
}
|
||||
|
||||
private GradientDrawable l() {
|
||||
if (!w || this.a.getBackground() == null) {
|
||||
return null;
|
||||
}
|
||||
return (GradientDrawable) ((LayerDrawable) ((InsetDrawable) ((RippleDrawable) this.a.getBackground()).getDrawable(0)).getDrawable()).getDrawable(1);
|
||||
}
|
||||
|
||||
private void m() {
|
||||
if (w && this.t != null) {
|
||||
this.a.setInternalBackground(j());
|
||||
} else {
|
||||
if (w) {
|
||||
return;
|
||||
}
|
||||
this.a.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void n() {
|
||||
GradientDrawable gradientDrawable = this.s;
|
||||
if (gradientDrawable != null) {
|
||||
DrawableCompat.a(gradientDrawable, this.i);
|
||||
PorterDuff.Mode mode = this.h;
|
||||
if (mode != null) {
|
||||
DrawableCompat.a(this.s, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(TypedArray typedArray) {
|
||||
this.b = typedArray.getDimensionPixelOffset(R$styleable.MaterialButton_android_insetLeft, 0);
|
||||
this.c = typedArray.getDimensionPixelOffset(R$styleable.MaterialButton_android_insetRight, 0);
|
||||
this.d = typedArray.getDimensionPixelOffset(R$styleable.MaterialButton_android_insetTop, 0);
|
||||
this.e = typedArray.getDimensionPixelOffset(R$styleable.MaterialButton_android_insetBottom, 0);
|
||||
this.f = typedArray.getDimensionPixelSize(R$styleable.MaterialButton_cornerRadius, 0);
|
||||
this.g = typedArray.getDimensionPixelSize(R$styleable.MaterialButton_strokeWidth, 0);
|
||||
this.h = ViewUtils.a(typedArray.getInt(R$styleable.MaterialButton_backgroundTintMode, -1), PorterDuff.Mode.SRC_IN);
|
||||
this.i = MaterialResources.a(this.a.getContext(), typedArray, R$styleable.MaterialButton_backgroundTint);
|
||||
this.j = MaterialResources.a(this.a.getContext(), typedArray, R$styleable.MaterialButton_strokeColor);
|
||||
this.k = MaterialResources.a(this.a.getContext(), typedArray, R$styleable.MaterialButton_rippleColor);
|
||||
this.l.setStyle(Paint.Style.STROKE);
|
||||
this.l.setStrokeWidth(this.g);
|
||||
Paint paint = this.l;
|
||||
ColorStateList colorStateList = this.j;
|
||||
paint.setColor(colorStateList != null ? colorStateList.getColorForState(this.a.getDrawableState(), 0) : 0);
|
||||
int o = ViewCompat.o(this.a);
|
||||
int paddingTop = this.a.getPaddingTop();
|
||||
int n = ViewCompat.n(this.a);
|
||||
int paddingBottom = this.a.getPaddingBottom();
|
||||
this.a.setInternalBackground(w ? j() : i());
|
||||
ViewCompat.a(this.a, o + this.b, paddingTop + this.d, n + this.c, paddingBottom + this.e);
|
||||
}
|
||||
|
||||
ColorStateList b() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
void c(ColorStateList colorStateList) {
|
||||
if (this.i != colorStateList) {
|
||||
this.i = colorStateList;
|
||||
if (w) {
|
||||
n();
|
||||
return;
|
||||
}
|
||||
Drawable drawable = this.p;
|
||||
if (drawable != null) {
|
||||
DrawableCompat.a(drawable, this.i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int d() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
ColorStateList e() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
PorterDuff.Mode f() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
boolean g() {
|
||||
return this.v;
|
||||
}
|
||||
|
||||
void h() {
|
||||
this.v = true;
|
||||
this.a.setSupportBackgroundTintList(this.i);
|
||||
this.a.setSupportBackgroundTintMode(this.h);
|
||||
}
|
||||
|
||||
void b(ColorStateList colorStateList) {
|
||||
if (this.j != colorStateList) {
|
||||
this.j = colorStateList;
|
||||
this.l.setColor(colorStateList != null ? colorStateList.getColorForState(this.a.getDrawableState(), 0) : 0);
|
||||
m();
|
||||
}
|
||||
}
|
||||
|
||||
ColorStateList c() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
void b(int i) {
|
||||
GradientDrawable gradientDrawable;
|
||||
if (this.f != i) {
|
||||
this.f = i;
|
||||
if (w && this.s != null && this.t != null && this.u != null) {
|
||||
if (Build.VERSION.SDK_INT == 21) {
|
||||
float f = i + 1.0E-5f;
|
||||
k().setCornerRadius(f);
|
||||
l().setCornerRadius(f);
|
||||
}
|
||||
float f2 = i + 1.0E-5f;
|
||||
this.s.setCornerRadius(f2);
|
||||
this.t.setCornerRadius(f2);
|
||||
this.u.setCornerRadius(f2);
|
||||
return;
|
||||
}
|
||||
if (w || (gradientDrawable = this.o) == null || this.q == null) {
|
||||
return;
|
||||
}
|
||||
float f3 = i + 1.0E-5f;
|
||||
gradientDrawable.setCornerRadius(f3);
|
||||
this.q.setCornerRadius(f3);
|
||||
this.a.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void c(int i) {
|
||||
if (this.g != i) {
|
||||
this.g = i;
|
||||
this.l.setStrokeWidth(i);
|
||||
m();
|
||||
}
|
||||
}
|
||||
|
||||
void a(Canvas canvas) {
|
||||
if (canvas == null || this.j == null || this.g <= 0) {
|
||||
return;
|
||||
}
|
||||
this.m.set(this.a.getBackground().getBounds());
|
||||
RectF rectF = this.n;
|
||||
float f = this.m.left;
|
||||
int i = this.g;
|
||||
rectF.set(f + (i / 2.0f) + this.b, r1.top + (i / 2.0f) + this.d, (r1.right - (i / 2.0f)) - this.c, (r1.bottom - (i / 2.0f)) - this.e);
|
||||
float f2 = this.f - (this.g / 2.0f);
|
||||
canvas.drawRoundRect(this.n, f2, f2, this.l);
|
||||
}
|
||||
|
||||
private InsetDrawable a(Drawable drawable) {
|
||||
return new InsetDrawable(drawable, this.b, this.d, this.c, this.e);
|
||||
}
|
||||
|
||||
void a(PorterDuff.Mode mode) {
|
||||
PorterDuff.Mode mode2;
|
||||
if (this.h != mode) {
|
||||
this.h = mode;
|
||||
if (w) {
|
||||
n();
|
||||
return;
|
||||
}
|
||||
Drawable drawable = this.p;
|
||||
if (drawable == null || (mode2 = this.h) == null) {
|
||||
return;
|
||||
}
|
||||
DrawableCompat.a(drawable, mode2);
|
||||
}
|
||||
}
|
||||
|
||||
void a(int i, int i2) {
|
||||
GradientDrawable gradientDrawable = this.u;
|
||||
if (gradientDrawable != null) {
|
||||
gradientDrawable.setBounds(this.b, this.d, i2 - this.c, i - this.e);
|
||||
}
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
GradientDrawable gradientDrawable;
|
||||
GradientDrawable gradientDrawable2;
|
||||
if (w && (gradientDrawable2 = this.s) != null) {
|
||||
gradientDrawable2.setColor(i);
|
||||
} else {
|
||||
if (w || (gradientDrawable = this.o) == null) {
|
||||
return;
|
||||
}
|
||||
gradientDrawable.setColor(i);
|
||||
}
|
||||
}
|
||||
|
||||
void a(ColorStateList colorStateList) {
|
||||
Drawable drawable;
|
||||
if (this.k != colorStateList) {
|
||||
this.k = colorStateList;
|
||||
if (w && (this.a.getBackground() instanceof RippleDrawable)) {
|
||||
((RippleDrawable) this.a.getBackground()).setColor(colorStateList);
|
||||
} else {
|
||||
if (w || (drawable = this.r) == null) {
|
||||
return;
|
||||
}
|
||||
DrawableCompat.a(drawable, colorStateList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int a() {
|
||||
return this.f;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user