ADD week 5
This commit is contained in:
		| @@ -0,0 +1,548 @@ | ||||
| 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.content.res.XmlResourceParser; | ||||
| import android.graphics.drawable.Animatable; | ||||
| import android.graphics.drawable.AnimationDrawable; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Log; | ||||
| import android.util.StateSet; | ||||
| import android.util.Xml; | ||||
| import androidx.appcompat.graphics.drawable.DrawableContainerCompat; | ||||
| import androidx.appcompat.graphics.drawable.StateListDrawableCompat; | ||||
| import androidx.appcompat.resources.Compatibility; | ||||
| import androidx.appcompat.resources.R; | ||||
| import androidx.appcompat.widget.ResourceManagerInternal; | ||||
| import androidx.collection.LongSparseArray; | ||||
| import androidx.collection.SparseArrayCompat; | ||||
| import androidx.core.content.res.TypedArrayUtils; | ||||
| import androidx.core.graphics.drawable.TintAwareDrawable; | ||||
| import androidx.core.util.ObjectsCompat; | ||||
| 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 StateListDrawableCompat implements TintAwareDrawable { | ||||
|     private static final String ELEMENT_ITEM = "item"; | ||||
|     private static final String ELEMENT_TRANSITION = "transition"; | ||||
|     private static final String ITEM_MISSING_DRAWABLE_ERROR = ": <item> tag requires a 'drawable' attribute or child tag defining a drawable"; | ||||
|     private static final String LOGTAG = "AnimatedStateListDrawableCompat"; | ||||
|     private static final String TRANSITION_MISSING_DRAWABLE_ERROR = ": <transition> tag requires a 'drawable' attribute or child tag defining a drawable"; | ||||
|     private static final String TRANSITION_MISSING_FROM_TO_ID = ": <transition> tag requires 'fromId' & 'toId' attributes"; | ||||
|     private boolean mMutated; | ||||
|     private AnimatedStateListState mState; | ||||
|     private Transition mTransition; | ||||
|     private int mTransitionFromIndex; | ||||
|     private int mTransitionToIndex; | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     public boolean isStateful() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public AnimatedStateListDrawableCompat() { | ||||
|         this(null, null); | ||||
|     } | ||||
|  | ||||
|     AnimatedStateListDrawableCompat(AnimatedStateListState animatedStateListState, Resources resources) { | ||||
|         super(null); | ||||
|         this.mTransitionToIndex = -1; | ||||
|         this.mTransitionFromIndex = -1; | ||||
|         setConstantState(new AnimatedStateListState(animatedStateListState, this, resources)); | ||||
|         onStateChange(getState()); | ||||
|         jumpToCurrentState(); | ||||
|     } | ||||
|  | ||||
|     public static AnimatedStateListDrawableCompat create(Context context, int i, Resources.Theme theme) { | ||||
|         int next; | ||||
|         try { | ||||
|             Resources resources = context.getResources(); | ||||
|             XmlResourceParser xml = resources.getXml(i); | ||||
|             AttributeSet asAttributeSet = Xml.asAttributeSet(xml); | ||||
|             do { | ||||
|                 next = xml.next(); | ||||
|                 if (next == 2) { | ||||
|                     break; | ||||
|                 } | ||||
|             } while (next != 1); | ||||
|             if (next != 2) { | ||||
|                 throw new XmlPullParserException("No start tag found"); | ||||
|             } | ||||
|             return createFromXmlInner(context, resources, xml, asAttributeSet, theme); | ||||
|         } catch (IOException e) { | ||||
|             Log.e(LOGTAG, "parser error", e); | ||||
|             return null; | ||||
|         } catch (XmlPullParserException e2) { | ||||
|             Log.e(LOGTAG, "parser error", e2); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static AnimatedStateListDrawableCompat createFromXmlInner(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws IOException, XmlPullParserException { | ||||
|         String name = xmlPullParser.getName(); | ||||
|         if (!name.equals("animated-selector")) { | ||||
|             throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid animated-selector tag " + name); | ||||
|         } | ||||
|         AnimatedStateListDrawableCompat animatedStateListDrawableCompat = new AnimatedStateListDrawableCompat(); | ||||
|         animatedStateListDrawableCompat.inflate(context, resources, xmlPullParser, attributeSet, theme); | ||||
|         return animatedStateListDrawableCompat; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat | ||||
|     public void inflate(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException { | ||||
|         TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.AnimatedStateListDrawableCompat); | ||||
|         setVisible(obtainAttributes.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_visible, true), true); | ||||
|         updateStateFromTypedArray(obtainAttributes); | ||||
|         updateDensity(resources); | ||||
|         obtainAttributes.recycle(); | ||||
|         inflateChildElements(context, resources, xmlPullParser, attributeSet, theme); | ||||
|         init(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     public boolean setVisible(boolean z, boolean z2) { | ||||
|         boolean visible = super.setVisible(z, z2); | ||||
|         Transition transition = this.mTransition; | ||||
|         if (transition != null && (visible || z2)) { | ||||
|             if (z) { | ||||
|                 transition.start(); | ||||
|             } else { | ||||
|                 jumpToCurrentState(); | ||||
|             } | ||||
|         } | ||||
|         return visible; | ||||
|     } | ||||
|  | ||||
|     public void addState(int[] iArr, Drawable drawable, int i) { | ||||
|         ObjectsCompat.requireNonNull(drawable); | ||||
|         this.mState.addStateSet(iArr, drawable, i); | ||||
|         onStateChange(getState()); | ||||
|     } | ||||
|  | ||||
|     public <T extends Drawable & Animatable> void addTransition(int i, int i2, T t, boolean z) { | ||||
|         ObjectsCompat.requireNonNull(t); | ||||
|         this.mState.addTransition(i, i2, t, z); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     public void jumpToCurrentState() { | ||||
|         super.jumpToCurrentState(); | ||||
|         Transition transition = this.mTransition; | ||||
|         if (transition != null) { | ||||
|             transition.stop(); | ||||
|             this.mTransition = null; | ||||
|             selectDrawable(this.mTransitionToIndex); | ||||
|             this.mTransitionToIndex = -1; | ||||
|             this.mTransitionFromIndex = -1; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     protected boolean onStateChange(int[] iArr) { | ||||
|         int indexOfKeyframe = this.mState.indexOfKeyframe(iArr); | ||||
|         boolean z = indexOfKeyframe != getCurrentIndex() && (selectTransition(indexOfKeyframe) || selectDrawable(indexOfKeyframe)); | ||||
|         Drawable current = getCurrent(); | ||||
|         return current != null ? z | current.setState(iArr) : z; | ||||
|     } | ||||
|  | ||||
|     private boolean selectTransition(int i) { | ||||
|         int currentIndex; | ||||
|         int indexOfTransition; | ||||
|         Transition animatableTransition; | ||||
|         Transition transition = this.mTransition; | ||||
|         if (transition == null) { | ||||
|             currentIndex = getCurrentIndex(); | ||||
|         } else { | ||||
|             if (i == this.mTransitionToIndex) { | ||||
|                 return true; | ||||
|             } | ||||
|             if (i == this.mTransitionFromIndex && transition.canReverse()) { | ||||
|                 transition.reverse(); | ||||
|                 this.mTransitionToIndex = this.mTransitionFromIndex; | ||||
|                 this.mTransitionFromIndex = i; | ||||
|                 return true; | ||||
|             } | ||||
|             currentIndex = this.mTransitionToIndex; | ||||
|             transition.stop(); | ||||
|         } | ||||
|         this.mTransition = null; | ||||
|         this.mTransitionFromIndex = -1; | ||||
|         this.mTransitionToIndex = -1; | ||||
|         AnimatedStateListState animatedStateListState = this.mState; | ||||
|         int keyframeIdAt = animatedStateListState.getKeyframeIdAt(currentIndex); | ||||
|         int keyframeIdAt2 = animatedStateListState.getKeyframeIdAt(i); | ||||
|         if (keyframeIdAt2 == 0 || keyframeIdAt == 0 || (indexOfTransition = animatedStateListState.indexOfTransition(keyframeIdAt, keyframeIdAt2)) < 0) { | ||||
|             return false; | ||||
|         } | ||||
|         boolean transitionHasReversibleFlag = animatedStateListState.transitionHasReversibleFlag(keyframeIdAt, keyframeIdAt2); | ||||
|         selectDrawable(indexOfTransition); | ||||
|         Object current = getCurrent(); | ||||
|         if (current instanceof AnimationDrawable) { | ||||
|             animatableTransition = new AnimationDrawableTransition((AnimationDrawable) current, animatedStateListState.isTransitionReversed(keyframeIdAt, keyframeIdAt2), transitionHasReversibleFlag); | ||||
|         } else if (current instanceof AnimatedVectorDrawableCompat) { | ||||
|             animatableTransition = new AnimatedVectorDrawableTransition((AnimatedVectorDrawableCompat) current); | ||||
|         } else { | ||||
|             if (current instanceof Animatable) { | ||||
|                 animatableTransition = new AnimatableTransition((Animatable) current); | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
|         animatableTransition.start(); | ||||
|         this.mTransition = animatableTransition; | ||||
|         this.mTransitionFromIndex = currentIndex; | ||||
|         this.mTransitionToIndex = i; | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     private static abstract class Transition { | ||||
|         public boolean canReverse() { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         public void reverse() { | ||||
|         } | ||||
|  | ||||
|         public abstract void start(); | ||||
|  | ||||
|         public abstract void stop(); | ||||
|  | ||||
|         private Transition() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class AnimatableTransition extends Transition { | ||||
|         private final Animatable mA; | ||||
|  | ||||
|         AnimatableTransition(Animatable animatable) { | ||||
|             super(); | ||||
|             this.mA = animatable; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public void start() { | ||||
|             this.mA.start(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public void stop() { | ||||
|             this.mA.stop(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class AnimationDrawableTransition extends Transition { | ||||
|         private final ObjectAnimator mAnim; | ||||
|         private final boolean mHasReversibleFlag; | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public boolean canReverse() { | ||||
|             return this.mHasReversibleFlag; | ||||
|         } | ||||
|  | ||||
|         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); | ||||
|             Compatibility.Api18Impl.setAutoCancel(ofInt, true); | ||||
|             ofInt.setDuration(frameInterpolator.getTotalDuration()); | ||||
|             ofInt.setInterpolator(frameInterpolator); | ||||
|             this.mHasReversibleFlag = z2; | ||||
|             this.mAnim = ofInt; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public void start() { | ||||
|             this.mAnim.start(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public void reverse() { | ||||
|             this.mAnim.reverse(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public void stop() { | ||||
|             this.mAnim.cancel(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class AnimatedVectorDrawableTransition extends Transition { | ||||
|         private final AnimatedVectorDrawableCompat mAvd; | ||||
|  | ||||
|         AnimatedVectorDrawableTransition(AnimatedVectorDrawableCompat animatedVectorDrawableCompat) { | ||||
|             super(); | ||||
|             this.mAvd = animatedVectorDrawableCompat; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public void start() { | ||||
|             this.mAvd.start(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat.Transition | ||||
|         public void stop() { | ||||
|             this.mAvd.stop(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void updateStateFromTypedArray(TypedArray typedArray) { | ||||
|         AnimatedStateListState animatedStateListState = this.mState; | ||||
|         animatedStateListState.mChangingConfigurations |= Compatibility.Api21Impl.getChangingConfigurations(typedArray); | ||||
|         animatedStateListState.setVariablePadding(typedArray.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_variablePadding, animatedStateListState.mVariablePadding)); | ||||
|         animatedStateListState.setConstantSize(typedArray.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_constantSize, animatedStateListState.mConstantSize)); | ||||
|         animatedStateListState.setEnterFadeDuration(typedArray.getInt(R.styleable.AnimatedStateListDrawableCompat_android_enterFadeDuration, animatedStateListState.mEnterFadeDuration)); | ||||
|         animatedStateListState.setExitFadeDuration(typedArray.getInt(R.styleable.AnimatedStateListDrawableCompat_android_exitFadeDuration, animatedStateListState.mExitFadeDuration)); | ||||
|         setDither(typedArray.getBoolean(R.styleable.AnimatedStateListDrawableCompat_android_dither, animatedStateListState.mDither)); | ||||
|     } | ||||
|  | ||||
|     private void init() { | ||||
|         onStateChange(getState()); | ||||
|     } | ||||
|  | ||||
|     private void inflateChildElements(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(ELEMENT_ITEM)) { | ||||
|                     parseItem(context, resources, xmlPullParser, attributeSet, theme); | ||||
|                 } else if (xmlPullParser.getName().equals(ELEMENT_TRANSITION)) { | ||||
|                     parseTransition(context, resources, xmlPullParser, attributeSet, theme); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private int parseTransition(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException { | ||||
|         int next; | ||||
|         TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.AnimatedStateListDrawableTransition); | ||||
|         int resourceId = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableTransition_android_fromId, -1); | ||||
|         int resourceId2 = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableTransition_android_toId, -1); | ||||
|         int resourceId3 = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableTransition_android_drawable, -1); | ||||
|         Drawable drawable = resourceId3 > 0 ? ResourceManagerInternal.get().getDrawable(context, resourceId3) : null; | ||||
|         boolean z = obtainAttributes.getBoolean(R.styleable.AnimatedStateListDrawableTransition_android_reversible, false); | ||||
|         obtainAttributes.recycle(); | ||||
|         if (drawable == null) { | ||||
|             do { | ||||
|                 next = xmlPullParser.next(); | ||||
|             } while (next == 4); | ||||
|             if (next != 2) { | ||||
|                 throw new XmlPullParserException(xmlPullParser.getPositionDescription() + TRANSITION_MISSING_DRAWABLE_ERROR); | ||||
|             } | ||||
|             if (xmlPullParser.getName().equals("animated-vector")) { | ||||
|                 drawable = AnimatedVectorDrawableCompat.createFromXmlInner(context, resources, xmlPullParser, attributeSet, theme); | ||||
|             } else { | ||||
|                 drawable = Compatibility.Api21Impl.createFromXmlInner(resources, xmlPullParser, attributeSet, theme); | ||||
|             } | ||||
|         } | ||||
|         if (drawable == null) { | ||||
|             throw new XmlPullParserException(xmlPullParser.getPositionDescription() + TRANSITION_MISSING_DRAWABLE_ERROR); | ||||
|         } | ||||
|         if (resourceId == -1 || resourceId2 == -1) { | ||||
|             throw new XmlPullParserException(xmlPullParser.getPositionDescription() + TRANSITION_MISSING_FROM_TO_ID); | ||||
|         } | ||||
|         return this.mState.addTransition(resourceId, resourceId2, drawable, z); | ||||
|     } | ||||
|  | ||||
|     private int parseItem(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException { | ||||
|         int next; | ||||
|         TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.AnimatedStateListDrawableItem); | ||||
|         int resourceId = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableItem_android_id, 0); | ||||
|         int resourceId2 = obtainAttributes.getResourceId(R.styleable.AnimatedStateListDrawableItem_android_drawable, -1); | ||||
|         Drawable drawable = resourceId2 > 0 ? ResourceManagerInternal.get().getDrawable(context, resourceId2) : null; | ||||
|         obtainAttributes.recycle(); | ||||
|         int[] extractStateSet = extractStateSet(attributeSet); | ||||
|         if (drawable == null) { | ||||
|             do { | ||||
|                 next = xmlPullParser.next(); | ||||
|             } while (next == 4); | ||||
|             if (next != 2) { | ||||
|                 throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ITEM_MISSING_DRAWABLE_ERROR); | ||||
|             } | ||||
|             if (xmlPullParser.getName().equals("vector")) { | ||||
|                 drawable = VectorDrawableCompat.createFromXmlInner(resources, xmlPullParser, attributeSet, theme); | ||||
|             } else { | ||||
|                 drawable = Compatibility.Api21Impl.createFromXmlInner(resources, xmlPullParser, attributeSet, theme); | ||||
|             } | ||||
|         } | ||||
|         if (drawable == null) { | ||||
|             throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ITEM_MISSING_DRAWABLE_ERROR); | ||||
|         } | ||||
|         return this.mState.addStateSet(extractStateSet, drawable, resourceId); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     public Drawable mutate() { | ||||
|         if (!this.mMutated && super.mutate() == this) { | ||||
|             this.mState.mutate(); | ||||
|             this.mMutated = true; | ||||
|         } | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: package-private */ | ||||
|     @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat | ||||
|     public AnimatedStateListState cloneConstantState() { | ||||
|         return new AnimatedStateListState(this.mState, this, null); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat | ||||
|     void clearMutated() { | ||||
|         super.clearMutated(); | ||||
|         this.mMutated = false; | ||||
|     } | ||||
|  | ||||
|     static class AnimatedStateListState extends StateListDrawableCompat.StateListState { | ||||
|         private static final long REVERSED_BIT = 4294967296L; | ||||
|         private static final long REVERSIBLE_FLAG_BIT = 8589934592L; | ||||
|         SparseArrayCompat<Integer> mStateIds; | ||||
|         LongSparseArray<Long> mTransitions; | ||||
|  | ||||
|         private static long generateTransitionKey(int i, int i2) { | ||||
|             return i2 | (i << 32); | ||||
|         } | ||||
|  | ||||
|         AnimatedStateListState(AnimatedStateListState animatedStateListState, AnimatedStateListDrawableCompat animatedStateListDrawableCompat, Resources resources) { | ||||
|             super(animatedStateListState, animatedStateListDrawableCompat, resources); | ||||
|             if (animatedStateListState != null) { | ||||
|                 this.mTransitions = animatedStateListState.mTransitions; | ||||
|                 this.mStateIds = animatedStateListState.mStateIds; | ||||
|             } else { | ||||
|                 this.mTransitions = new LongSparseArray<>(); | ||||
|                 this.mStateIds = new SparseArrayCompat<>(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat.StateListState, androidx.appcompat.graphics.drawable.DrawableContainerCompat.DrawableContainerState | ||||
|         void mutate() { | ||||
|             this.mTransitions = this.mTransitions.m45clone(); | ||||
|             this.mStateIds = this.mStateIds.m46clone(); | ||||
|         } | ||||
|  | ||||
|         int addTransition(int i, int i2, Drawable drawable, boolean z) { | ||||
|             int addChild = super.addChild(drawable); | ||||
|             long generateTransitionKey = generateTransitionKey(i, i2); | ||||
|             long j = z ? REVERSIBLE_FLAG_BIT : 0L; | ||||
|             long j2 = addChild; | ||||
|             this.mTransitions.append(generateTransitionKey, Long.valueOf(j2 | j)); | ||||
|             if (z) { | ||||
|                 this.mTransitions.append(generateTransitionKey(i2, i), Long.valueOf(REVERSED_BIT | j2 | j)); | ||||
|             } | ||||
|             return addChild; | ||||
|         } | ||||
|  | ||||
|         int addStateSet(int[] iArr, Drawable drawable, int i) { | ||||
|             int addStateSet = super.addStateSet(iArr, drawable); | ||||
|             this.mStateIds.put(addStateSet, Integer.valueOf(i)); | ||||
|             return addStateSet; | ||||
|         } | ||||
|  | ||||
|         int indexOfKeyframe(int[] iArr) { | ||||
|             int indexOfStateSet = super.indexOfStateSet(iArr); | ||||
|             return indexOfStateSet >= 0 ? indexOfStateSet : super.indexOfStateSet(StateSet.WILD_CARD); | ||||
|         } | ||||
|  | ||||
|         int getKeyframeIdAt(int i) { | ||||
|             if (i < 0) { | ||||
|                 return 0; | ||||
|             } | ||||
|             return this.mStateIds.get(i, 0).intValue(); | ||||
|         } | ||||
|  | ||||
|         int indexOfTransition(int i, int i2) { | ||||
|             return (int) this.mTransitions.get(generateTransitionKey(i, i2), -1L).longValue(); | ||||
|         } | ||||
|  | ||||
|         boolean isTransitionReversed(int i, int i2) { | ||||
|             return (this.mTransitions.get(generateTransitionKey(i, i2), -1L).longValue() & REVERSED_BIT) != 0; | ||||
|         } | ||||
|  | ||||
|         boolean transitionHasReversibleFlag(int i, int i2) { | ||||
|             return (this.mTransitions.get(generateTransitionKey(i, i2), -1L).longValue() & REVERSIBLE_FLAG_BIT) != 0; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat.StateListState, android.graphics.drawable.Drawable.ConstantState | ||||
|         public Drawable newDrawable() { | ||||
|             return new AnimatedStateListDrawableCompat(this, null); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat.StateListState, android.graphics.drawable.Drawable.ConstantState | ||||
|         public Drawable newDrawable(Resources resources) { | ||||
|             return new AnimatedStateListDrawableCompat(this, resources); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.StateListDrawableCompat, androidx.appcompat.graphics.drawable.DrawableContainerCompat | ||||
|     void setConstantState(DrawableContainerCompat.DrawableContainerState drawableContainerState) { | ||||
|         super.setConstantState(drawableContainerState); | ||||
|         if (drawableContainerState instanceof AnimatedStateListState) { | ||||
|             this.mState = (AnimatedStateListState) drawableContainerState; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class FrameInterpolator implements TimeInterpolator { | ||||
|         private int[] mFrameTimes; | ||||
|         private int mFrames; | ||||
|         private int mTotalDuration; | ||||
|  | ||||
|         int getTotalDuration() { | ||||
|             return this.mTotalDuration; | ||||
|         } | ||||
|  | ||||
|         FrameInterpolator(AnimationDrawable animationDrawable, boolean z) { | ||||
|             updateFrames(animationDrawable, z); | ||||
|         } | ||||
|  | ||||
|         int updateFrames(AnimationDrawable animationDrawable, boolean z) { | ||||
|             int numberOfFrames = animationDrawable.getNumberOfFrames(); | ||||
|             this.mFrames = numberOfFrames; | ||||
|             int[] iArr = this.mFrameTimes; | ||||
|             if (iArr == null || iArr.length < numberOfFrames) { | ||||
|                 this.mFrameTimes = new int[numberOfFrames]; | ||||
|             } | ||||
|             int[] iArr2 = this.mFrameTimes; | ||||
|             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.mTotalDuration = i; | ||||
|             return i; | ||||
|         } | ||||
|  | ||||
|         @Override // android.animation.TimeInterpolator | ||||
|         public float getInterpolation(float f) { | ||||
|             int i = (int) ((f * this.mTotalDuration) + 0.5f); | ||||
|             int i2 = this.mFrames; | ||||
|             int[] iArr = this.mFrameTimes; | ||||
|             int i3 = 0; | ||||
|             while (i3 < i2) { | ||||
|                 int i4 = iArr[i3]; | ||||
|                 if (i < i4) { | ||||
|                     break; | ||||
|                 } | ||||
|                 i -= i4; | ||||
|                 i3++; | ||||
|             } | ||||
|             return (i3 / i2) + (i3 < i2 ? i / this.mTotalDuration : 0.0f); | ||||
|         } | ||||
|     } | ||||
| } | ||||
										
											
												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 DrawableWrapperCompat extends Drawable implements Drawable.Callback { | ||||
|     private Drawable mDrawable; | ||||
|  | ||||
|     public Drawable getDrawable() { | ||||
|         return this.mDrawable; | ||||
|     } | ||||
|  | ||||
|     public DrawableWrapperCompat(Drawable drawable) { | ||||
|         setDrawable(drawable); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void draw(Canvas canvas) { | ||||
|         this.mDrawable.draw(canvas); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     protected void onBoundsChange(Rect rect) { | ||||
|         this.mDrawable.setBounds(rect); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setChangingConfigurations(int i) { | ||||
|         this.mDrawable.setChangingConfigurations(i); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getChangingConfigurations() { | ||||
|         return this.mDrawable.getChangingConfigurations(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setDither(boolean z) { | ||||
|         this.mDrawable.setDither(z); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setFilterBitmap(boolean z) { | ||||
|         this.mDrawable.setFilterBitmap(z); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setAlpha(int i) { | ||||
|         this.mDrawable.setAlpha(i); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setColorFilter(ColorFilter colorFilter) { | ||||
|         this.mDrawable.setColorFilter(colorFilter); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean isStateful() { | ||||
|         return this.mDrawable.isStateful(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean setState(int[] iArr) { | ||||
|         return this.mDrawable.setState(iArr); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int[] getState() { | ||||
|         return this.mDrawable.getState(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void jumpToCurrentState() { | ||||
|         this.mDrawable.jumpToCurrentState(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public Drawable getCurrent() { | ||||
|         return this.mDrawable.getCurrent(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean setVisible(boolean z, boolean z2) { | ||||
|         return super.setVisible(z, z2) || this.mDrawable.setVisible(z, z2); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getOpacity() { | ||||
|         return this.mDrawable.getOpacity(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public Region getTransparentRegion() { | ||||
|         return this.mDrawable.getTransparentRegion(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getIntrinsicWidth() { | ||||
|         return this.mDrawable.getIntrinsicWidth(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getIntrinsicHeight() { | ||||
|         return this.mDrawable.getIntrinsicHeight(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getMinimumWidth() { | ||||
|         return this.mDrawable.getMinimumWidth(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getMinimumHeight() { | ||||
|         return this.mDrawable.getMinimumHeight(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean getPadding(Rect rect) { | ||||
|         return this.mDrawable.getPadding(rect); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable.Callback | ||||
|     public void invalidateDrawable(Drawable drawable) { | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable.Callback | ||||
|     public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) { | ||||
|         scheduleSelf(runnable, j); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable.Callback | ||||
|     public void unscheduleDrawable(Drawable drawable, Runnable runnable) { | ||||
|         unscheduleSelf(runnable); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     protected boolean onLevelChange(int i) { | ||||
|         return this.mDrawable.setLevel(i); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setAutoMirrored(boolean z) { | ||||
|         DrawableCompat.setAutoMirrored(this.mDrawable, z); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean isAutoMirrored() { | ||||
|         return DrawableCompat.isAutoMirrored(this.mDrawable); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setTint(int i) { | ||||
|         DrawableCompat.setTint(this.mDrawable, i); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setTintList(ColorStateList colorStateList) { | ||||
|         DrawableCompat.setTintList(this.mDrawable, colorStateList); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setTintMode(PorterDuff.Mode mode) { | ||||
|         DrawableCompat.setTintMode(this.mDrawable, mode); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setHotspot(float f, float f2) { | ||||
|         DrawableCompat.setHotspot(this.mDrawable, f, f2); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setHotspotBounds(int i, int i2, int i3, int i4) { | ||||
|         DrawableCompat.setHotspotBounds(this.mDrawable, i, i2, i3, i4); | ||||
|     } | ||||
|  | ||||
|     public void setDrawable(Drawable drawable) { | ||||
|         Drawable drawable2 = this.mDrawable; | ||||
|         if (drawable2 != null) { | ||||
|             drawable2.setCallback(null); | ||||
|         } | ||||
|         this.mDrawable = drawable; | ||||
|         if (drawable != null) { | ||||
|             drawable.setCallback(this); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,247 @@ | ||||
| package androidx.appcompat.graphics.drawable; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.content.res.TypedArray; | ||||
| import android.graphics.Canvas; | ||||
| import android.graphics.ColorFilter; | ||||
| import android.graphics.Paint; | ||||
| import android.graphics.Path; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import androidx.appcompat.R; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class DrawerArrowDrawable extends Drawable { | ||||
|     public static final int ARROW_DIRECTION_END = 3; | ||||
|     public static final int ARROW_DIRECTION_LEFT = 0; | ||||
|     public static final int ARROW_DIRECTION_RIGHT = 1; | ||||
|     public static final int ARROW_DIRECTION_START = 2; | ||||
|     private static final float ARROW_HEAD_ANGLE = (float) Math.toRadians(45.0d); | ||||
|     private float mArrowHeadLength; | ||||
|     private float mArrowShaftLength; | ||||
|     private float mBarGap; | ||||
|     private float mBarLength; | ||||
|     private int mDirection; | ||||
|     private float mMaxCutForBarSize; | ||||
|     private final Paint mPaint; | ||||
|     private final Path mPath; | ||||
|     private float mProgress; | ||||
|     private final int mSize; | ||||
|     private boolean mSpin; | ||||
|     private boolean mVerticalMirror; | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface ArrowDirection { | ||||
|     } | ||||
|  | ||||
|     private static float lerp(float f, float f2, float f3) { | ||||
|         return f + ((f2 - f) * f3); | ||||
|     } | ||||
|  | ||||
|     public float getArrowHeadLength() { | ||||
|         return this.mArrowHeadLength; | ||||
|     } | ||||
|  | ||||
|     public float getArrowShaftLength() { | ||||
|         return this.mArrowShaftLength; | ||||
|     } | ||||
|  | ||||
|     public float getBarLength() { | ||||
|         return this.mBarLength; | ||||
|     } | ||||
|  | ||||
|     public int getDirection() { | ||||
|         return this.mDirection; | ||||
|     } | ||||
|  | ||||
|     public float getGapSize() { | ||||
|         return this.mBarGap; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getIntrinsicHeight() { | ||||
|         return this.mSize; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getIntrinsicWidth() { | ||||
|         return this.mSize; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getOpacity() { | ||||
|         return -3; | ||||
|     } | ||||
|  | ||||
|     public final Paint getPaint() { | ||||
|         return this.mPaint; | ||||
|     } | ||||
|  | ||||
|     public float getProgress() { | ||||
|         return this.mProgress; | ||||
|     } | ||||
|  | ||||
|     public boolean isSpinEnabled() { | ||||
|         return this.mSpin; | ||||
|     } | ||||
|  | ||||
|     public DrawerArrowDrawable(Context context) { | ||||
|         Paint paint = new Paint(); | ||||
|         this.mPaint = paint; | ||||
|         this.mPath = new Path(); | ||||
|         this.mVerticalMirror = false; | ||||
|         this.mDirection = 2; | ||||
|         paint.setStyle(Paint.Style.STROKE); | ||||
|         paint.setStrokeJoin(Paint.Join.MITER); | ||||
|         paint.setStrokeCap(Paint.Cap.BUTT); | ||||
|         paint.setAntiAlias(true); | ||||
|         TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(null, R.styleable.DrawerArrowToggle, R.attr.drawerArrowStyle, R.style.Base_Widget_AppCompat_DrawerArrowToggle); | ||||
|         setColor(obtainStyledAttributes.getColor(R.styleable.DrawerArrowToggle_color, 0)); | ||||
|         setBarThickness(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_thickness, 0.0f)); | ||||
|         setSpinEnabled(obtainStyledAttributes.getBoolean(R.styleable.DrawerArrowToggle_spinBars, true)); | ||||
|         setGapSize(Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_gapBetweenBars, 0.0f))); | ||||
|         this.mSize = obtainStyledAttributes.getDimensionPixelSize(R.styleable.DrawerArrowToggle_drawableSize, 0); | ||||
|         this.mBarLength = Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_barLength, 0.0f)); | ||||
|         this.mArrowHeadLength = Math.round(obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_arrowHeadLength, 0.0f)); | ||||
|         this.mArrowShaftLength = obtainStyledAttributes.getDimension(R.styleable.DrawerArrowToggle_arrowShaftLength, 0.0f); | ||||
|         obtainStyledAttributes.recycle(); | ||||
|     } | ||||
|  | ||||
|     public void setArrowHeadLength(float f) { | ||||
|         if (this.mArrowHeadLength != f) { | ||||
|             this.mArrowHeadLength = f; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setArrowShaftLength(float f) { | ||||
|         if (this.mArrowShaftLength != f) { | ||||
|             this.mArrowShaftLength = f; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setBarLength(float f) { | ||||
|         if (this.mBarLength != f) { | ||||
|             this.mBarLength = f; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setColor(int i) { | ||||
|         if (i != this.mPaint.getColor()) { | ||||
|             this.mPaint.setColor(i); | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public int getColor() { | ||||
|         return this.mPaint.getColor(); | ||||
|     } | ||||
|  | ||||
|     public void setBarThickness(float f) { | ||||
|         if (this.mPaint.getStrokeWidth() != f) { | ||||
|             this.mPaint.setStrokeWidth(f); | ||||
|             this.mMaxCutForBarSize = (float) ((f / 2.0f) * Math.cos(ARROW_HEAD_ANGLE)); | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getBarThickness() { | ||||
|         return this.mPaint.getStrokeWidth(); | ||||
|     } | ||||
|  | ||||
|     public void setGapSize(float f) { | ||||
|         if (f != this.mBarGap) { | ||||
|             this.mBarGap = f; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setDirection(int i) { | ||||
|         if (i != this.mDirection) { | ||||
|             this.mDirection = i; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setSpinEnabled(boolean z) { | ||||
|         if (this.mSpin != z) { | ||||
|             this.mSpin = z; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setVerticalMirror(boolean z) { | ||||
|         if (this.mVerticalMirror != z) { | ||||
|             this.mVerticalMirror = z; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void draw(Canvas canvas) { | ||||
|         Rect bounds = getBounds(); | ||||
|         int i = this.mDirection; | ||||
|         boolean z = false; | ||||
|         if (i != 0 && (i == 1 || (i == 3 ? DrawableCompat.getLayoutDirection(this) == 0 : DrawableCompat.getLayoutDirection(this) == 1))) { | ||||
|             z = true; | ||||
|         } | ||||
|         float f = this.mArrowHeadLength; | ||||
|         float lerp = lerp(this.mBarLength, (float) Math.sqrt(f * f * 2.0f), this.mProgress); | ||||
|         float lerp2 = lerp(this.mBarLength, this.mArrowShaftLength, this.mProgress); | ||||
|         float round = Math.round(lerp(0.0f, this.mMaxCutForBarSize, this.mProgress)); | ||||
|         float lerp3 = lerp(0.0f, ARROW_HEAD_ANGLE, this.mProgress); | ||||
|         float lerp4 = lerp(z ? 0.0f : -180.0f, z ? 180.0f : 0.0f, this.mProgress); | ||||
|         double d = lerp; | ||||
|         double d2 = lerp3; | ||||
|         boolean z2 = z; | ||||
|         float round2 = Math.round(Math.cos(d2) * d); | ||||
|         float round3 = Math.round(d * Math.sin(d2)); | ||||
|         this.mPath.rewind(); | ||||
|         float lerp5 = lerp(this.mBarGap + this.mPaint.getStrokeWidth(), -this.mMaxCutForBarSize, this.mProgress); | ||||
|         float f2 = (-lerp2) / 2.0f; | ||||
|         this.mPath.moveTo(f2 + round, 0.0f); | ||||
|         this.mPath.rLineTo(lerp2 - (round * 2.0f), 0.0f); | ||||
|         this.mPath.moveTo(f2, lerp5); | ||||
|         this.mPath.rLineTo(round2, round3); | ||||
|         this.mPath.moveTo(f2, -lerp5); | ||||
|         this.mPath.rLineTo(round2, -round3); | ||||
|         this.mPath.close(); | ||||
|         canvas.save(); | ||||
|         float strokeWidth = this.mPaint.getStrokeWidth(); | ||||
|         float height = bounds.height() - (3.0f * strokeWidth); | ||||
|         canvas.translate(bounds.centerX(), ((((int) (height - (2.0f * r5))) / 4) * 2) + (strokeWidth * 1.5f) + this.mBarGap); | ||||
|         if (this.mSpin) { | ||||
|             canvas.rotate(lerp4 * (this.mVerticalMirror ^ z2 ? -1 : 1)); | ||||
|         } else if (z2) { | ||||
|             canvas.rotate(180.0f); | ||||
|         } | ||||
|         canvas.drawPath(this.mPath, this.mPaint); | ||||
|         canvas.restore(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setAlpha(int i) { | ||||
|         if (i != this.mPaint.getAlpha()) { | ||||
|             this.mPaint.setAlpha(i); | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setColorFilter(ColorFilter colorFilter) { | ||||
|         this.mPaint.setColorFilter(colorFilter); | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     public void setProgress(float f) { | ||||
|         if (this.mProgress != f) { | ||||
|             this.mProgress = f; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,246 @@ | ||||
| package androidx.appcompat.graphics.drawable; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.content.res.Resources; | ||||
| import android.content.res.TypedArray; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.StateSet; | ||||
| import androidx.appcompat.graphics.drawable.DrawableContainerCompat; | ||||
| import androidx.appcompat.resources.Compatibility; | ||||
| import androidx.appcompat.resources.R; | ||||
| import androidx.appcompat.widget.ResourceManagerInternal; | ||||
| import androidx.core.content.res.TypedArrayUtils; | ||||
| import java.io.IOException; | ||||
| import org.xmlpull.v1.XmlPullParser; | ||||
| import org.xmlpull.v1.XmlPullParserException; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class StateListDrawableCompat extends DrawableContainerCompat { | ||||
|     private static final boolean DEBUG = false; | ||||
|     private static final String TAG = "StateListDrawableCompat"; | ||||
|     private boolean mMutated; | ||||
|     private StateListState mStateListState; | ||||
|  | ||||
|     StateListState getStateListState() { | ||||
|         return this.mStateListState; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     public boolean isStateful() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public StateListDrawableCompat() { | ||||
|         this(null, null); | ||||
|     } | ||||
|  | ||||
|     public void addState(int[] iArr, Drawable drawable) { | ||||
|         if (drawable != null) { | ||||
|             this.mStateListState.addStateSet(iArr, drawable); | ||||
|             onStateChange(getState()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     protected boolean onStateChange(int[] iArr) { | ||||
|         boolean onStateChange = super.onStateChange(iArr); | ||||
|         int indexOfStateSet = this.mStateListState.indexOfStateSet(iArr); | ||||
|         if (indexOfStateSet < 0) { | ||||
|             indexOfStateSet = this.mStateListState.indexOfStateSet(StateSet.WILD_CARD); | ||||
|         } | ||||
|         return selectDrawable(indexOfStateSet) || onStateChange; | ||||
|     } | ||||
|  | ||||
|     public void inflate(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException { | ||||
|         TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.StateListDrawable); | ||||
|         setVisible(obtainAttributes.getBoolean(R.styleable.StateListDrawable_android_visible, true), true); | ||||
|         updateStateFromTypedArray(obtainAttributes); | ||||
|         updateDensity(resources); | ||||
|         obtainAttributes.recycle(); | ||||
|         inflateChildElements(context, resources, xmlPullParser, attributeSet, theme); | ||||
|         onStateChange(getState()); | ||||
|     } | ||||
|  | ||||
|     private void updateStateFromTypedArray(TypedArray typedArray) { | ||||
|         StateListState stateListState = this.mStateListState; | ||||
|         stateListState.mChangingConfigurations |= Compatibility.Api21Impl.getChangingConfigurations(typedArray); | ||||
|         stateListState.mVariablePadding = typedArray.getBoolean(R.styleable.StateListDrawable_android_variablePadding, stateListState.mVariablePadding); | ||||
|         stateListState.mConstantSize = typedArray.getBoolean(R.styleable.StateListDrawable_android_constantSize, stateListState.mConstantSize); | ||||
|         stateListState.mEnterFadeDuration = typedArray.getInt(R.styleable.StateListDrawable_android_enterFadeDuration, stateListState.mEnterFadeDuration); | ||||
|         stateListState.mExitFadeDuration = typedArray.getInt(R.styleable.StateListDrawable_android_exitFadeDuration, stateListState.mExitFadeDuration); | ||||
|         stateListState.mDither = typedArray.getBoolean(R.styleable.StateListDrawable_android_dither, stateListState.mDither); | ||||
|     } | ||||
|  | ||||
|     private void inflateChildElements(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException { | ||||
|         int next; | ||||
|         StateListState stateListState = this.mStateListState; | ||||
|         int depth = xmlPullParser.getDepth() + 1; | ||||
|         while (true) { | ||||
|             int next2 = xmlPullParser.next(); | ||||
|             if (next2 == 1) { | ||||
|                 return; | ||||
|             } | ||||
|             int depth2 = xmlPullParser.getDepth(); | ||||
|             if (depth2 < depth && next2 == 3) { | ||||
|                 return; | ||||
|             } | ||||
|             if (next2 == 2 && depth2 <= depth && xmlPullParser.getName().equals("item")) { | ||||
|                 TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.StateListDrawableItem); | ||||
|                 int resourceId = obtainAttributes.getResourceId(R.styleable.StateListDrawableItem_android_drawable, -1); | ||||
|                 Drawable drawable = resourceId > 0 ? ResourceManagerInternal.get().getDrawable(context, resourceId) : null; | ||||
|                 obtainAttributes.recycle(); | ||||
|                 int[] extractStateSet = extractStateSet(attributeSet); | ||||
|                 if (drawable == 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"); | ||||
|                     } | ||||
|                     drawable = Compatibility.Api21Impl.createFromXmlInner(resources, xmlPullParser, attributeSet, theme); | ||||
|                 } | ||||
|                 stateListState.addStateSet(extractStateSet, drawable); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     int[] extractStateSet(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); | ||||
|     } | ||||
|  | ||||
|     int getStateCount() { | ||||
|         return this.mStateListState.getChildCount(); | ||||
|     } | ||||
|  | ||||
|     int[] getStateSet(int i) { | ||||
|         return this.mStateListState.mStateSets[i]; | ||||
|     } | ||||
|  | ||||
|     Drawable getStateDrawable(int i) { | ||||
|         return this.mStateListState.getChild(i); | ||||
|     } | ||||
|  | ||||
|     int getStateDrawableIndex(int[] iArr) { | ||||
|         return this.mStateListState.indexOfStateSet(iArr); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     public Drawable mutate() { | ||||
|         if (!this.mMutated && super.mutate() == this) { | ||||
|             this.mStateListState.mutate(); | ||||
|             this.mMutated = true; | ||||
|         } | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: package-private */ | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat | ||||
|     public StateListState cloneConstantState() { | ||||
|         return new StateListState(this.mStateListState, this, null); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat | ||||
|     void clearMutated() { | ||||
|         super.clearMutated(); | ||||
|         this.mMutated = false; | ||||
|     } | ||||
|  | ||||
|     static class StateListState extends DrawableContainerCompat.DrawableContainerState { | ||||
|         int[][] mStateSets; | ||||
|  | ||||
|         StateListState(StateListState stateListState, StateListDrawableCompat stateListDrawableCompat, Resources resources) { | ||||
|             super(stateListState, stateListDrawableCompat, resources); | ||||
|             if (stateListState != null) { | ||||
|                 this.mStateSets = stateListState.mStateSets; | ||||
|             } else { | ||||
|                 this.mStateSets = new int[getCapacity()][]; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat.DrawableContainerState | ||||
|         void mutate() { | ||||
|             int[][] iArr = this.mStateSets; | ||||
|             int[][] iArr2 = new int[iArr.length][]; | ||||
|             for (int length = iArr.length - 1; length >= 0; length--) { | ||||
|                 int[] iArr3 = this.mStateSets[length]; | ||||
|                 iArr2[length] = iArr3 != null ? (int[]) iArr3.clone() : null; | ||||
|             } | ||||
|             this.mStateSets = iArr2; | ||||
|         } | ||||
|  | ||||
|         int addStateSet(int[] iArr, Drawable drawable) { | ||||
|             int addChild = addChild(drawable); | ||||
|             this.mStateSets[addChild] = iArr; | ||||
|             return addChild; | ||||
|         } | ||||
|  | ||||
|         int indexOfStateSet(int[] iArr) { | ||||
|             int[][] iArr2 = this.mStateSets; | ||||
|             int childCount = getChildCount(); | ||||
|             for (int i = 0; i < childCount; i++) { | ||||
|                 if (StateSet.stateSetMatches(iArr2[i], iArr)) { | ||||
|                     return i; | ||||
|                 } | ||||
|             } | ||||
|             return -1; | ||||
|         } | ||||
|  | ||||
|         @Override // android.graphics.drawable.Drawable.ConstantState | ||||
|         public Drawable newDrawable() { | ||||
|             return new StateListDrawableCompat(this, null); | ||||
|         } | ||||
|  | ||||
|         @Override // android.graphics.drawable.Drawable.ConstantState | ||||
|         public Drawable newDrawable(Resources resources) { | ||||
|             return new StateListDrawableCompat(this, resources); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat.DrawableContainerState | ||||
|         public void growArray(int i, int i2) { | ||||
|             super.growArray(i, i2); | ||||
|             int[][] iArr = new int[i2][]; | ||||
|             System.arraycopy(this.mStateSets, 0, iArr, 0, i); | ||||
|             this.mStateSets = iArr; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat, android.graphics.drawable.Drawable | ||||
|     public void applyTheme(Resources.Theme theme) { | ||||
|         super.applyTheme(theme); | ||||
|         onStateChange(getState()); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.graphics.drawable.DrawableContainerCompat | ||||
|     void setConstantState(DrawableContainerCompat.DrawableContainerState drawableContainerState) { | ||||
|         super.setConstantState(drawableContainerState); | ||||
|         if (drawableContainerState instanceof StateListState) { | ||||
|             this.mStateListState = (StateListState) drawableContainerState; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     StateListDrawableCompat(StateListState stateListState, Resources resources) { | ||||
|         setConstantState(new StateListState(stateListState, this, resources)); | ||||
|         onStateChange(getState()); | ||||
|     } | ||||
|  | ||||
|     StateListDrawableCompat(StateListState stateListState) { | ||||
|         if (stateListState != null) { | ||||
|             setConstantState(stateListState); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user