ADD week 5

This commit is contained in:
2025-03-31 16:33:42 +02:00
parent 86f265f22d
commit bf645048e6
4927 changed files with 544053 additions and 0 deletions

View File

@ -0,0 +1,13 @@
package com.google.android.material.animation;
/* loaded from: classes.dex */
public interface AnimatableView {
public interface Listener {
void onAnimationEnd();
}
void startAnimation(Listener listener);
void stopAnimation();
}

View File

@ -0,0 +1,29 @@
package com.google.android.material.animation;
import android.animation.TimeInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import androidx.interpolator.view.animation.FastOutLinearInInterpolator;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
/* loaded from: classes.dex */
public class AnimationUtils {
public static final TimeInterpolator LINEAR_INTERPOLATOR = new LinearInterpolator();
public static final TimeInterpolator FAST_OUT_SLOW_IN_INTERPOLATOR = new FastOutSlowInInterpolator();
public static final TimeInterpolator FAST_OUT_LINEAR_IN_INTERPOLATOR = new FastOutLinearInInterpolator();
public static final TimeInterpolator LINEAR_OUT_SLOW_IN_INTERPOLATOR = new LinearOutSlowInInterpolator();
public static final TimeInterpolator DECELERATE_INTERPOLATOR = new DecelerateInterpolator();
public static float lerp(float f, float f2, float f3) {
return f + (f3 * (f2 - f));
}
public static int lerp(int i, int i2, float f) {
return i + Math.round(f * (i2 - i));
}
public static float lerp(float f, float f2, float f3, float f4, float f5) {
return f5 <= f3 ? f : f5 >= f4 ? f2 : lerp(f, f2, (f5 - f3) / (f4 - f3));
}
}

View File

@ -0,0 +1,22 @@
package com.google.android.material.animation;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatorSetCompat {
public static void playTogether(AnimatorSet animatorSet, List<Animator> list) {
int size = list.size();
long j = 0;
for (int i = 0; i < size; i++) {
Animator animator = list.get(i);
j = Math.max(j, animator.getStartDelay() + animator.getDuration());
}
ValueAnimator ofInt = ValueAnimator.ofInt(0, 0);
ofInt.setDuration(j);
list.add(0, ofInt);
animatorSet.playTogether(list);
}
}

View File

@ -0,0 +1,27 @@
package com.google.android.material.animation;
import android.animation.TypeEvaluator;
/* loaded from: classes.dex */
public class ArgbEvaluatorCompat implements TypeEvaluator<Integer> {
private static final ArgbEvaluatorCompat instance = new ArgbEvaluatorCompat();
public static ArgbEvaluatorCompat getInstance() {
return instance;
}
@Override // android.animation.TypeEvaluator
public Integer evaluate(float f, Integer num, Integer num2) {
int intValue = num.intValue();
float f2 = ((intValue >> 24) & 255) / 255.0f;
int intValue2 = num2.intValue();
float pow = (float) Math.pow(((intValue >> 16) & 255) / 255.0f, 2.2d);
float pow2 = (float) Math.pow(((intValue >> 8) & 255) / 255.0f, 2.2d);
float pow3 = (float) Math.pow((intValue & 255) / 255.0f, 2.2d);
float pow4 = (float) Math.pow(((intValue2 >> 16) & 255) / 255.0f, 2.2d);
float f3 = f2 + (((((intValue2 >> 24) & 255) / 255.0f) - f2) * f);
float pow5 = pow2 + ((((float) Math.pow(((intValue2 >> 8) & 255) / 255.0f, 2.2d)) - pow2) * f);
float pow6 = pow3 + (f * (((float) Math.pow((intValue2 & 255) / 255.0f, 2.2d)) - pow3));
return Integer.valueOf((Math.round(((float) Math.pow(pow + ((pow4 - pow) * f), 0.45454545454545453d)) * 255.0f) << 16) | (Math.round(f3 * 255.0f) << 24) | (Math.round(((float) Math.pow(pow5, 0.45454545454545453d)) * 255.0f) << 8) | Math.round(((float) Math.pow(pow6, 0.45454545454545453d)) * 255.0f));
}
}

View File

@ -0,0 +1,30 @@
package com.google.android.material.animation;
import android.util.Property;
import android.view.ViewGroup;
import com.google.android.material.R;
/* loaded from: classes.dex */
public class ChildrenAlphaProperty extends Property<ViewGroup, Float> {
public static final Property<ViewGroup, Float> CHILDREN_ALPHA = new ChildrenAlphaProperty("childrenAlpha");
private ChildrenAlphaProperty(String str) {
super(Float.class, str);
}
@Override // android.util.Property
public Float get(ViewGroup viewGroup) {
Float f = (Float) viewGroup.getTag(R.id.mtrl_internal_children_alpha_tag);
return f != null ? f : Float.valueOf(1.0f);
}
@Override // android.util.Property
public void set(ViewGroup viewGroup, Float f) {
float floatValue = f.floatValue();
viewGroup.setTag(R.id.mtrl_internal_children_alpha_tag, Float.valueOf(floatValue));
int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
viewGroup.getChildAt(i).setAlpha(floatValue);
}
}
}

View File

@ -0,0 +1,26 @@
package com.google.android.material.animation;
import android.graphics.drawable.Drawable;
import android.util.Property;
import java.util.WeakHashMap;
/* loaded from: classes.dex */
public class DrawableAlphaProperty extends Property<Drawable, Integer> {
public static final Property<Drawable, Integer> DRAWABLE_ALPHA_COMPAT = new DrawableAlphaProperty();
private final WeakHashMap<Drawable, Integer> alphaCache;
private DrawableAlphaProperty() {
super(Integer.class, "drawableAlphaCompat");
this.alphaCache = new WeakHashMap<>();
}
@Override // android.util.Property
public Integer get(Drawable drawable) {
return Integer.valueOf(drawable.getAlpha());
}
@Override // android.util.Property
public void set(Drawable drawable, Integer num) {
drawable.setAlpha(num.intValue());
}
}

View File

@ -0,0 +1,26 @@
package com.google.android.material.animation;
import android.graphics.Matrix;
import android.util.Property;
import android.widget.ImageView;
/* loaded from: classes.dex */
public class ImageMatrixProperty extends Property<ImageView, Matrix> {
private final Matrix matrix;
public ImageMatrixProperty() {
super(Matrix.class, "imageMatrixProperty");
this.matrix = new Matrix();
}
@Override // android.util.Property
public void set(ImageView imageView, Matrix matrix) {
imageView.setImageMatrix(matrix);
}
@Override // android.util.Property
public Matrix get(ImageView imageView) {
this.matrix.set(imageView.getImageMatrix());
return this.matrix;
}
}

View File

@ -0,0 +1,25 @@
package com.google.android.material.animation;
import android.animation.TypeEvaluator;
import android.graphics.Matrix;
/* loaded from: classes.dex */
public class MatrixEvaluator implements TypeEvaluator<Matrix> {
private final float[] tempStartValues = new float[9];
private final float[] tempEndValues = new float[9];
private final Matrix tempMatrix = new Matrix();
@Override // android.animation.TypeEvaluator
public Matrix evaluate(float f, Matrix matrix, Matrix matrix2) {
matrix.getValues(this.tempStartValues);
matrix2.getValues(this.tempEndValues);
for (int i = 0; i < 9; i++) {
float[] fArr = this.tempEndValues;
float f2 = fArr[i];
float f3 = this.tempStartValues[i];
fArr[i] = f3 + ((f2 - f3) * f);
}
this.tempMatrix.setValues(this.tempEndValues);
return this.tempMatrix;
}
}

View File

@ -0,0 +1,139 @@
package com.google.android.material.animation;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.Log;
import android.util.Property;
import androidx.collection.SimpleArrayMap;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class MotionSpec {
private static final String TAG = "MotionSpec";
private final SimpleArrayMap<String, MotionTiming> timings = new SimpleArrayMap<>();
private final SimpleArrayMap<String, PropertyValuesHolder[]> propertyValues = new SimpleArrayMap<>();
public boolean hasTiming(String str) {
return this.timings.get(str) != null;
}
public MotionTiming getTiming(String str) {
if (!hasTiming(str)) {
throw new IllegalArgumentException();
}
return this.timings.get(str);
}
public void setTiming(String str, MotionTiming motionTiming) {
this.timings.put(str, motionTiming);
}
public boolean hasPropertyValues(String str) {
return this.propertyValues.get(str) != null;
}
public PropertyValuesHolder[] getPropertyValues(String str) {
if (!hasPropertyValues(str)) {
throw new IllegalArgumentException();
}
return clonePropertyValuesHolder(this.propertyValues.get(str));
}
public void setPropertyValues(String str, PropertyValuesHolder[] propertyValuesHolderArr) {
this.propertyValues.put(str, propertyValuesHolderArr);
}
private PropertyValuesHolder[] clonePropertyValuesHolder(PropertyValuesHolder[] propertyValuesHolderArr) {
PropertyValuesHolder[] propertyValuesHolderArr2 = new PropertyValuesHolder[propertyValuesHolderArr.length];
for (int i = 0; i < propertyValuesHolderArr.length; i++) {
propertyValuesHolderArr2[i] = propertyValuesHolderArr[i].clone();
}
return propertyValuesHolderArr2;
}
public <T> ObjectAnimator getAnimator(String str, T t, Property<T, ?> property) {
ObjectAnimator ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(t, getPropertyValues(str));
ofPropertyValuesHolder.setProperty(property);
getTiming(str).apply(ofPropertyValuesHolder);
return ofPropertyValuesHolder;
}
public long getTotalDuration() {
int size = this.timings.size();
long j = 0;
for (int i = 0; i < size; i++) {
MotionTiming valueAt = this.timings.valueAt(i);
j = Math.max(j, valueAt.getDelay() + valueAt.getDuration());
}
return j;
}
public static MotionSpec createFromAttribute(Context context, TypedArray typedArray, int i) {
int resourceId;
if (!typedArray.hasValue(i) || (resourceId = typedArray.getResourceId(i, 0)) == 0) {
return null;
}
return createFromResource(context, resourceId);
}
public static MotionSpec createFromResource(Context context, int i) {
try {
Animator loadAnimator = AnimatorInflater.loadAnimator(context, i);
if (loadAnimator instanceof AnimatorSet) {
return createSpecFromAnimators(((AnimatorSet) loadAnimator).getChildAnimations());
}
if (loadAnimator == null) {
return null;
}
ArrayList arrayList = new ArrayList();
arrayList.add(loadAnimator);
return createSpecFromAnimators(arrayList);
} catch (Exception e) {
Log.w(TAG, "Can't load animation resource ID #0x" + Integer.toHexString(i), e);
return null;
}
}
private static MotionSpec createSpecFromAnimators(List<Animator> list) {
MotionSpec motionSpec = new MotionSpec();
int size = list.size();
for (int i = 0; i < size; i++) {
addInfoFromAnimator(motionSpec, list.get(i));
}
return motionSpec;
}
private static void addInfoFromAnimator(MotionSpec motionSpec, Animator animator) {
if (animator instanceof ObjectAnimator) {
ObjectAnimator objectAnimator = (ObjectAnimator) animator;
motionSpec.setPropertyValues(objectAnimator.getPropertyName(), objectAnimator.getValues());
motionSpec.setTiming(objectAnimator.getPropertyName(), MotionTiming.createFromAnimator(objectAnimator));
} else {
throw new IllegalArgumentException("Animator must be an ObjectAnimator: " + animator);
}
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MotionSpec) {
return this.timings.equals(((MotionSpec) obj).timings);
}
return false;
}
public int hashCode() {
return this.timings.hashCode();
}
public String toString() {
return "\n" + getClass().getName() + '{' + Integer.toHexString(System.identityHashCode(this)) + " timings: " + this.timings + "}\n";
}
}

View File

@ -0,0 +1,105 @@
package com.google.android.material.animation;
import android.animation.Animator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
/* loaded from: classes.dex */
public class MotionTiming {
private long delay;
private long duration;
private TimeInterpolator interpolator;
private int repeatCount;
private int repeatMode;
public long getDelay() {
return this.delay;
}
public long getDuration() {
return this.duration;
}
public int getRepeatCount() {
return this.repeatCount;
}
public int getRepeatMode() {
return this.repeatMode;
}
public MotionTiming(long j, long j2) {
this.interpolator = null;
this.repeatCount = 0;
this.repeatMode = 1;
this.delay = j;
this.duration = j2;
}
public MotionTiming(long j, long j2, TimeInterpolator timeInterpolator) {
this.repeatCount = 0;
this.repeatMode = 1;
this.delay = j;
this.duration = j2;
this.interpolator = timeInterpolator;
}
public void apply(Animator animator) {
animator.setStartDelay(getDelay());
animator.setDuration(getDuration());
animator.setInterpolator(getInterpolator());
if (animator instanceof ValueAnimator) {
ValueAnimator valueAnimator = (ValueAnimator) animator;
valueAnimator.setRepeatCount(getRepeatCount());
valueAnimator.setRepeatMode(getRepeatMode());
}
}
public TimeInterpolator getInterpolator() {
TimeInterpolator timeInterpolator = this.interpolator;
return timeInterpolator != null ? timeInterpolator : AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR;
}
static MotionTiming createFromAnimator(ValueAnimator valueAnimator) {
MotionTiming motionTiming = new MotionTiming(valueAnimator.getStartDelay(), valueAnimator.getDuration(), getInterpolatorCompat(valueAnimator));
motionTiming.repeatCount = valueAnimator.getRepeatCount();
motionTiming.repeatMode = valueAnimator.getRepeatMode();
return motionTiming;
}
private static TimeInterpolator getInterpolatorCompat(ValueAnimator valueAnimator) {
TimeInterpolator interpolator = valueAnimator.getInterpolator();
if ((interpolator instanceof AccelerateDecelerateInterpolator) || interpolator == null) {
return AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR;
}
if (interpolator instanceof AccelerateInterpolator) {
return AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR;
}
return interpolator instanceof DecelerateInterpolator ? AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR : interpolator;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof MotionTiming)) {
return false;
}
MotionTiming motionTiming = (MotionTiming) obj;
if (getDelay() == motionTiming.getDelay() && getDuration() == motionTiming.getDuration() && getRepeatCount() == motionTiming.getRepeatCount() && getRepeatMode() == motionTiming.getRepeatMode()) {
return getInterpolator().getClass().equals(motionTiming.getInterpolator().getClass());
}
return false;
}
public int hashCode() {
return (((((((((int) (getDelay() ^ (getDelay() >>> 32))) * 31) + ((int) (getDuration() ^ (getDuration() >>> 32)))) * 31) + getInterpolator().getClass().hashCode()) * 31) + getRepeatCount()) * 31) + getRepeatMode();
}
public String toString() {
return "\n" + getClass().getName() + '{' + Integer.toHexString(System.identityHashCode(this)) + " delay: " + getDelay() + " duration: " + getDuration() + " interpolator: " + getInterpolator().getClass() + " repeatCount: " + getRepeatCount() + " repeatMode: " + getRepeatMode() + "}\n";
}
}

View File

@ -0,0 +1,14 @@
package com.google.android.material.animation;
/* loaded from: classes.dex */
public class Positioning {
public final int gravity;
public final float xAdjustment;
public final float yAdjustment;
public Positioning(int i, float f, float f2) {
this.gravity = i;
this.xAdjustment = f;
this.yAdjustment = f2;
}
}

View File

@ -0,0 +1,10 @@
package com.google.android.material.animation;
import android.view.View;
/* loaded from: classes.dex */
public interface TransformationCallback<T extends View> {
void onScaleChanged(T t);
void onTranslationChanged(T t);
}