Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
package com.google.android.material.internal;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/* loaded from: classes.dex */
public class BaselineLayout extends ViewGroup {
private int a;
public BaselineLayout(Context context) {
super(context, null, 0);
this.a = -1;
}
@Override // android.view.View
public int getBaseline() {
return this.a;
}
@Override // android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
int childCount = getChildCount();
int paddingLeft = getPaddingLeft();
int paddingRight = ((i3 - i) - getPaddingRight()) - paddingLeft;
int paddingTop = getPaddingTop();
for (int i5 = 0; i5 < childCount; i5++) {
View childAt = getChildAt(i5);
if (childAt.getVisibility() != 8) {
int measuredWidth = childAt.getMeasuredWidth();
int measuredHeight = childAt.getMeasuredHeight();
int i6 = ((paddingRight - measuredWidth) / 2) + paddingLeft;
int baseline = (this.a == -1 || childAt.getBaseline() == -1) ? paddingTop : (this.a + paddingTop) - childAt.getBaseline();
childAt.layout(i6, baseline, measuredWidth + i6, measuredHeight + baseline);
}
}
}
@Override // android.view.View
protected void onMeasure(int i, int i2) {
int childCount = getChildCount();
int i3 = -1;
int i4 = -1;
int i5 = 0;
int i6 = 0;
int i7 = 0;
for (int i8 = 0; i8 < childCount; i8++) {
View childAt = getChildAt(i8);
if (childAt.getVisibility() != 8) {
measureChild(childAt, i, i2);
int baseline = childAt.getBaseline();
if (baseline != -1) {
i3 = Math.max(i3, baseline);
i4 = Math.max(i4, childAt.getMeasuredHeight() - baseline);
}
i6 = Math.max(i6, childAt.getMeasuredWidth());
i5 = Math.max(i5, childAt.getMeasuredHeight());
i7 = View.combineMeasuredStates(i7, childAt.getMeasuredState());
}
}
if (i3 != -1) {
i5 = Math.max(i5, Math.max(i4, getPaddingBottom()) + i3);
this.a = i3;
}
setMeasuredDimension(View.resolveSizeAndState(Math.max(i6, getSuggestedMinimumWidth()), i, i7), View.resolveSizeAndState(Math.max(i5, getSuggestedMinimumHeight()), i2, i7 << 16));
}
public BaselineLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet, 0);
this.a = -1;
}
public BaselineLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.a = -1;
}
}

View File

@@ -0,0 +1,70 @@
package com.google.android.material.internal;
import android.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Checkable;
import android.widget.ImageButton;
import androidx.appcompat.R$attr;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
/* loaded from: classes.dex */
public class CheckableImageButton extends AppCompatImageButton implements Checkable {
private static final int[] d = {R.attr.state_checked};
private boolean c;
public CheckableImageButton(Context context) {
this(context, null);
}
@Override // android.widget.Checkable
public boolean isChecked() {
return this.c;
}
@Override // android.widget.ImageView, android.view.View
public int[] onCreateDrawableState(int i) {
return this.c ? ImageButton.mergeDrawableStates(super.onCreateDrawableState(i + d.length), d) : super.onCreateDrawableState(i);
}
@Override // android.widget.Checkable
public void setChecked(boolean z) {
if (this.c != z) {
this.c = z;
refreshDrawableState();
sendAccessibilityEvent(2048);
}
}
@Override // android.widget.Checkable
public void toggle() {
setChecked(!this.c);
}
public CheckableImageButton(Context context, AttributeSet attributeSet) {
this(context, attributeSet, R$attr.imageButtonStyle);
}
public CheckableImageButton(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
ViewCompat.a(this, new AccessibilityDelegateCompat() { // from class: com.google.android.material.internal.CheckableImageButton.1
@Override // androidx.core.view.AccessibilityDelegateCompat
public void a(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
super.a(view, accessibilityNodeInfoCompat);
accessibilityNodeInfoCompat.a(true);
accessibilityNodeInfoCompat.b(CheckableImageButton.this.isChecked());
}
@Override // androidx.core.view.AccessibilityDelegateCompat
public void b(View view, AccessibilityEvent accessibilityEvent) {
super.b(view, accessibilityEvent);
accessibilityEvent.setChecked(CheckableImageButton.this.isChecked());
}
});
}
}

View File

@@ -0,0 +1,15 @@
package com.google.android.material.internal;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
/* loaded from: classes.dex */
public class CircularBorderDrawable extends Drawable {
public final void a(float f) {
throw null;
}
public void a(ColorStateList colorStateList) {
throw null;
}
}

View File

@@ -0,0 +1,562 @@
package com.google.android.material.internal;
import android.R;
import android.animation.TimeInterpolator;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.os.Build;
import android.text.TextPaint;
import android.text.TextUtils;
import android.view.View;
import androidx.appcompat.R$styleable;
import androidx.appcompat.widget.TintTypedArray;
import androidx.core.math.MathUtils;
import androidx.core.text.TextDirectionHeuristicsCompat;
import androidx.core.view.GravityCompat;
import androidx.core.view.ViewCompat;
import com.google.android.material.animation.AnimationUtils;
/* loaded from: classes.dex */
public final class CollapsingTextHelper {
private static final boolean T;
private static final Paint U;
private Paint A;
private float B;
private float C;
private float D;
private float E;
private int[] F;
private boolean G;
private TimeInterpolator J;
private TimeInterpolator K;
private float L;
private float M;
private float N;
private int O;
private float P;
private float Q;
private float R;
private int S;
private final View a;
private boolean b;
private float c;
private ColorStateList k;
private ColorStateList l;
private float m;
private float n;
private float o;
private float p;
private float q;
private float r;
private Typeface s;
private Typeface t;
private Typeface u;
private CharSequence v;
private CharSequence w;
private boolean x;
private boolean y;
private Bitmap z;
private int g = 16;
private int h = 16;
private float i = 15.0f;
private float j = 15.0f;
private final TextPaint H = new TextPaint(129);
private final TextPaint I = new TextPaint(this.H);
private final Rect e = new Rect();
private final Rect d = new Rect();
private final RectF f = new RectF();
static {
T = Build.VERSION.SDK_INT < 18;
U = null;
Paint paint = U;
if (paint != null) {
paint.setAntiAlias(true);
U.setColor(-65281);
}
}
public CollapsingTextHelper(View view) {
this.a = view;
}
private Typeface e(int i) {
TypedArray obtainStyledAttributes = this.a.getContext().obtainStyledAttributes(i, new int[]{R.attr.fontFamily});
try {
String string = obtainStyledAttributes.getString(0);
if (string != null) {
return Typeface.create(string, 0);
}
obtainStyledAttributes.recycle();
return null;
} finally {
obtainStyledAttributes.recycle();
}
}
private void n() {
float f = this.E;
d(this.j);
CharSequence charSequence = this.w;
float measureText = charSequence != null ? this.H.measureText(charSequence, 0, charSequence.length()) : 0.0f;
int a = GravityCompat.a(this.h, this.x ? 1 : 0);
int i = a & 112;
if (i == 48) {
this.n = this.e.top - this.H.ascent();
} else if (i != 80) {
this.n = this.e.centerY() + (((this.H.descent() - this.H.ascent()) / 2.0f) - this.H.descent());
} else {
this.n = this.e.bottom;
}
int i2 = a & 8388615;
if (i2 == 1) {
this.p = this.e.centerX() - (measureText / 2.0f);
} else if (i2 != 5) {
this.p = this.e.left;
} else {
this.p = this.e.right - measureText;
}
d(this.i);
CharSequence charSequence2 = this.w;
float measureText2 = charSequence2 != null ? this.H.measureText(charSequence2, 0, charSequence2.length()) : 0.0f;
int a2 = GravityCompat.a(this.g, this.x ? 1 : 0);
int i3 = a2 & 112;
if (i3 == 48) {
this.m = this.d.top - this.H.ascent();
} else if (i3 != 80) {
this.m = this.d.centerY() + (((this.H.descent() - this.H.ascent()) / 2.0f) - this.H.descent());
} else {
this.m = this.d.bottom;
}
int i4 = a2 & 8388615;
if (i4 == 1) {
this.o = this.d.centerX() - (measureText2 / 2.0f);
} else if (i4 != 5) {
this.o = this.d.left;
} else {
this.o = this.d.right - measureText2;
}
p();
f(f);
}
private void o() {
c(this.c);
}
private void p() {
Bitmap bitmap = this.z;
if (bitmap != null) {
bitmap.recycle();
this.z = null;
}
}
private void q() {
if (this.z != null || this.d.isEmpty() || TextUtils.isEmpty(this.w)) {
return;
}
c(0.0f);
this.B = this.H.ascent();
this.C = this.H.descent();
TextPaint textPaint = this.H;
CharSequence charSequence = this.w;
int round = Math.round(textPaint.measureText(charSequence, 0, charSequence.length()));
int round2 = Math.round(this.C - this.B);
if (round <= 0 || round2 <= 0) {
return;
}
this.z = Bitmap.createBitmap(round, round2, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(this.z);
CharSequence charSequence2 = this.w;
canvas.drawText(charSequence2, 0, charSequence2.length(), 0.0f, round2 - this.H.descent(), this.H);
if (this.A == null) {
this.A = new Paint(3);
}
}
private int r() {
int[] iArr = this.F;
return iArr != null ? this.k.getColorForState(iArr, 0) : this.k.getDefaultColor();
}
public void a(TimeInterpolator timeInterpolator) {
this.J = timeInterpolator;
m();
}
public void b(TimeInterpolator timeInterpolator) {
this.K = timeInterpolator;
m();
}
public int c() {
return this.h;
}
public float d() {
a(this.I);
return -this.I.ascent();
}
public int f() {
int[] iArr = this.F;
return iArr != null ? this.l.getColorForState(iArr, 0) : this.l.getDefaultColor();
}
public int g() {
return this.g;
}
public Typeface h() {
Typeface typeface = this.t;
return typeface != null ? typeface : Typeface.DEFAULT;
}
public float i() {
return this.c;
}
public CharSequence j() {
return this.v;
}
public final boolean k() {
ColorStateList colorStateList;
ColorStateList colorStateList2 = this.l;
return (colorStateList2 != null && colorStateList2.isStateful()) || ((colorStateList = this.k) != null && colorStateList.isStateful());
}
void l() {
this.b = this.e.width() > 0 && this.e.height() > 0 && this.d.width() > 0 && this.d.height() > 0;
}
public void m() {
if (this.a.getHeight() <= 0 || this.a.getWidth() <= 0) {
return;
}
n();
o();
}
public void c(int i) {
TintTypedArray a = TintTypedArray.a(this.a.getContext(), i, R$styleable.TextAppearance);
if (a.g(R$styleable.TextAppearance_android_textColor)) {
this.k = a.a(R$styleable.TextAppearance_android_textColor);
}
if (a.g(R$styleable.TextAppearance_android_textSize)) {
this.i = a.c(R$styleable.TextAppearance_android_textSize, (int) this.i);
}
this.S = a.d(R$styleable.TextAppearance_android_shadowColor, 0);
this.Q = a.b(R$styleable.TextAppearance_android_shadowDx, 0.0f);
this.R = a.b(R$styleable.TextAppearance_android_shadowDy, 0.0f);
this.P = a.b(R$styleable.TextAppearance_android_shadowRadius, 0.0f);
a.a();
if (Build.VERSION.SDK_INT >= 16) {
this.t = e(i);
}
m();
}
public void a(float f) {
if (this.i != f) {
this.i = f;
m();
}
}
public void b(ColorStateList colorStateList) {
if (this.k != colorStateList) {
this.k = colorStateList;
m();
}
}
public void d(int i) {
if (this.g != i) {
this.g = i;
m();
}
}
private void f(float f) {
d(f);
this.y = T && this.D != 1.0f;
if (this.y) {
q();
}
ViewCompat.A(this.a);
}
private void d(float f) {
float f2;
boolean z;
boolean z2;
if (this.v == null) {
return;
}
float width = this.e.width();
float width2 = this.d.width();
if (a(f, this.j)) {
float f3 = this.j;
this.D = 1.0f;
Typeface typeface = this.u;
Typeface typeface2 = this.s;
if (typeface != typeface2) {
this.u = typeface2;
z2 = true;
} else {
z2 = false;
}
f2 = f3;
z = z2;
} else {
f2 = this.i;
Typeface typeface3 = this.u;
Typeface typeface4 = this.t;
if (typeface3 != typeface4) {
this.u = typeface4;
z = true;
} else {
z = false;
}
if (a(f, this.i)) {
this.D = 1.0f;
} else {
this.D = f / this.i;
}
float f4 = this.j / this.i;
width = width2 * f4 > width ? Math.min(width / f4, width2) : width2;
}
if (width > 0.0f) {
z = this.E != f2 || this.G || z;
this.E = f2;
this.G = false;
}
if (this.w == null || z) {
this.H.setTextSize(this.E);
this.H.setTypeface(this.u);
this.H.setLinearText(this.D != 1.0f);
CharSequence ellipsize = TextUtils.ellipsize(this.v, this.H, width, TextUtils.TruncateAt.END);
if (TextUtils.equals(ellipsize, this.w)) {
return;
}
this.w = ellipsize;
this.x = b(this.w);
}
}
public void a(ColorStateList colorStateList) {
if (this.l != colorStateList) {
this.l = colorStateList;
m();
}
}
public void b(int i, int i2, int i3, int i4) {
if (a(this.d, i, i2, i3, i4)) {
return;
}
this.d.set(i, i2, i3, i4);
this.G = true;
l();
}
public Typeface e() {
Typeface typeface = this.s;
return typeface != null ? typeface : Typeface.DEFAULT;
}
private void e(float f) {
this.f.left = a(this.d.left, this.e.left, f, this.J);
this.f.top = a(this.m, this.n, f, this.J);
this.f.right = a(this.d.right, this.e.right, f, this.J);
this.f.bottom = a(this.d.bottom, this.e.bottom, f, this.J);
}
public void a(int i, int i2, int i3, int i4) {
if (a(this.e, i, i2, i3, i4)) {
return;
}
this.e.set(i, i2, i3, i4);
this.G = true;
l();
}
public void b(int i) {
if (this.h != i) {
this.h = i;
m();
}
}
public float a() {
if (this.v == null) {
return 0.0f;
}
a(this.I);
TextPaint textPaint = this.I;
CharSequence charSequence = this.v;
return textPaint.measureText(charSequence, 0, charSequence.length());
}
public void b(Typeface typeface) {
if (this.t != typeface) {
this.t = typeface;
m();
}
}
public void a(RectF rectF) {
boolean b = b(this.v);
Rect rect = this.e;
rectF.left = !b ? rect.left : rect.right - a();
Rect rect2 = this.e;
rectF.top = rect2.top;
rectF.right = !b ? rectF.left + a() : rect2.right;
rectF.bottom = this.e.top + d();
}
public void b(float f) {
float a = MathUtils.a(f, 0.0f, 1.0f);
if (a != this.c) {
this.c = a;
o();
}
}
private boolean b(CharSequence charSequence) {
return (ViewCompat.k(this.a) == 1 ? TextDirectionHeuristicsCompat.b : TextDirectionHeuristicsCompat.a).a(charSequence, 0, charSequence.length());
}
private void a(TextPaint textPaint) {
textPaint.setTextSize(this.j);
textPaint.setTypeface(this.s);
}
public void c(Typeface typeface) {
this.t = typeface;
this.s = typeface;
m();
}
public void a(int i) {
TintTypedArray a = TintTypedArray.a(this.a.getContext(), i, R$styleable.TextAppearance);
if (a.g(R$styleable.TextAppearance_android_textColor)) {
this.l = a.a(R$styleable.TextAppearance_android_textColor);
}
if (a.g(R$styleable.TextAppearance_android_textSize)) {
this.j = a.c(R$styleable.TextAppearance_android_textSize, (int) this.j);
}
this.O = a.d(R$styleable.TextAppearance_android_shadowColor, 0);
this.M = a.b(R$styleable.TextAppearance_android_shadowDx, 0.0f);
this.N = a.b(R$styleable.TextAppearance_android_shadowDy, 0.0f);
this.L = a.b(R$styleable.TextAppearance_android_shadowRadius, 0.0f);
a.a();
if (Build.VERSION.SDK_INT >= 16) {
this.s = e(i);
}
m();
}
public ColorStateList b() {
return this.l;
}
private void c(float f) {
e(f);
this.q = a(this.o, this.p, f, this.J);
this.r = a(this.m, this.n, f, this.J);
f(a(this.i, this.j, f, this.K));
if (this.l != this.k) {
this.H.setColor(a(r(), f(), f));
} else {
this.H.setColor(f());
}
this.H.setShadowLayer(a(this.P, this.L, f, (TimeInterpolator) null), a(this.Q, this.M, f, (TimeInterpolator) null), a(this.R, this.N, f, (TimeInterpolator) null), a(this.S, this.O, f));
ViewCompat.A(this.a);
}
public void a(Typeface typeface) {
if (this.s != typeface) {
this.s = typeface;
m();
}
}
public final boolean a(int[] iArr) {
this.F = iArr;
if (!k()) {
return false;
}
m();
return true;
}
public void a(Canvas canvas) {
float ascent;
int save = canvas.save();
if (this.w != null && this.b) {
float f = this.q;
float f2 = this.r;
boolean z = this.y && this.z != null;
if (z) {
ascent = this.B * this.D;
} else {
ascent = this.H.ascent() * this.D;
this.H.descent();
}
if (z) {
f2 += ascent;
}
float f3 = f2;
float f4 = this.D;
if (f4 != 1.0f) {
canvas.scale(f4, f4, f, f3);
}
if (z) {
canvas.drawBitmap(this.z, f, f3, this.A);
} else {
CharSequence charSequence = this.w;
canvas.drawText(charSequence, 0, charSequence.length(), f, f3, this.H);
}
}
canvas.restoreToCount(save);
}
public void a(CharSequence charSequence) {
if (charSequence == null || !charSequence.equals(this.v)) {
this.v = charSequence;
this.w = null;
p();
m();
}
}
private static boolean a(float f, float f2) {
return Math.abs(f - f2) < 0.001f;
}
private static int a(int i, int i2, float f) {
float f2 = 1.0f - f;
return Color.argb((int) ((Color.alpha(i) * f2) + (Color.alpha(i2) * f)), (int) ((Color.red(i) * f2) + (Color.red(i2) * f)), (int) ((Color.green(i) * f2) + (Color.green(i2) * f)), (int) ((Color.blue(i) * f2) + (Color.blue(i2) * f)));
}
private static float a(float f, float f2, float f3, TimeInterpolator timeInterpolator) {
if (timeInterpolator != null) {
f3 = timeInterpolator.getInterpolation(f3);
}
return AnimationUtils.a(f, f2, f3);
}
private static boolean a(Rect rect, int i, int i2, int i3, int i4) {
return rect.left == i && rect.top == i2 && rect.right == i3 && rect.bottom == i4;
}
}

View File

@@ -0,0 +1,51 @@
package com.google.android.material.internal;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
/* loaded from: classes.dex */
public class DescendantOffsetUtils {
private static final ThreadLocal<Matrix> a = new ThreadLocal<>();
private static final ThreadLocal<RectF> b = new ThreadLocal<>();
public static void a(ViewGroup viewGroup, View view, Rect rect) {
rect.set(0, 0, view.getWidth(), view.getHeight());
b(viewGroup, view, rect);
}
public static void b(ViewGroup viewGroup, View view, Rect rect) {
Matrix matrix = a.get();
if (matrix == null) {
matrix = new Matrix();
a.set(matrix);
} else {
matrix.reset();
}
a(viewGroup, view, matrix);
RectF rectF = b.get();
if (rectF == null) {
rectF = new RectF();
b.set(rectF);
}
rectF.set(rect);
matrix.mapRect(rectF);
rect.set((int) (rectF.left + 0.5f), (int) (rectF.top + 0.5f), (int) (rectF.right + 0.5f), (int) (rectF.bottom + 0.5f));
}
private static void a(ViewParent viewParent, View view, Matrix matrix) {
Object parent = view.getParent();
if ((parent instanceof View) && parent != viewParent) {
a(viewParent, (View) parent, matrix);
matrix.preTranslate(-r0.getScrollX(), -r0.getScrollY());
}
matrix.preTranslate(view.getLeft(), view.getTop());
if (view.getMatrix().isIdentity()) {
return;
}
matrix.preConcat(view.getMatrix());
}
}

View File

@@ -0,0 +1,38 @@
package com.google.android.material.internal;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer;
import android.util.Log;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public class DrawableUtils {
private static Method a;
private static boolean b;
public static boolean a(DrawableContainer drawableContainer, Drawable.ConstantState constantState) {
return b(drawableContainer, constantState);
}
private static boolean b(DrawableContainer drawableContainer, Drawable.ConstantState constantState) {
if (!b) {
try {
a = DrawableContainer.class.getDeclaredMethod("setConstantState", DrawableContainer.DrawableContainerState.class);
a.setAccessible(true);
} catch (NoSuchMethodException unused) {
Log.e("DrawableUtils", "Could not fetch setConstantState(). Oh well.");
}
b = true;
}
Method method = a;
if (method != null) {
try {
method.invoke(drawableContainer, constantState);
return true;
} catch (Exception unused2) {
Log.e("DrawableUtils", "Could not invoke setConstantState(). Oh well.");
}
}
return false;
}
}

View File

@@ -0,0 +1,169 @@
package com.google.android.material.internal;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
import androidx.appcompat.widget.LinearLayoutCompat;
import com.google.android.material.R$styleable;
/* loaded from: classes.dex */
public class ForegroundLinearLayout extends LinearLayoutCompat {
private Drawable p;
private final Rect q;
private final Rect r;
private int s;
protected boolean t;
boolean u;
public ForegroundLinearLayout(Context context) {
this(context, null);
}
@Override // android.view.View
public void draw(Canvas canvas) {
super.draw(canvas);
Drawable drawable = this.p;
if (drawable != null) {
if (this.u) {
this.u = false;
Rect rect = this.q;
Rect rect2 = this.r;
int right = getRight() - getLeft();
int bottom = getBottom() - getTop();
if (this.t) {
rect.set(0, 0, right, bottom);
} else {
rect.set(getPaddingLeft(), getPaddingTop(), right - getPaddingRight(), bottom - getPaddingBottom());
}
Gravity.apply(this.s, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), rect, rect2);
drawable.setBounds(rect2);
}
drawable.draw(canvas);
}
}
@Override // android.view.View
@TargetApi(21)
public void drawableHotspotChanged(float f, float f2) {
super.drawableHotspotChanged(f, f2);
Drawable drawable = this.p;
if (drawable != null) {
drawable.setHotspot(f, f2);
}
}
@Override // android.view.ViewGroup, android.view.View
protected void drawableStateChanged() {
super.drawableStateChanged();
Drawable drawable = this.p;
if (drawable == null || !drawable.isStateful()) {
return;
}
this.p.setState(getDrawableState());
}
@Override // android.view.View
public Drawable getForeground() {
return this.p;
}
@Override // android.view.View
public int getForegroundGravity() {
return this.s;
}
@Override // android.view.ViewGroup, android.view.View
public void jumpDrawablesToCurrentState() {
super.jumpDrawablesToCurrentState();
Drawable drawable = this.p;
if (drawable != null) {
drawable.jumpToCurrentState();
}
}
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
this.u = z | this.u;
}
@Override // android.view.View
protected void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
this.u = true;
}
@Override // android.view.View
public void setForeground(Drawable drawable) {
Drawable drawable2 = this.p;
if (drawable2 != drawable) {
if (drawable2 != null) {
drawable2.setCallback(null);
unscheduleDrawable(this.p);
}
this.p = drawable;
if (drawable != null) {
setWillNotDraw(false);
drawable.setCallback(this);
if (drawable.isStateful()) {
drawable.setState(getDrawableState());
}
if (this.s == 119) {
drawable.getPadding(new Rect());
}
} else {
setWillNotDraw(true);
}
requestLayout();
invalidate();
}
}
@Override // android.view.View
public void setForegroundGravity(int i) {
if (this.s != i) {
if ((8388615 & i) == 0) {
i |= 8388611;
}
if ((i & 112) == 0) {
i |= 48;
}
this.s = i;
if (this.s == 119 && this.p != null) {
this.p.getPadding(new Rect());
}
requestLayout();
}
}
@Override // android.view.View
protected boolean verifyDrawable(Drawable drawable) {
return super.verifyDrawable(drawable) || drawable == this.p;
}
public ForegroundLinearLayout(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public ForegroundLinearLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.q = new Rect();
this.r = new Rect();
this.s = 119;
this.t = true;
this.u = false;
TypedArray c = ThemeEnforcement.c(context, attributeSet, R$styleable.ForegroundLinearLayout, i, 0, new int[0]);
this.s = c.getInt(R$styleable.ForegroundLinearLayout_android_foregroundGravity, this.s);
Drawable drawable = c.getDrawable(R$styleable.ForegroundLinearLayout_android_foreground);
if (drawable != null) {
setForeground(drawable);
}
this.t = c.getBoolean(R$styleable.ForegroundLinearLayout_foregroundInsidePadding, true);
c.recycle();
}
}

View File

@@ -0,0 +1,227 @@
package com.google.android.material.internal;
import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.CheckedTextView;
import android.widget.FrameLayout;
import androidx.appcompat.R$attr;
import androidx.appcompat.view.menu.MenuItemImpl;
import androidx.appcompat.view.menu.MenuView;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.appcompat.widget.TooltipCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.widget.TextViewCompat;
import com.google.android.material.R$dimen;
import com.google.android.material.R$drawable;
import com.google.android.material.R$id;
import com.google.android.material.R$layout;
/* loaded from: classes.dex */
public class NavigationMenuItemView extends ForegroundLinearLayout implements MenuView.ItemView {
private static final int[] G = {R.attr.state_checked};
private FrameLayout A;
private MenuItemImpl B;
private ColorStateList C;
private boolean D;
private Drawable E;
private final AccessibilityDelegateCompat F;
private final int v;
private boolean x;
boolean y;
private final CheckedTextView z;
public NavigationMenuItemView(Context context) {
this(context, null);
}
private void d() {
if (f()) {
this.z.setVisibility(8);
FrameLayout frameLayout = this.A;
if (frameLayout != null) {
LinearLayoutCompat.LayoutParams layoutParams = (LinearLayoutCompat.LayoutParams) frameLayout.getLayoutParams();
((ViewGroup.MarginLayoutParams) layoutParams).width = -1;
this.A.setLayoutParams(layoutParams);
return;
}
return;
}
this.z.setVisibility(0);
FrameLayout frameLayout2 = this.A;
if (frameLayout2 != null) {
LinearLayoutCompat.LayoutParams layoutParams2 = (LinearLayoutCompat.LayoutParams) frameLayout2.getLayoutParams();
((ViewGroup.MarginLayoutParams) layoutParams2).width = -2;
this.A.setLayoutParams(layoutParams2);
}
}
private StateListDrawable e() {
TypedValue typedValue = new TypedValue();
if (!getContext().getTheme().resolveAttribute(R$attr.colorControlHighlight, typedValue, true)) {
return null;
}
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(G, new ColorDrawable(typedValue.data));
stateListDrawable.addState(ViewGroup.EMPTY_STATE_SET, new ColorDrawable(0));
return stateListDrawable;
}
private boolean f() {
return this.B.getTitle() == null && this.B.getIcon() == null && this.B.getActionView() != null;
}
private void setActionView(View view) {
if (view != null) {
if (this.A == null) {
this.A = (FrameLayout) ((ViewStub) findViewById(R$id.design_menu_item_action_area_stub)).inflate();
}
this.A.removeAllViews();
this.A.addView(view);
}
}
@Override // androidx.appcompat.view.menu.MenuView.ItemView
public void a(MenuItemImpl menuItemImpl, int i) {
this.B = menuItemImpl;
setVisibility(menuItemImpl.isVisible() ? 0 : 8);
if (getBackground() == null) {
ViewCompat.a(this, e());
}
setCheckable(menuItemImpl.isCheckable());
setChecked(menuItemImpl.isChecked());
setEnabled(menuItemImpl.isEnabled());
setTitle(menuItemImpl.getTitle());
setIcon(menuItemImpl.getIcon());
setActionView(menuItemImpl.getActionView());
setContentDescription(menuItemImpl.getContentDescription());
TooltipCompat.a(this, menuItemImpl.getTooltipText());
d();
}
@Override // androidx.appcompat.view.menu.MenuView.ItemView
public boolean a() {
return false;
}
@Override // androidx.appcompat.view.menu.MenuView.ItemView
public MenuItemImpl getItemData() {
return this.B;
}
@Override // android.view.ViewGroup, android.view.View
protected int[] onCreateDrawableState(int i) {
int[] onCreateDrawableState = super.onCreateDrawableState(i + 1);
MenuItemImpl menuItemImpl = this.B;
if (menuItemImpl != null && menuItemImpl.isCheckable() && this.B.isChecked()) {
ViewGroup.mergeDrawableStates(onCreateDrawableState, G);
}
return onCreateDrawableState;
}
public void setCheckable(boolean z) {
refreshDrawableState();
if (this.y != z) {
this.y = z;
this.F.a(this.z, 2048);
}
}
public void setChecked(boolean z) {
refreshDrawableState();
this.z.setChecked(z);
}
public void setHorizontalPadding(int i) {
setPadding(i, 0, i, 0);
}
public void setIcon(Drawable drawable) {
if (drawable != null) {
if (this.D) {
Drawable.ConstantState constantState = drawable.getConstantState();
if (constantState != null) {
drawable = constantState.newDrawable();
}
drawable = DrawableCompat.h(drawable).mutate();
DrawableCompat.a(drawable, this.C);
}
int i = this.v;
drawable.setBounds(0, 0, i, i);
} else if (this.x) {
if (this.E == null) {
this.E = ResourcesCompat.a(getResources(), R$drawable.navigation_empty_icon, getContext().getTheme());
Drawable drawable2 = this.E;
if (drawable2 != null) {
int i2 = this.v;
drawable2.setBounds(0, 0, i2, i2);
}
}
drawable = this.E;
}
TextViewCompat.a(this.z, drawable, null, null, null);
}
public void setIconPadding(int i) {
this.z.setCompoundDrawablePadding(i);
}
void setIconTintList(ColorStateList colorStateList) {
this.C = colorStateList;
this.D = this.C != null;
MenuItemImpl menuItemImpl = this.B;
if (menuItemImpl != null) {
setIcon(menuItemImpl.getIcon());
}
}
public void setNeedsEmptyIcon(boolean z) {
this.x = z;
}
public void setTextAppearance(int i) {
TextViewCompat.d(this.z, i);
}
public void setTextColor(ColorStateList colorStateList) {
this.z.setTextColor(colorStateList);
}
public void setTitle(CharSequence charSequence) {
this.z.setText(charSequence);
}
public NavigationMenuItemView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public NavigationMenuItemView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.F = new AccessibilityDelegateCompat() { // from class: com.google.android.material.internal.NavigationMenuItemView.1
@Override // androidx.core.view.AccessibilityDelegateCompat
public void a(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
super.a(view, accessibilityNodeInfoCompat);
accessibilityNodeInfoCompat.a(NavigationMenuItemView.this.y);
}
};
setOrientation(0);
LayoutInflater.from(context).inflate(R$layout.design_navigation_menu_item, (ViewGroup) this, true);
this.v = context.getResources().getDimensionPixelSize(R$dimen.design_navigation_icon_size);
this.z = (CheckedTextView) findViewById(R$id.design_menu_item_text);
this.z.setDuplicateParentStateEnabled(true);
ViewCompat.a(this.z, this.F);
}
}

View File

@@ -0,0 +1,32 @@
package com.google.android.material.internal;
import android.content.Context;
import android.util.AttributeSet;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.view.menu.MenuView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
/* loaded from: classes.dex */
public class NavigationMenuView extends RecyclerView implements MenuView {
public NavigationMenuView(Context context) {
this(context, null);
}
@Override // androidx.appcompat.view.menu.MenuView
public void a(MenuBuilder menuBuilder) {
}
public int getWindowAnimations() {
return 0;
}
public NavigationMenuView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public NavigationMenuView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
setLayoutManager(new LinearLayoutManager(context, 1, false));
}
}

View File

@@ -0,0 +1,58 @@
package com.google.android.material.internal;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.SparseArray;
/* loaded from: classes.dex */
public class ParcelableSparseArray extends SparseArray<Parcelable> implements Parcelable {
public static final Parcelable.Creator<ParcelableSparseArray> CREATOR = new Parcelable.ClassLoaderCreator<ParcelableSparseArray>() { // from class: com.google.android.material.internal.ParcelableSparseArray.1
@Override // android.os.Parcelable.Creator
public ParcelableSparseArray[] newArray(int i) {
return new ParcelableSparseArray[i];
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.ClassLoaderCreator
public ParcelableSparseArray createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new ParcelableSparseArray(parcel, classLoader);
}
@Override // android.os.Parcelable.Creator
public ParcelableSparseArray createFromParcel(Parcel parcel) {
return new ParcelableSparseArray(parcel, null);
}
};
public ParcelableSparseArray() {
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
int size = size();
int[] iArr = new int[size];
Parcelable[] parcelableArr = new Parcelable[size];
for (int i2 = 0; i2 < size; i2++) {
iArr[i2] = keyAt(i2);
parcelableArr[i2] = valueAt(i2);
}
parcel.writeInt(size);
parcel.writeIntArray(iArr);
parcel.writeParcelableArray(parcelableArr, i);
}
public ParcelableSparseArray(Parcel parcel, ClassLoader classLoader) {
int readInt = parcel.readInt();
int[] iArr = new int[readInt];
parcel.readIntArray(iArr);
Parcelable[] readParcelableArray = parcel.readParcelableArray(classLoader);
for (int i = 0; i < readInt; i++) {
put(iArr[i], readParcelableArray[i]);
}
}
}

View File

@@ -0,0 +1,89 @@
package com.google.android.material.internal;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.util.StateSet;
import java.util.ArrayList;
/* loaded from: classes.dex */
public final class StateListAnimator {
private final ArrayList<Tuple> a = new ArrayList<>();
private Tuple b = null;
ValueAnimator c = null;
private final Animator.AnimatorListener d = new AnimatorListenerAdapter() { // from class: com.google.android.material.internal.StateListAnimator.1
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationEnd(Animator animator) {
StateListAnimator stateListAnimator = StateListAnimator.this;
if (stateListAnimator.c == animator) {
stateListAnimator.c = null;
}
}
};
static class Tuple {
final int[] a;
final ValueAnimator b;
Tuple(int[] iArr, ValueAnimator valueAnimator) {
this.a = iArr;
this.b = valueAnimator;
}
}
private void b() {
ValueAnimator valueAnimator = this.c;
if (valueAnimator != null) {
valueAnimator.cancel();
this.c = null;
}
}
public void a(int[] iArr, ValueAnimator valueAnimator) {
Tuple tuple = new Tuple(iArr, valueAnimator);
valueAnimator.addListener(this.d);
this.a.add(tuple);
}
public void a(int[] iArr) {
Tuple tuple;
int size = this.a.size();
int i = 0;
while (true) {
if (i >= size) {
tuple = null;
break;
}
tuple = this.a.get(i);
if (StateSet.stateSetMatches(tuple.a, iArr)) {
break;
} else {
i++;
}
}
Tuple tuple2 = this.b;
if (tuple == tuple2) {
return;
}
if (tuple2 != null) {
b();
}
this.b = tuple;
if (tuple != null) {
a(tuple);
}
}
private void a(Tuple tuple) {
this.c = tuple.b;
this.c.start();
}
public void a() {
ValueAnimator valueAnimator = this.c;
if (valueAnimator != null) {
valueAnimator.end();
this.c = null;
}
}
}

View File

@@ -0,0 +1,88 @@
package com.google.android.material.internal;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.appcompat.widget.TintTypedArray;
import com.google.android.material.R$attr;
import com.google.android.material.R$styleable;
/* loaded from: classes.dex */
public final class ThemeEnforcement {
private static final int[] a = {R$attr.colorPrimary};
private static final int[] b = {R$attr.colorSecondary};
private static void a(Context context, AttributeSet attributeSet, int i, int i2) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.ThemeEnforcement, i, i2);
boolean z = obtainStyledAttributes.getBoolean(R$styleable.ThemeEnforcement_enforceMaterialTheme, false);
obtainStyledAttributes.recycle();
if (z) {
b(context);
}
a(context);
}
private static boolean b(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2, int... iArr2) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i, i2);
for (int i3 : iArr2) {
if (obtainStyledAttributes.getResourceId(i3, -1) == -1) {
obtainStyledAttributes.recycle();
return false;
}
}
obtainStyledAttributes.recycle();
return true;
}
public static TypedArray c(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2, int... iArr2) {
a(context, attributeSet, i, i2);
a(context, attributeSet, iArr, i, i2, iArr2);
return context.obtainStyledAttributes(attributeSet, iArr, i, i2);
}
public static TintTypedArray d(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2, int... iArr2) {
a(context, attributeSet, i, i2);
a(context, attributeSet, iArr, i, i2, iArr2);
return TintTypedArray.a(context, attributeSet, iArr, i, i2);
}
public static void b(Context context) {
a(context, b, "Theme.MaterialComponents");
}
private static void a(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2, int... iArr2) {
boolean z;
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.ThemeEnforcement, i, i2);
if (!obtainStyledAttributes.getBoolean(R$styleable.ThemeEnforcement_enforceTextAppearance, false)) {
obtainStyledAttributes.recycle();
return;
}
if (iArr2 != null && iArr2.length != 0) {
z = b(context, attributeSet, iArr, i, i2, iArr2);
} else {
z = obtainStyledAttributes.getResourceId(R$styleable.ThemeEnforcement_android_textAppearance, -1) != -1;
}
obtainStyledAttributes.recycle();
if (!z) {
throw new IllegalArgumentException("This component requires that you specify a valid TextAppearance attribute. Update your app theme to inherit from Theme.MaterialComponents (or a descendant).");
}
}
public static void a(Context context) {
a(context, a, "Theme.AppCompat");
}
private static boolean a(Context context, int[] iArr) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(iArr);
boolean hasValue = obtainStyledAttributes.hasValue(0);
obtainStyledAttributes.recycle();
return hasValue;
}
private static void a(Context context, int[] iArr, String str) {
if (a(context, iArr)) {
return;
}
throw new IllegalArgumentException("The style on this component requires your app theme to be " + str + " (or a descendant).");
}
}

View File

@@ -0,0 +1,34 @@
package com.google.android.material.internal;
import android.graphics.PorterDuff;
import android.view.View;
import androidx.core.view.ViewCompat;
/* loaded from: classes.dex */
public class ViewUtils {
public static PorterDuff.Mode a(int i, PorterDuff.Mode mode) {
if (i == 3) {
return PorterDuff.Mode.SRC_OVER;
}
if (i == 5) {
return PorterDuff.Mode.SRC_IN;
}
if (i == 9) {
return PorterDuff.Mode.SRC_ATOP;
}
switch (i) {
case 14:
return PorterDuff.Mode.MULTIPLY;
case 15:
return PorterDuff.Mode.SCREEN;
case 16:
return PorterDuff.Mode.ADD;
default:
return mode;
}
}
public static boolean a(View view) {
return ViewCompat.k(view) == 1;
}
}

View File

@@ -0,0 +1,24 @@
package com.google.android.material.internal;
import android.widget.ImageButton;
/* loaded from: classes.dex */
public class VisibilityAwareImageButton extends ImageButton {
private int a;
public final void a(int i, boolean z) {
super.setVisibility(i);
if (z) {
this.a = i;
}
}
public final int getUserSetVisibility() {
return this.a;
}
@Override // android.widget.ImageView, android.view.View
public void setVisibility(int i) {
a(i, true);
}
}