Initial commit
This commit is contained in:
@@ -0,0 +1,486 @@
|
||||
package androidx.appcompat.graphics.drawable;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.StateSet;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.graphics.drawable.DrawableContainer;
|
||||
import androidx.appcompat.graphics.drawable.StateListDrawable;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.collection.SparseArrayCompat;
|
||||
import androidx.core.content.res.TypedArrayUtils;
|
||||
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
|
||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AnimatedStateListDrawableCompat extends StateListDrawable {
|
||||
private AnimatedStateListState o;
|
||||
private Transition p;
|
||||
private int q;
|
||||
private int r;
|
||||
private boolean s;
|
||||
|
||||
private static class AnimatableTransition extends Transition {
|
||||
private final Animatable a;
|
||||
|
||||
AnimatableTransition(Animatable animatable) {
|
||||
super();
|
||||
this.a = animatable;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void c() {
|
||||
this.a.start();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void d() {
|
||||
this.a.stop();
|
||||
}
|
||||
}
|
||||
|
||||
static class AnimatedStateListState extends StateListDrawable.StateListState {
|
||||
LongSparseArray<Long> K;
|
||||
SparseArrayCompat<Integer> L;
|
||||
|
||||
AnimatedStateListState(AnimatedStateListState animatedStateListState, AnimatedStateListDrawableCompat animatedStateListDrawableCompat, Resources resources) {
|
||||
super(animatedStateListState, animatedStateListDrawableCompat, resources);
|
||||
if (animatedStateListState != null) {
|
||||
this.K = animatedStateListState.K;
|
||||
this.L = animatedStateListState.L;
|
||||
} else {
|
||||
this.K = new LongSparseArray<>();
|
||||
this.L = new SparseArrayCompat<>();
|
||||
}
|
||||
}
|
||||
|
||||
private static long f(int i, int i2) {
|
||||
return i2 | (i << 32);
|
||||
}
|
||||
|
||||
int a(int i, int i2, Drawable drawable, boolean z) {
|
||||
int a = super.a(drawable);
|
||||
long f = f(i, i2);
|
||||
long j = z ? 8589934592L : 0L;
|
||||
long j2 = a;
|
||||
this.K.a(f, Long.valueOf(j2 | j));
|
||||
if (z) {
|
||||
this.K.a(f(i2, i), Long.valueOf(4294967296L | j2 | j));
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
int b(int[] iArr) {
|
||||
int a = super.a(iArr);
|
||||
return a >= 0 ? a : super.a(StateSet.WILD_CARD);
|
||||
}
|
||||
|
||||
int c(int i, int i2) {
|
||||
return (int) this.K.b(f(i, i2), -1L).longValue();
|
||||
}
|
||||
|
||||
int d(int i) {
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
}
|
||||
return this.L.b(i, 0).intValue();
|
||||
}
|
||||
|
||||
boolean e(int i, int i2) {
|
||||
return (this.K.b(f(i, i2), -1L).longValue() & 8589934592L) != 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable.StateListState, androidx.appcompat.graphics.drawable.DrawableContainer.DrawableContainerState
|
||||
void m() {
|
||||
this.K = this.K.m0clone();
|
||||
this.L = this.L.m1clone();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable.StateListState, android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable() {
|
||||
return new AnimatedStateListDrawableCompat(this, null);
|
||||
}
|
||||
|
||||
boolean d(int i, int i2) {
|
||||
return (this.K.b(f(i, i2), -1L).longValue() & 4294967296L) != 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable.StateListState, android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable(Resources resources) {
|
||||
return new AnimatedStateListDrawableCompat(this, resources);
|
||||
}
|
||||
|
||||
int a(int[] iArr, Drawable drawable, int i) {
|
||||
int a = super.a(iArr, drawable);
|
||||
this.L.c(a, Integer.valueOf(i));
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
private static class AnimatedVectorDrawableTransition extends Transition {
|
||||
private final AnimatedVectorDrawableCompat a;
|
||||
|
||||
AnimatedVectorDrawableTransition(AnimatedVectorDrawableCompat animatedVectorDrawableCompat) {
|
||||
super();
|
||||
this.a = animatedVectorDrawableCompat;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void c() {
|
||||
this.a.start();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void d() {
|
||||
this.a.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private static class AnimationDrawableTransition extends Transition {
|
||||
private final ObjectAnimator a;
|
||||
private final boolean b;
|
||||
|
||||
AnimationDrawableTransition(AnimationDrawable animationDrawable, boolean z, boolean z2) {
|
||||
super();
|
||||
int numberOfFrames = animationDrawable.getNumberOfFrames();
|
||||
int i = z ? numberOfFrames - 1 : 0;
|
||||
int i2 = z ? 0 : numberOfFrames - 1;
|
||||
FrameInterpolator frameInterpolator = new FrameInterpolator(animationDrawable, z);
|
||||
ObjectAnimator ofInt = ObjectAnimator.ofInt(animationDrawable, "currentIndex", i, i2);
|
||||
if (Build.VERSION.SDK_INT >= 18) {
|
||||
ofInt.setAutoCancel(true);
|
||||
}
|
||||
ofInt.setDuration(frameInterpolator.a());
|
||||
ofInt.setInterpolator(frameInterpolator);
|
||||
this.b = z2;
|
||||
this.a = ofInt;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public boolean a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void b() {
|
||||
this.a.reverse();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void c() {
|
||||
this.a.start();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition
|
||||
public void d() {
|
||||
this.a.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class Transition {
|
||||
private Transition() {
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
}
|
||||
|
||||
public abstract void c();
|
||||
|
||||
public abstract void d();
|
||||
}
|
||||
|
||||
public AnimatedStateListDrawableCompat() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public static AnimatedStateListDrawableCompat b(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws IOException, XmlPullParserException {
|
||||
String name = xmlPullParser.getName();
|
||||
if (name.equals("animated-selector")) {
|
||||
AnimatedStateListDrawableCompat animatedStateListDrawableCompat = new AnimatedStateListDrawableCompat();
|
||||
animatedStateListDrawableCompat.a(context, resources, xmlPullParser, attributeSet, theme);
|
||||
return animatedStateListDrawableCompat;
|
||||
}
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid animated-selector tag " + name);
|
||||
}
|
||||
|
||||
private void c() {
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
private int d(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int next;
|
||||
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, R$styleable.AnimatedStateListDrawableItem);
|
||||
int resourceId = a.getResourceId(R$styleable.AnimatedStateListDrawableItem_android_id, 0);
|
||||
int resourceId2 = a.getResourceId(R$styleable.AnimatedStateListDrawableItem_android_drawable, -1);
|
||||
Drawable c = resourceId2 > 0 ? AppCompatResources.c(context, resourceId2) : null;
|
||||
a.recycle();
|
||||
int[] a2 = a(attributeSet);
|
||||
if (c == null) {
|
||||
do {
|
||||
next = xmlPullParser.next();
|
||||
} while (next == 4);
|
||||
if (next != 2) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": <item> tag requires a 'drawable' attribute or child tag defining a drawable");
|
||||
}
|
||||
c = xmlPullParser.getName().equals("vector") ? VectorDrawableCompat.createFromXmlInner(resources, xmlPullParser, attributeSet, theme) : Build.VERSION.SDK_INT >= 21 ? Drawable.createFromXmlInner(resources, xmlPullParser, attributeSet, theme) : Drawable.createFromXmlInner(resources, xmlPullParser, attributeSet);
|
||||
}
|
||||
if (c != null) {
|
||||
return this.o.a(a2, c, resourceId);
|
||||
}
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": <item> tag requires a 'drawable' attribute or child tag defining a drawable");
|
||||
}
|
||||
|
||||
private int e(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int next;
|
||||
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, R$styleable.AnimatedStateListDrawableTransition);
|
||||
int resourceId = a.getResourceId(R$styleable.AnimatedStateListDrawableTransition_android_fromId, -1);
|
||||
int resourceId2 = a.getResourceId(R$styleable.AnimatedStateListDrawableTransition_android_toId, -1);
|
||||
int resourceId3 = a.getResourceId(R$styleable.AnimatedStateListDrawableTransition_android_drawable, -1);
|
||||
Drawable c = resourceId3 > 0 ? AppCompatResources.c(context, resourceId3) : null;
|
||||
boolean z = a.getBoolean(R$styleable.AnimatedStateListDrawableTransition_android_reversible, false);
|
||||
a.recycle();
|
||||
if (c == null) {
|
||||
do {
|
||||
next = xmlPullParser.next();
|
||||
} while (next == 4);
|
||||
if (next != 2) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": <transition> tag requires a 'drawable' attribute or child tag defining a drawable");
|
||||
}
|
||||
c = xmlPullParser.getName().equals("animated-vector") ? AnimatedVectorDrawableCompat.a(context, resources, xmlPullParser, attributeSet, theme) : Build.VERSION.SDK_INT >= 21 ? Drawable.createFromXmlInner(resources, xmlPullParser, attributeSet, theme) : Drawable.createFromXmlInner(resources, xmlPullParser, attributeSet);
|
||||
}
|
||||
if (c == null) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": <transition> tag requires a 'drawable' attribute or child tag defining a drawable");
|
||||
}
|
||||
if (resourceId != -1 && resourceId2 != -1) {
|
||||
return this.o.a(resourceId, resourceId2, c, z);
|
||||
}
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": <transition> tag requires 'fromId' & 'toId' attributes");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable, android.graphics.drawable.Drawable
|
||||
public boolean isStateful() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer, android.graphics.drawable.Drawable
|
||||
public void jumpToCurrentState() {
|
||||
super.jumpToCurrentState();
|
||||
Transition transition = this.p;
|
||||
if (transition != null) {
|
||||
transition.d();
|
||||
this.p = null;
|
||||
a(this.q);
|
||||
this.q = -1;
|
||||
this.r = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable, androidx.appcompat.graphics.drawable.DrawableContainer, android.graphics.drawable.Drawable
|
||||
public Drawable mutate() {
|
||||
if (!this.s) {
|
||||
super.mutate();
|
||||
if (this == this) {
|
||||
this.o.m();
|
||||
this.s = true;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable, androidx.appcompat.graphics.drawable.DrawableContainer, android.graphics.drawable.Drawable
|
||||
protected boolean onStateChange(int[] iArr) {
|
||||
int b = this.o.b(iArr);
|
||||
boolean z = b != b() && (b(b) || a(b));
|
||||
Drawable current = getCurrent();
|
||||
return current != null ? z | current.setState(iArr) : z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer, android.graphics.drawable.Drawable
|
||||
public boolean setVisible(boolean z, boolean z2) {
|
||||
boolean visible = super.setVisible(z, z2);
|
||||
if (this.p != null && (visible || z2)) {
|
||||
if (z) {
|
||||
this.p.c();
|
||||
} else {
|
||||
jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
return visible;
|
||||
}
|
||||
|
||||
AnimatedStateListDrawableCompat(AnimatedStateListState animatedStateListState, Resources resources) {
|
||||
super(null);
|
||||
this.q = -1;
|
||||
this.r = -1;
|
||||
a(new AnimatedStateListState(animatedStateListState, this, resources));
|
||||
onStateChange(getState());
|
||||
jumpToCurrentState();
|
||||
}
|
||||
|
||||
private void c(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int depth = xmlPullParser.getDepth() + 1;
|
||||
while (true) {
|
||||
int next = xmlPullParser.next();
|
||||
if (next == 1) {
|
||||
return;
|
||||
}
|
||||
int depth2 = xmlPullParser.getDepth();
|
||||
if (depth2 < depth && next == 3) {
|
||||
return;
|
||||
}
|
||||
if (next == 2 && depth2 <= depth) {
|
||||
if (xmlPullParser.getName().equals("item")) {
|
||||
d(context, resources, xmlPullParser, attributeSet, theme);
|
||||
} else if (xmlPullParser.getName().equals("transition")) {
|
||||
e(context, resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, R$styleable.AnimatedStateListDrawableCompat);
|
||||
setVisible(a.getBoolean(R$styleable.AnimatedStateListDrawableCompat_android_visible, true), true);
|
||||
a(a);
|
||||
a(resources);
|
||||
a.recycle();
|
||||
c(context, resources, xmlPullParser, attributeSet, theme);
|
||||
c();
|
||||
}
|
||||
|
||||
private boolean b(int i) {
|
||||
int b;
|
||||
int c;
|
||||
Transition animatableTransition;
|
||||
Transition transition = this.p;
|
||||
if (transition != null) {
|
||||
if (i == this.q) {
|
||||
return true;
|
||||
}
|
||||
if (i == this.r && transition.a()) {
|
||||
transition.b();
|
||||
this.q = this.r;
|
||||
this.r = i;
|
||||
return true;
|
||||
}
|
||||
b = this.q;
|
||||
transition.d();
|
||||
} else {
|
||||
b = b();
|
||||
}
|
||||
this.p = null;
|
||||
this.r = -1;
|
||||
this.q = -1;
|
||||
AnimatedStateListState animatedStateListState = this.o;
|
||||
int d = animatedStateListState.d(b);
|
||||
int d2 = animatedStateListState.d(i);
|
||||
if (d2 == 0 || d == 0 || (c = animatedStateListState.c(d, d2)) < 0) {
|
||||
return false;
|
||||
}
|
||||
boolean e = animatedStateListState.e(d, d2);
|
||||
a(c);
|
||||
Object current = getCurrent();
|
||||
if (current instanceof AnimationDrawable) {
|
||||
animatableTransition = new AnimationDrawableTransition((AnimationDrawable) current, animatedStateListState.d(d, d2), e);
|
||||
} else if (current instanceof AnimatedVectorDrawableCompat) {
|
||||
animatableTransition = new AnimatedVectorDrawableTransition((AnimatedVectorDrawableCompat) current);
|
||||
} else {
|
||||
if (current instanceof Animatable) {
|
||||
animatableTransition = new AnimatableTransition((Animatable) current);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
animatableTransition.c();
|
||||
this.p = animatableTransition;
|
||||
this.r = b;
|
||||
this.q = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class FrameInterpolator implements TimeInterpolator {
|
||||
private int[] a;
|
||||
private int b;
|
||||
private int c;
|
||||
|
||||
FrameInterpolator(AnimationDrawable animationDrawable, boolean z) {
|
||||
a(animationDrawable, z);
|
||||
}
|
||||
|
||||
int a(AnimationDrawable animationDrawable, boolean z) {
|
||||
int numberOfFrames = animationDrawable.getNumberOfFrames();
|
||||
this.b = numberOfFrames;
|
||||
int[] iArr = this.a;
|
||||
if (iArr == null || iArr.length < numberOfFrames) {
|
||||
this.a = new int[numberOfFrames];
|
||||
}
|
||||
int[] iArr2 = this.a;
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < numberOfFrames; i2++) {
|
||||
int duration = animationDrawable.getDuration(z ? (numberOfFrames - i2) - 1 : i2);
|
||||
iArr2[i2] = duration;
|
||||
i += duration;
|
||||
}
|
||||
this.c = i;
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // android.animation.TimeInterpolator
|
||||
public float getInterpolation(float f) {
|
||||
int i = (int) ((f * this.c) + 0.5f);
|
||||
int i2 = this.b;
|
||||
int[] iArr = this.a;
|
||||
int i3 = 0;
|
||||
while (i3 < i2 && i >= iArr[i3]) {
|
||||
i -= iArr[i3];
|
||||
i3++;
|
||||
}
|
||||
return (i3 / i2) + (i3 < i2 ? i / this.c : 0.0f);
|
||||
}
|
||||
|
||||
int a() {
|
||||
return this.c;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(TypedArray typedArray) {
|
||||
AnimatedStateListState animatedStateListState = this.o;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
animatedStateListState.d |= typedArray.getChangingConfigurations();
|
||||
}
|
||||
animatedStateListState.b(typedArray.getBoolean(R$styleable.AnimatedStateListDrawableCompat_android_variablePadding, animatedStateListState.i));
|
||||
animatedStateListState.a(typedArray.getBoolean(R$styleable.AnimatedStateListDrawableCompat_android_constantSize, animatedStateListState.l));
|
||||
animatedStateListState.b(typedArray.getInt(R$styleable.AnimatedStateListDrawableCompat_android_enterFadeDuration, animatedStateListState.A));
|
||||
animatedStateListState.c(typedArray.getInt(R$styleable.AnimatedStateListDrawableCompat_android_exitFadeDuration, animatedStateListState.B));
|
||||
setDither(typedArray.getBoolean(R$styleable.AnimatedStateListDrawableCompat_android_dither, animatedStateListState.x));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable, androidx.appcompat.graphics.drawable.DrawableContainer
|
||||
public AnimatedStateListState a() {
|
||||
return new AnimatedStateListState(this.o, this, null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.StateListDrawable, androidx.appcompat.graphics.drawable.DrawableContainer
|
||||
protected void a(DrawableContainer.DrawableContainerState drawableContainerState) {
|
||||
super.a(drawableContainerState);
|
||||
if (drawableContainerState instanceof AnimatedStateListState) {
|
||||
this.o = (AnimatedStateListState) drawableContainerState;
|
||||
}
|
||||
}
|
||||
}
|
1111
sources/androidx/appcompat/graphics/drawable/DrawableContainer.java
Normal file
1111
sources/androidx/appcompat/graphics/drawable/DrawableContainer.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,194 @@
|
||||
package androidx.appcompat.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DrawableWrapper extends Drawable implements Drawable.Callback {
|
||||
private Drawable a;
|
||||
|
||||
public DrawableWrapper(Drawable drawable) {
|
||||
a(drawable);
|
||||
}
|
||||
|
||||
public Drawable a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
this.a.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getChangingConfigurations() {
|
||||
return this.a.getChangingConfigurations();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Drawable getCurrent() {
|
||||
return this.a.getCurrent();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicHeight() {
|
||||
return this.a.getIntrinsicHeight();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicWidth() {
|
||||
return this.a.getIntrinsicWidth();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getMinimumHeight() {
|
||||
return this.a.getMinimumHeight();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getMinimumWidth() {
|
||||
return this.a.getMinimumWidth();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return this.a.getOpacity();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean getPadding(Rect rect) {
|
||||
return this.a.getPadding(rect);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int[] getState() {
|
||||
return this.a.getState();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Region getTransparentRegion() {
|
||||
return this.a.getTransparentRegion();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void invalidateDrawable(Drawable drawable) {
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isAutoMirrored() {
|
||||
return DrawableCompat.f(this.a);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isStateful() {
|
||||
return this.a.isStateful();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void jumpToCurrentState() {
|
||||
DrawableCompat.g(this.a);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
protected void onBoundsChange(Rect rect) {
|
||||
this.a.setBounds(rect);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
protected boolean onLevelChange(int i) {
|
||||
return this.a.setLevel(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
|
||||
scheduleSelf(runnable, j);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
this.a.setAlpha(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAutoMirrored(boolean z) {
|
||||
DrawableCompat.a(this.a, z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setChangingConfigurations(int i) {
|
||||
this.a.setChangingConfigurations(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
this.a.setColorFilter(colorFilter);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setDither(boolean z) {
|
||||
this.a.setDither(z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setFilterBitmap(boolean z) {
|
||||
this.a.setFilterBitmap(z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setHotspot(float f, float f2) {
|
||||
DrawableCompat.a(this.a, f, f2);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setHotspotBounds(int i, int i2, int i3, int i4) {
|
||||
DrawableCompat.a(this.a, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean setState(int[] iArr) {
|
||||
return this.a.setState(iArr);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setTint(int i) {
|
||||
DrawableCompat.b(this.a, i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setTintList(ColorStateList colorStateList) {
|
||||
DrawableCompat.a(this.a, colorStateList);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setTintMode(PorterDuff.Mode mode) {
|
||||
DrawableCompat.a(this.a, mode);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean setVisible(boolean z, boolean z2) {
|
||||
return super.setVisible(z, z2) || this.a.setVisible(z, z2);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
|
||||
unscheduleSelf(runnable);
|
||||
}
|
||||
|
||||
public void a(Drawable drawable) {
|
||||
Drawable drawable2 = this.a;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
}
|
||||
this.a = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,148 @@
|
||||
package androidx.appcompat.graphics.drawable;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.StateSet;
|
||||
import androidx.appcompat.graphics.drawable.DrawableContainer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class StateListDrawable extends DrawableContainer {
|
||||
private StateListState m;
|
||||
private boolean n;
|
||||
|
||||
static class StateListState extends DrawableContainer.DrawableContainerState {
|
||||
int[][] J;
|
||||
|
||||
StateListState(StateListState stateListState, StateListDrawable stateListDrawable, Resources resources) {
|
||||
super(stateListState, stateListDrawable, resources);
|
||||
if (stateListState != null) {
|
||||
this.J = stateListState.J;
|
||||
} else {
|
||||
this.J = new int[c()][];
|
||||
}
|
||||
}
|
||||
|
||||
int a(int[] iArr, Drawable drawable) {
|
||||
int a = a(drawable);
|
||||
this.J[a] = iArr;
|
||||
return a;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer.DrawableContainerState
|
||||
void m() {
|
||||
int[][] iArr = this.J;
|
||||
int[][] iArr2 = new int[iArr.length][];
|
||||
for (int length = iArr.length - 1; length >= 0; length--) {
|
||||
int[][] iArr3 = this.J;
|
||||
iArr2[length] = iArr3[length] != null ? (int[]) iArr3[length].clone() : null;
|
||||
}
|
||||
this.J = iArr2;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable() {
|
||||
return new StateListDrawable(this, null);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable(Resources resources) {
|
||||
return new StateListDrawable(this, resources);
|
||||
}
|
||||
|
||||
int a(int[] iArr) {
|
||||
int[][] iArr2 = this.J;
|
||||
int d = d();
|
||||
for (int i = 0; i < d; i++) {
|
||||
if (StateSet.stateSetMatches(iArr2[i], iArr)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer.DrawableContainerState
|
||||
public void a(int i, int i2) {
|
||||
super.a(i, i2);
|
||||
int[][] iArr = new int[i2][];
|
||||
System.arraycopy(this.J, 0, iArr, 0, i);
|
||||
this.J = iArr;
|
||||
}
|
||||
}
|
||||
|
||||
StateListDrawable(StateListState stateListState, Resources resources) {
|
||||
a(new StateListState(stateListState, this, resources));
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer, android.graphics.drawable.Drawable
|
||||
public void applyTheme(Resources.Theme theme) {
|
||||
super.applyTheme(theme);
|
||||
onStateChange(getState());
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isStateful() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer, android.graphics.drawable.Drawable
|
||||
public Drawable mutate() {
|
||||
if (!this.n) {
|
||||
super.mutate();
|
||||
if (this == this) {
|
||||
this.m.m();
|
||||
this.n = true;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer, android.graphics.drawable.Drawable
|
||||
protected boolean onStateChange(int[] iArr) {
|
||||
boolean onStateChange = super.onStateChange(iArr);
|
||||
int a = this.m.a(iArr);
|
||||
if (a < 0) {
|
||||
a = this.m.a(StateSet.WILD_CARD);
|
||||
}
|
||||
return a(a) || onStateChange;
|
||||
}
|
||||
|
||||
int[] a(AttributeSet attributeSet) {
|
||||
int attributeCount = attributeSet.getAttributeCount();
|
||||
int[] iArr = new int[attributeCount];
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < attributeCount; i2++) {
|
||||
int attributeNameResource = attributeSet.getAttributeNameResource(i2);
|
||||
if (attributeNameResource != 0 && attributeNameResource != 16842960 && attributeNameResource != 16843161) {
|
||||
int i3 = i + 1;
|
||||
if (!attributeSet.getAttributeBooleanValue(i2, false)) {
|
||||
attributeNameResource = -attributeNameResource;
|
||||
}
|
||||
iArr[i] = attributeNameResource;
|
||||
i = i3;
|
||||
}
|
||||
}
|
||||
return StateSet.trimStateSet(iArr, i);
|
||||
}
|
||||
|
||||
StateListDrawable(StateListState stateListState) {
|
||||
if (stateListState != null) {
|
||||
a(stateListState);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer
|
||||
public StateListState a() {
|
||||
return new StateListState(this.m, this, null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableContainer
|
||||
protected void a(DrawableContainer.DrawableContainerState drawableContainerState) {
|
||||
super.a(drawableContainerState);
|
||||
if (drawableContainerState instanceof StateListState) {
|
||||
this.m = (StateListState) drawableContainerState;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user