ADD week 5
This commit is contained in:
		
							
								
								
									
										202
									
								
								02-Easy5/E5/sources/androidx/dynamicanimation/R.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										202
									
								
								02-Easy5/E5/sources/androidx/dynamicanimation/R.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,202 @@ | ||||
| package androidx.dynamicanimation; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class R { | ||||
|  | ||||
|     public static final class attr { | ||||
|         public static final int alpha = 0x7f03002e; | ||||
|         public static final int font = 0x7f0301fb; | ||||
|         public static final int fontProviderAuthority = 0x7f0301fd; | ||||
|         public static final int fontProviderCerts = 0x7f0301fe; | ||||
|         public static final int fontProviderFetchStrategy = 0x7f0301ff; | ||||
|         public static final int fontProviderFetchTimeout = 0x7f030200; | ||||
|         public static final int fontProviderPackage = 0x7f030201; | ||||
|         public static final int fontProviderQuery = 0x7f030202; | ||||
|         public static final int fontStyle = 0x7f030204; | ||||
|         public static final int fontVariationSettings = 0x7f030205; | ||||
|         public static final int fontWeight = 0x7f030206; | ||||
|         public static final int ttcIndex = 0x7f0304b6; | ||||
|  | ||||
|         private attr() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class color { | ||||
|         public static final int notification_action_color_filter = 0x7f0502e9; | ||||
|         public static final int notification_icon_bg_color = 0x7f0502ea; | ||||
|         public static final int ripple_material_light = 0x7f0502f7; | ||||
|         public static final int secondary_text_default_material_light = 0x7f0502f9; | ||||
|  | ||||
|         private color() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class dimen { | ||||
|         public static final int compat_button_inset_horizontal_material = 0x7f060058; | ||||
|         public static final int compat_button_inset_vertical_material = 0x7f060059; | ||||
|         public static final int compat_button_padding_horizontal_material = 0x7f06005a; | ||||
|         public static final int compat_button_padding_vertical_material = 0x7f06005b; | ||||
|         public static final int compat_control_corner_material = 0x7f06005c; | ||||
|         public static final int compat_notification_large_icon_max_height = 0x7f06005d; | ||||
|         public static final int compat_notification_large_icon_max_width = 0x7f06005e; | ||||
|         public static final int notification_action_icon_size = 0x7f060307; | ||||
|         public static final int notification_action_text_size = 0x7f060308; | ||||
|         public static final int notification_big_circle_margin = 0x7f060309; | ||||
|         public static final int notification_content_margin_start = 0x7f06030a; | ||||
|         public static final int notification_large_icon_height = 0x7f06030b; | ||||
|         public static final int notification_large_icon_width = 0x7f06030c; | ||||
|         public static final int notification_main_column_padding_top = 0x7f06030d; | ||||
|         public static final int notification_media_narrow_margin = 0x7f06030e; | ||||
|         public static final int notification_right_icon_size = 0x7f06030f; | ||||
|         public static final int notification_right_side_padding_top = 0x7f060310; | ||||
|         public static final int notification_small_icon_background_padding = 0x7f060311; | ||||
|         public static final int notification_small_icon_size_as_large = 0x7f060312; | ||||
|         public static final int notification_subtext_size = 0x7f060313; | ||||
|         public static final int notification_top_pad = 0x7f060314; | ||||
|         public static final int notification_top_pad_large_text = 0x7f060315; | ||||
|  | ||||
|         private dimen() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class drawable { | ||||
|         public static final int notification_action_background = 0x7f0700d0; | ||||
|         public static final int notification_bg = 0x7f0700d1; | ||||
|         public static final int notification_bg_low = 0x7f0700d2; | ||||
|         public static final int notification_bg_low_normal = 0x7f0700d3; | ||||
|         public static final int notification_bg_low_pressed = 0x7f0700d4; | ||||
|         public static final int notification_bg_normal = 0x7f0700d5; | ||||
|         public static final int notification_bg_normal_pressed = 0x7f0700d6; | ||||
|         public static final int notification_icon_background = 0x7f0700d7; | ||||
|         public static final int notification_template_icon_bg = 0x7f0700d8; | ||||
|         public static final int notification_template_icon_low_bg = 0x7f0700d9; | ||||
|         public static final int notification_tile_bg = 0x7f0700da; | ||||
|         public static final int notify_panel_notification_icon_bg = 0x7f0700db; | ||||
|  | ||||
|         private drawable() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class id { | ||||
|         public static final int action_container = 0x7f08003a; | ||||
|         public static final int action_divider = 0x7f08003c; | ||||
|         public static final int action_image = 0x7f08003d; | ||||
|         public static final int action_text = 0x7f080043; | ||||
|         public static final int actions = 0x7f080044; | ||||
|         public static final int async = 0x7f080052; | ||||
|         public static final int blocking = 0x7f08005c; | ||||
|         public static final int chronometer = 0x7f080071; | ||||
|         public static final int forever = 0x7f0800c2; | ||||
|         public static final int icon = 0x7f0800d4; | ||||
|         public static final int icon_group = 0x7f0800d5; | ||||
|         public static final int info = 0x7f0800dd; | ||||
|         public static final int italic = 0x7f0800e0; | ||||
|         public static final int line1 = 0x7f0800e9; | ||||
|         public static final int line3 = 0x7f0800ea; | ||||
|         public static final int normal = 0x7f080139; | ||||
|         public static final int notification_background = 0x7f08013b; | ||||
|         public static final int notification_main_column = 0x7f08013c; | ||||
|         public static final int notification_main_column_container = 0x7f08013d; | ||||
|         public static final int right_icon = 0x7f08016b; | ||||
|         public static final int right_side = 0x7f08016c; | ||||
|         public static final int tag_transition_group = 0x7f0801b6; | ||||
|         public static final int tag_unhandled_key_event_manager = 0x7f0801b7; | ||||
|         public static final int tag_unhandled_key_listeners = 0x7f0801b8; | ||||
|         public static final int text = 0x7f0801ba; | ||||
|         public static final int text2 = 0x7f0801bb; | ||||
|         public static final int time = 0x7f0801ca; | ||||
|         public static final int title = 0x7f0801cb; | ||||
|  | ||||
|         private id() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class integer { | ||||
|         public static final int status_bar_notification_info_maxnum = 0x7f090043; | ||||
|  | ||||
|         private integer() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class layout { | ||||
|         public static final int notification_action = 0x7f0b0060; | ||||
|         public static final int notification_action_tombstone = 0x7f0b0061; | ||||
|         public static final int notification_template_custom_big = 0x7f0b0062; | ||||
|         public static final int notification_template_icon_group = 0x7f0b0063; | ||||
|         public static final int notification_template_part_chronometer = 0x7f0b0064; | ||||
|         public static final int notification_template_part_time = 0x7f0b0065; | ||||
|  | ||||
|         private layout() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class string { | ||||
|         public static final int status_bar_notification_info_overflow = 0x7f0f00a8; | ||||
|  | ||||
|         private string() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class style { | ||||
|         public static final int TextAppearance_Compat_Notification = 0x7f1001c3; | ||||
|         public static final int TextAppearance_Compat_Notification_Info = 0x7f1001c4; | ||||
|         public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1001c5; | ||||
|         public static final int TextAppearance_Compat_Notification_Time = 0x7f1001c6; | ||||
|         public static final int TextAppearance_Compat_Notification_Title = 0x7f1001c7; | ||||
|         public static final int Widget_Compat_NotificationActionContainer = 0x7f10032d; | ||||
|         public static final int Widget_Compat_NotificationActionText = 0x7f10032e; | ||||
|  | ||||
|         private style() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class styleable { | ||||
|         public static final int ColorStateListItem_alpha = 0x00000003; | ||||
|         public static final int ColorStateListItem_android_alpha = 0x00000001; | ||||
|         public static final int ColorStateListItem_android_color = 0x00000000; | ||||
|         public static final int ColorStateListItem_android_lStar = 0x00000002; | ||||
|         public static final int ColorStateListItem_lStar = 0x00000004; | ||||
|         public static final int FontFamilyFont_android_font = 0x00000000; | ||||
|         public static final int FontFamilyFont_android_fontStyle = 0x00000002; | ||||
|         public static final int FontFamilyFont_android_fontVariationSettings = 0x00000004; | ||||
|         public static final int FontFamilyFont_android_fontWeight = 0x00000001; | ||||
|         public static final int FontFamilyFont_android_ttcIndex = 0x00000003; | ||||
|         public static final int FontFamilyFont_font = 0x00000005; | ||||
|         public static final int FontFamilyFont_fontStyle = 0x00000006; | ||||
|         public static final int FontFamilyFont_fontVariationSettings = 0x00000007; | ||||
|         public static final int FontFamilyFont_fontWeight = 0x00000008; | ||||
|         public static final int FontFamilyFont_ttcIndex = 0x00000009; | ||||
|         public static final int FontFamily_fontProviderAuthority = 0x00000000; | ||||
|         public static final int FontFamily_fontProviderCerts = 0x00000001; | ||||
|         public static final int FontFamily_fontProviderFetchStrategy = 0x00000002; | ||||
|         public static final int FontFamily_fontProviderFetchTimeout = 0x00000003; | ||||
|         public static final int FontFamily_fontProviderPackage = 0x00000004; | ||||
|         public static final int FontFamily_fontProviderQuery = 0x00000005; | ||||
|         public static final int FontFamily_fontProviderSystemFontFamily = 0x00000006; | ||||
|         public static final int GradientColorItem_android_color = 0x00000000; | ||||
|         public static final int GradientColorItem_android_offset = 0x00000001; | ||||
|         public static final int GradientColor_android_centerColor = 0x00000007; | ||||
|         public static final int GradientColor_android_centerX = 0x00000003; | ||||
|         public static final int GradientColor_android_centerY = 0x00000004; | ||||
|         public static final int GradientColor_android_endColor = 0x00000001; | ||||
|         public static final int GradientColor_android_endX = 0x0000000a; | ||||
|         public static final int GradientColor_android_endY = 0x0000000b; | ||||
|         public static final int GradientColor_android_gradientRadius = 0x00000005; | ||||
|         public static final int GradientColor_android_startColor = 0x00000000; | ||||
|         public static final int GradientColor_android_startX = 0x00000008; | ||||
|         public static final int GradientColor_android_startY = 0x00000009; | ||||
|         public static final int GradientColor_android_tileMode = 0x00000006; | ||||
|         public static final int GradientColor_android_type = 0x00000002; | ||||
|         public static final int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, android.R.attr.lStar, ch.mod_p.sre24.e5.R.attr.alpha, ch.mod_p.sre24.e5.R.attr.lStar}; | ||||
|         public static final int[] FontFamily = {ch.mod_p.sre24.e5.R.attr.fontProviderAuthority, ch.mod_p.sre24.e5.R.attr.fontProviderCerts, ch.mod_p.sre24.e5.R.attr.fontProviderFetchStrategy, ch.mod_p.sre24.e5.R.attr.fontProviderFetchTimeout, ch.mod_p.sre24.e5.R.attr.fontProviderPackage, ch.mod_p.sre24.e5.R.attr.fontProviderQuery, ch.mod_p.sre24.e5.R.attr.fontProviderSystemFontFamily}; | ||||
|         public static final int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.font, ch.mod_p.sre24.e5.R.attr.fontStyle, ch.mod_p.sre24.e5.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.fontWeight, ch.mod_p.sre24.e5.R.attr.ttcIndex}; | ||||
|         public static final int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY}; | ||||
|         public static final int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset}; | ||||
|  | ||||
|         private styleable() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private R() { | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,178 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| import android.os.Handler; | ||||
| import android.os.Looper; | ||||
| import android.os.SystemClock; | ||||
| import android.view.Choreographer; | ||||
| import androidx.collection.SimpleArrayMap; | ||||
| import java.util.ArrayList; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class AnimationHandler { | ||||
|     private static final long FRAME_DELAY_MS = 10; | ||||
|     public static final ThreadLocal<AnimationHandler> sAnimatorHandler = new ThreadLocal<>(); | ||||
|     private AnimationFrameCallbackProvider mProvider; | ||||
|     private final SimpleArrayMap<AnimationFrameCallback, Long> mDelayedCallbackStartTime = new SimpleArrayMap<>(); | ||||
|     final ArrayList<AnimationFrameCallback> mAnimationCallbacks = new ArrayList<>(); | ||||
|     private final AnimationCallbackDispatcher mCallbackDispatcher = new AnimationCallbackDispatcher(); | ||||
|     long mCurrentFrameTime = 0; | ||||
|     private boolean mListDirty = false; | ||||
|  | ||||
|     interface AnimationFrameCallback { | ||||
|         boolean doAnimationFrame(long j); | ||||
|     } | ||||
|  | ||||
|     public void setProvider(AnimationFrameCallbackProvider animationFrameCallbackProvider) { | ||||
|         this.mProvider = animationFrameCallbackProvider; | ||||
|     } | ||||
|  | ||||
|     AnimationHandler() { | ||||
|     } | ||||
|  | ||||
|     class AnimationCallbackDispatcher { | ||||
|         AnimationCallbackDispatcher() { | ||||
|         } | ||||
|  | ||||
|         void dispatchAnimationFrame() { | ||||
|             AnimationHandler.this.mCurrentFrameTime = SystemClock.uptimeMillis(); | ||||
|             AnimationHandler animationHandler = AnimationHandler.this; | ||||
|             animationHandler.doAnimationFrame(animationHandler.mCurrentFrameTime); | ||||
|             if (AnimationHandler.this.mAnimationCallbacks.size() > 0) { | ||||
|                 AnimationHandler.this.getProvider().postFrameCallback(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static AnimationHandler getInstance() { | ||||
|         ThreadLocal<AnimationHandler> threadLocal = sAnimatorHandler; | ||||
|         if (threadLocal.get() == null) { | ||||
|             threadLocal.set(new AnimationHandler()); | ||||
|         } | ||||
|         return threadLocal.get(); | ||||
|     } | ||||
|  | ||||
|     public static long getFrameTime() { | ||||
|         ThreadLocal<AnimationHandler> threadLocal = sAnimatorHandler; | ||||
|         if (threadLocal.get() == null) { | ||||
|             return 0L; | ||||
|         } | ||||
|         return threadLocal.get().mCurrentFrameTime; | ||||
|     } | ||||
|  | ||||
|     AnimationFrameCallbackProvider getProvider() { | ||||
|         if (this.mProvider == null) { | ||||
|             this.mProvider = new FrameCallbackProvider16(this.mCallbackDispatcher); | ||||
|         } | ||||
|         return this.mProvider; | ||||
|     } | ||||
|  | ||||
|     public void addAnimationFrameCallback(AnimationFrameCallback animationFrameCallback, long j) { | ||||
|         if (this.mAnimationCallbacks.size() == 0) { | ||||
|             getProvider().postFrameCallback(); | ||||
|         } | ||||
|         if (!this.mAnimationCallbacks.contains(animationFrameCallback)) { | ||||
|             this.mAnimationCallbacks.add(animationFrameCallback); | ||||
|         } | ||||
|         if (j > 0) { | ||||
|             this.mDelayedCallbackStartTime.put(animationFrameCallback, Long.valueOf(SystemClock.uptimeMillis() + j)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void removeCallback(AnimationFrameCallback animationFrameCallback) { | ||||
|         this.mDelayedCallbackStartTime.remove(animationFrameCallback); | ||||
|         int indexOf = this.mAnimationCallbacks.indexOf(animationFrameCallback); | ||||
|         if (indexOf >= 0) { | ||||
|             this.mAnimationCallbacks.set(indexOf, null); | ||||
|             this.mListDirty = true; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void doAnimationFrame(long j) { | ||||
|         long uptimeMillis = SystemClock.uptimeMillis(); | ||||
|         for (int i = 0; i < this.mAnimationCallbacks.size(); i++) { | ||||
|             AnimationFrameCallback animationFrameCallback = this.mAnimationCallbacks.get(i); | ||||
|             if (animationFrameCallback != null && isCallbackDue(animationFrameCallback, uptimeMillis)) { | ||||
|                 animationFrameCallback.doAnimationFrame(j); | ||||
|             } | ||||
|         } | ||||
|         cleanUpList(); | ||||
|     } | ||||
|  | ||||
|     private boolean isCallbackDue(AnimationFrameCallback animationFrameCallback, long j) { | ||||
|         Long l = this.mDelayedCallbackStartTime.get(animationFrameCallback); | ||||
|         if (l == null) { | ||||
|             return true; | ||||
|         } | ||||
|         if (l.longValue() >= j) { | ||||
|             return false; | ||||
|         } | ||||
|         this.mDelayedCallbackStartTime.remove(animationFrameCallback); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     private void cleanUpList() { | ||||
|         if (this.mListDirty) { | ||||
|             for (int size = this.mAnimationCallbacks.size() - 1; size >= 0; size--) { | ||||
|                 if (this.mAnimationCallbacks.get(size) == null) { | ||||
|                     this.mAnimationCallbacks.remove(size); | ||||
|                 } | ||||
|             } | ||||
|             this.mListDirty = false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class FrameCallbackProvider16 extends AnimationFrameCallbackProvider { | ||||
|         private final Choreographer mChoreographer; | ||||
|         private final Choreographer.FrameCallback mChoreographerCallback; | ||||
|  | ||||
|         FrameCallbackProvider16(AnimationCallbackDispatcher animationCallbackDispatcher) { | ||||
|             super(animationCallbackDispatcher); | ||||
|             this.mChoreographer = Choreographer.getInstance(); | ||||
|             this.mChoreographerCallback = new Choreographer.FrameCallback() { // from class: androidx.dynamicanimation.animation.AnimationHandler.FrameCallbackProvider16.1 | ||||
|                 @Override // android.view.Choreographer.FrameCallback | ||||
|                 public void doFrame(long j) { | ||||
|                     FrameCallbackProvider16.this.mDispatcher.dispatchAnimationFrame(); | ||||
|                 } | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.AnimationHandler.AnimationFrameCallbackProvider | ||||
|         void postFrameCallback() { | ||||
|             this.mChoreographer.postFrameCallback(this.mChoreographerCallback); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class FrameCallbackProvider14 extends AnimationFrameCallbackProvider { | ||||
|         private final Handler mHandler; | ||||
|         long mLastFrameTime; | ||||
|         private final Runnable mRunnable; | ||||
|  | ||||
|         FrameCallbackProvider14(AnimationCallbackDispatcher animationCallbackDispatcher) { | ||||
|             super(animationCallbackDispatcher); | ||||
|             this.mLastFrameTime = -1L; | ||||
|             this.mRunnable = new Runnable() { // from class: androidx.dynamicanimation.animation.AnimationHandler.FrameCallbackProvider14.1 | ||||
|                 @Override // java.lang.Runnable | ||||
|                 public void run() { | ||||
|                     FrameCallbackProvider14.this.mLastFrameTime = SystemClock.uptimeMillis(); | ||||
|                     FrameCallbackProvider14.this.mDispatcher.dispatchAnimationFrame(); | ||||
|                 } | ||||
|             }; | ||||
|             this.mHandler = new Handler(Looper.myLooper()); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.AnimationHandler.AnimationFrameCallbackProvider | ||||
|         void postFrameCallback() { | ||||
|             this.mHandler.postDelayed(this.mRunnable, Math.max(AnimationHandler.FRAME_DELAY_MS - (SystemClock.uptimeMillis() - this.mLastFrameTime), 0L)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static abstract class AnimationFrameCallbackProvider { | ||||
|         final AnimationCallbackDispatcher mDispatcher; | ||||
|  | ||||
|         abstract void postFrameCallback(); | ||||
|  | ||||
|         AnimationFrameCallbackProvider(AnimationCallbackDispatcher animationCallbackDispatcher) { | ||||
|             this.mDispatcher = animationCallbackDispatcher; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,430 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| import android.os.Looper; | ||||
| import android.util.AndroidRuntimeException; | ||||
| import android.view.View; | ||||
| import androidx.constraintlayout.motion.widget.Key; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.dynamicanimation.animation.AnimationHandler; | ||||
| import androidx.dynamicanimation.animation.DynamicAnimation; | ||||
| import java.util.ArrayList; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class DynamicAnimation<T extends DynamicAnimation<T>> implements AnimationHandler.AnimationFrameCallback { | ||||
|     public static final float MIN_VISIBLE_CHANGE_ALPHA = 0.00390625f; | ||||
|     public static final float MIN_VISIBLE_CHANGE_PIXELS = 1.0f; | ||||
|     public static final float MIN_VISIBLE_CHANGE_ROTATION_DEGREES = 0.1f; | ||||
|     public static final float MIN_VISIBLE_CHANGE_SCALE = 0.002f; | ||||
|     private static final float THRESHOLD_MULTIPLIER = 0.75f; | ||||
|     private static final float UNSET = Float.MAX_VALUE; | ||||
|     private final ArrayList<OnAnimationEndListener> mEndListeners; | ||||
|     private long mLastFrameTime; | ||||
|     float mMaxValue; | ||||
|     float mMinValue; | ||||
|     private float mMinVisibleChange; | ||||
|     final FloatPropertyCompat mProperty; | ||||
|     boolean mRunning; | ||||
|     boolean mStartValueIsSet; | ||||
|     final Object mTarget; | ||||
|     private final ArrayList<OnAnimationUpdateListener> mUpdateListeners; | ||||
|     float mValue; | ||||
|     float mVelocity; | ||||
|     public static final ViewProperty TRANSLATION_X = new ViewProperty("translationX") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.1 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setTranslationX(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getTranslationX(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty TRANSLATION_Y = new ViewProperty("translationY") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.2 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setTranslationY(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getTranslationY(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty TRANSLATION_Z = new ViewProperty("translationZ") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.3 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             ViewCompat.setTranslationZ(view, f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return ViewCompat.getTranslationZ(view); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty SCALE_X = new ViewProperty("scaleX") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.4 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setScaleX(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getScaleX(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty SCALE_Y = new ViewProperty("scaleY") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.5 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setScaleY(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getScaleY(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty ROTATION = new ViewProperty(Key.ROTATION) { // from class: androidx.dynamicanimation.animation.DynamicAnimation.6 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setRotation(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getRotation(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty ROTATION_X = new ViewProperty("rotationX") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.7 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setRotationX(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getRotationX(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty ROTATION_Y = new ViewProperty("rotationY") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.8 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setRotationY(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getRotationY(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty X = new ViewProperty("x") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.9 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setX(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getX(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty Y = new ViewProperty("y") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.10 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setY(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getY(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty Z = new ViewProperty("z") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.11 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             ViewCompat.setZ(view, f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return ViewCompat.getZ(view); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty ALPHA = new ViewProperty("alpha") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.12 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setAlpha(f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getAlpha(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty SCROLL_X = new ViewProperty("scrollX") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.13 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setScrollX((int) f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getScrollX(); | ||||
|         } | ||||
|     }; | ||||
|     public static final ViewProperty SCROLL_Y = new ViewProperty("scrollY") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.14 | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public void setValue(View view, float f) { | ||||
|             view.setScrollY((int) f); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|         public float getValue(View view) { | ||||
|             return view.getScrollY(); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     public interface OnAnimationEndListener { | ||||
|         void onAnimationEnd(DynamicAnimation dynamicAnimation, boolean z, float f, float f2); | ||||
|     } | ||||
|  | ||||
|     public interface OnAnimationUpdateListener { | ||||
|         void onAnimationUpdate(DynamicAnimation dynamicAnimation, float f, float f2); | ||||
|     } | ||||
|  | ||||
|     abstract float getAcceleration(float f, float f2); | ||||
|  | ||||
|     public float getMinimumVisibleChange() { | ||||
|         return this.mMinVisibleChange; | ||||
|     } | ||||
|  | ||||
|     float getValueThreshold() { | ||||
|         return this.mMinVisibleChange * 0.75f; | ||||
|     } | ||||
|  | ||||
|     abstract boolean isAtEquilibrium(float f, float f2); | ||||
|  | ||||
|     public boolean isRunning() { | ||||
|         return this.mRunning; | ||||
|     } | ||||
|  | ||||
|     public T setMaxValue(float f) { | ||||
|         this.mMaxValue = f; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public T setMinValue(float f) { | ||||
|         this.mMinValue = f; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public T setStartValue(float f) { | ||||
|         this.mValue = f; | ||||
|         this.mStartValueIsSet = true; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public T setStartVelocity(float f) { | ||||
|         this.mVelocity = f; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     abstract void setValueThreshold(float f); | ||||
|  | ||||
|     abstract boolean updateValueAndVelocity(long j); | ||||
|  | ||||
|     public static abstract class ViewProperty extends FloatPropertyCompat<View> { | ||||
|         private ViewProperty(String str) { | ||||
|             super(str); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class MassState { | ||||
|         float mValue; | ||||
|         float mVelocity; | ||||
|  | ||||
|         MassState() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     DynamicAnimation(final FloatValueHolder floatValueHolder) { | ||||
|         this.mVelocity = 0.0f; | ||||
|         this.mValue = Float.MAX_VALUE; | ||||
|         this.mStartValueIsSet = false; | ||||
|         this.mRunning = false; | ||||
|         this.mMaxValue = Float.MAX_VALUE; | ||||
|         this.mMinValue = -Float.MAX_VALUE; | ||||
|         this.mLastFrameTime = 0L; | ||||
|         this.mEndListeners = new ArrayList<>(); | ||||
|         this.mUpdateListeners = new ArrayList<>(); | ||||
|         this.mTarget = null; | ||||
|         this.mProperty = new FloatPropertyCompat("FloatValueHolder") { // from class: androidx.dynamicanimation.animation.DynamicAnimation.15 | ||||
|             @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|             public float getValue(Object obj) { | ||||
|                 return floatValueHolder.getValue(); | ||||
|             } | ||||
|  | ||||
|             @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|             public void setValue(Object obj, float f) { | ||||
|                 floatValueHolder.setValue(f); | ||||
|             } | ||||
|         }; | ||||
|         this.mMinVisibleChange = 1.0f; | ||||
|     } | ||||
|  | ||||
|     <K> DynamicAnimation(K k, FloatPropertyCompat<K> floatPropertyCompat) { | ||||
|         this.mVelocity = 0.0f; | ||||
|         this.mValue = Float.MAX_VALUE; | ||||
|         this.mStartValueIsSet = false; | ||||
|         this.mRunning = false; | ||||
|         this.mMaxValue = Float.MAX_VALUE; | ||||
|         this.mMinValue = -Float.MAX_VALUE; | ||||
|         this.mLastFrameTime = 0L; | ||||
|         this.mEndListeners = new ArrayList<>(); | ||||
|         this.mUpdateListeners = new ArrayList<>(); | ||||
|         this.mTarget = k; | ||||
|         this.mProperty = floatPropertyCompat; | ||||
|         if (floatPropertyCompat == ROTATION || floatPropertyCompat == ROTATION_X || floatPropertyCompat == ROTATION_Y) { | ||||
|             this.mMinVisibleChange = 0.1f; | ||||
|             return; | ||||
|         } | ||||
|         if (floatPropertyCompat == ALPHA) { | ||||
|             this.mMinVisibleChange = 0.00390625f; | ||||
|         } else if (floatPropertyCompat == SCALE_X || floatPropertyCompat == SCALE_Y) { | ||||
|             this.mMinVisibleChange = 0.00390625f; | ||||
|         } else { | ||||
|             this.mMinVisibleChange = 1.0f; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public T addEndListener(OnAnimationEndListener onAnimationEndListener) { | ||||
|         if (!this.mEndListeners.contains(onAnimationEndListener)) { | ||||
|             this.mEndListeners.add(onAnimationEndListener); | ||||
|         } | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public void removeEndListener(OnAnimationEndListener onAnimationEndListener) { | ||||
|         removeEntry(this.mEndListeners, onAnimationEndListener); | ||||
|     } | ||||
|  | ||||
|     public T addUpdateListener(OnAnimationUpdateListener onAnimationUpdateListener) { | ||||
|         if (isRunning()) { | ||||
|             throw new UnsupportedOperationException("Error: Update listeners must be added beforethe animation."); | ||||
|         } | ||||
|         if (!this.mUpdateListeners.contains(onAnimationUpdateListener)) { | ||||
|             this.mUpdateListeners.add(onAnimationUpdateListener); | ||||
|         } | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public void removeUpdateListener(OnAnimationUpdateListener onAnimationUpdateListener) { | ||||
|         removeEntry(this.mUpdateListeners, onAnimationUpdateListener); | ||||
|     } | ||||
|  | ||||
|     public T setMinimumVisibleChange(float f) { | ||||
|         if (f <= 0.0f) { | ||||
|             throw new IllegalArgumentException("Minimum visible change must be positive."); | ||||
|         } | ||||
|         this.mMinVisibleChange = f; | ||||
|         setValueThreshold(f * 0.75f); | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     private static <T> void removeNullEntries(ArrayList<T> arrayList) { | ||||
|         for (int size = arrayList.size() - 1; size >= 0; size--) { | ||||
|             if (arrayList.get(size) == null) { | ||||
|                 arrayList.remove(size); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static <T> void removeEntry(ArrayList<T> arrayList, T t) { | ||||
|         int indexOf = arrayList.indexOf(t); | ||||
|         if (indexOf >= 0) { | ||||
|             arrayList.set(indexOf, null); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void start() { | ||||
|         if (Looper.myLooper() != Looper.getMainLooper()) { | ||||
|             throw new AndroidRuntimeException("Animations may only be started on the main thread"); | ||||
|         } | ||||
|         if (this.mRunning) { | ||||
|             return; | ||||
|         } | ||||
|         startAnimationInternal(); | ||||
|     } | ||||
|  | ||||
|     public void cancel() { | ||||
|         if (Looper.myLooper() != Looper.getMainLooper()) { | ||||
|             throw new AndroidRuntimeException("Animations may only be canceled on the main thread"); | ||||
|         } | ||||
|         if (this.mRunning) { | ||||
|             endAnimationInternal(true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void startAnimationInternal() { | ||||
|         if (this.mRunning) { | ||||
|             return; | ||||
|         } | ||||
|         this.mRunning = true; | ||||
|         if (!this.mStartValueIsSet) { | ||||
|             this.mValue = getPropertyValue(); | ||||
|         } | ||||
|         float f = this.mValue; | ||||
|         if (f > this.mMaxValue || f < this.mMinValue) { | ||||
|             throw new IllegalArgumentException("Starting value need to be in between min value and max value"); | ||||
|         } | ||||
|         AnimationHandler.getInstance().addAnimationFrameCallback(this, 0L); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.AnimationHandler.AnimationFrameCallback | ||||
|     public boolean doAnimationFrame(long j) { | ||||
|         long j2 = this.mLastFrameTime; | ||||
|         if (j2 == 0) { | ||||
|             this.mLastFrameTime = j; | ||||
|             setPropertyValue(this.mValue); | ||||
|             return false; | ||||
|         } | ||||
|         this.mLastFrameTime = j; | ||||
|         boolean updateValueAndVelocity = updateValueAndVelocity(j - j2); | ||||
|         float min = Math.min(this.mValue, this.mMaxValue); | ||||
|         this.mValue = min; | ||||
|         float max = Math.max(min, this.mMinValue); | ||||
|         this.mValue = max; | ||||
|         setPropertyValue(max); | ||||
|         if (updateValueAndVelocity) { | ||||
|             endAnimationInternal(false); | ||||
|         } | ||||
|         return updateValueAndVelocity; | ||||
|     } | ||||
|  | ||||
|     private void endAnimationInternal(boolean z) { | ||||
|         this.mRunning = false; | ||||
|         AnimationHandler.getInstance().removeCallback(this); | ||||
|         this.mLastFrameTime = 0L; | ||||
|         this.mStartValueIsSet = false; | ||||
|         for (int i = 0; i < this.mEndListeners.size(); i++) { | ||||
|             if (this.mEndListeners.get(i) != null) { | ||||
|                 this.mEndListeners.get(i).onAnimationEnd(this, z, this.mValue, this.mVelocity); | ||||
|             } | ||||
|         } | ||||
|         removeNullEntries(this.mEndListeners); | ||||
|     } | ||||
|  | ||||
|     void setPropertyValue(float f) { | ||||
|         this.mProperty.setValue(this.mTarget, f); | ||||
|         for (int i = 0; i < this.mUpdateListeners.size(); i++) { | ||||
|             if (this.mUpdateListeners.get(i) != null) { | ||||
|                 this.mUpdateListeners.get(i).onAnimationUpdate(this, this.mValue, this.mVelocity); | ||||
|             } | ||||
|         } | ||||
|         removeNullEntries(this.mUpdateListeners); | ||||
|     } | ||||
|  | ||||
|     private float getPropertyValue() { | ||||
|         return this.mProperty.getValue(this.mTarget); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,128 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| import androidx.dynamicanimation.animation.DynamicAnimation; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class FlingAnimation extends DynamicAnimation<FlingAnimation> { | ||||
|     private final DragForce mFlingForce; | ||||
|  | ||||
|     public FlingAnimation(FloatValueHolder floatValueHolder) { | ||||
|         super(floatValueHolder); | ||||
|         DragForce dragForce = new DragForce(); | ||||
|         this.mFlingForce = dragForce; | ||||
|         dragForce.setValueThreshold(getValueThreshold()); | ||||
|     } | ||||
|  | ||||
|     public <K> FlingAnimation(K k, FloatPropertyCompat<K> floatPropertyCompat) { | ||||
|         super(k, floatPropertyCompat); | ||||
|         DragForce dragForce = new DragForce(); | ||||
|         this.mFlingForce = dragForce; | ||||
|         dragForce.setValueThreshold(getValueThreshold()); | ||||
|     } | ||||
|  | ||||
|     public FlingAnimation setFriction(float f) { | ||||
|         if (f <= 0.0f) { | ||||
|             throw new IllegalArgumentException("Friction must be positive"); | ||||
|         } | ||||
|         this.mFlingForce.setFrictionScalar(f); | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public float getFriction() { | ||||
|         return this.mFlingForce.getFrictionScalar(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     public FlingAnimation setMinValue(float f) { | ||||
|         super.setMinValue(f); | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     public FlingAnimation setMaxValue(float f) { | ||||
|         super.setMaxValue(f); | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     public FlingAnimation setStartVelocity(float f) { | ||||
|         super.setStartVelocity(f); | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     boolean updateValueAndVelocity(long j) { | ||||
|         DynamicAnimation.MassState updateValueAndVelocity = this.mFlingForce.updateValueAndVelocity(this.mValue, this.mVelocity, j); | ||||
|         this.mValue = updateValueAndVelocity.mValue; | ||||
|         this.mVelocity = updateValueAndVelocity.mVelocity; | ||||
|         if (this.mValue < this.mMinValue) { | ||||
|             this.mValue = this.mMinValue; | ||||
|             return true; | ||||
|         } | ||||
|         if (this.mValue <= this.mMaxValue) { | ||||
|             return isAtEquilibrium(this.mValue, this.mVelocity); | ||||
|         } | ||||
|         this.mValue = this.mMaxValue; | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     float getAcceleration(float f, float f2) { | ||||
|         return this.mFlingForce.getAcceleration(f, f2); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     boolean isAtEquilibrium(float f, float f2) { | ||||
|         return f >= this.mMaxValue || f <= this.mMinValue || this.mFlingForce.isAtEquilibrium(f, f2); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     void setValueThreshold(float f) { | ||||
|         this.mFlingForce.setValueThreshold(f); | ||||
|     } | ||||
|  | ||||
|     static final class DragForce implements Force { | ||||
|         private static final float DEFAULT_FRICTION = -4.2f; | ||||
|         private static final float VELOCITY_THRESHOLD_MULTIPLIER = 62.5f; | ||||
|         private float mFriction = DEFAULT_FRICTION; | ||||
|         private final DynamicAnimation.MassState mMassState = new DynamicAnimation.MassState(); | ||||
|         private float mVelocityThreshold; | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.Force | ||||
|         public float getAcceleration(float f, float f2) { | ||||
|             return f2 * this.mFriction; | ||||
|         } | ||||
|  | ||||
|         float getFrictionScalar() { | ||||
|             return this.mFriction / DEFAULT_FRICTION; | ||||
|         } | ||||
|  | ||||
|         void setFrictionScalar(float f) { | ||||
|             this.mFriction = f * DEFAULT_FRICTION; | ||||
|         } | ||||
|  | ||||
|         void setValueThreshold(float f) { | ||||
|             this.mVelocityThreshold = f * VELOCITY_THRESHOLD_MULTIPLIER; | ||||
|         } | ||||
|  | ||||
|         DragForce() { | ||||
|         } | ||||
|  | ||||
|         DynamicAnimation.MassState updateValueAndVelocity(float f, float f2, long j) { | ||||
|             float f3 = j; | ||||
|             this.mMassState.mVelocity = (float) (f2 * Math.exp((f3 / 1000.0f) * this.mFriction)); | ||||
|             DynamicAnimation.MassState massState = this.mMassState; | ||||
|             float f4 = this.mFriction; | ||||
|             massState.mValue = (float) ((f - (f2 / f4)) + ((f2 / f4) * Math.exp((f4 * f3) / 1000.0f))); | ||||
|             if (isAtEquilibrium(this.mMassState.mValue, this.mMassState.mVelocity)) { | ||||
|                 this.mMassState.mVelocity = 0.0f; | ||||
|             } | ||||
|             return this.mMassState; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.dynamicanimation.animation.Force | ||||
|         public boolean isAtEquilibrium(float f, float f2) { | ||||
|             return Math.abs(f2) < this.mVelocityThreshold; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,34 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| import android.util.FloatProperty; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class FloatPropertyCompat<T> { | ||||
|     final String mPropertyName; | ||||
|  | ||||
|     public abstract float getValue(T t); | ||||
|  | ||||
|     public abstract void setValue(T t, float f); | ||||
|  | ||||
|     public FloatPropertyCompat(String str) { | ||||
|         this.mPropertyName = str; | ||||
|     } | ||||
|  | ||||
|     public static <T> FloatPropertyCompat<T> createFloatPropertyCompat(final FloatProperty<T> floatProperty) { | ||||
|         String name; | ||||
|         name = floatProperty.getName(); | ||||
|         return new FloatPropertyCompat<T>(name) { // from class: androidx.dynamicanimation.animation.FloatPropertyCompat.1 | ||||
|             @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|             public float getValue(T t) { | ||||
|                 Object obj; | ||||
|                 obj = floatProperty.get(t); | ||||
|                 return ((Float) obj).floatValue(); | ||||
|             } | ||||
|  | ||||
|             @Override // androidx.dynamicanimation.animation.FloatPropertyCompat | ||||
|             public void setValue(T t, float f) { | ||||
|                 floatProperty.setValue(t, f); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class FloatValueHolder { | ||||
|     private float mValue = 0.0f; | ||||
|  | ||||
|     public float getValue() { | ||||
|         return this.mValue; | ||||
|     } | ||||
|  | ||||
|     public void setValue(float f) { | ||||
|         this.mValue = f; | ||||
|     } | ||||
|  | ||||
|     public FloatValueHolder() { | ||||
|     } | ||||
|  | ||||
|     public FloatValueHolder(float f) { | ||||
|         setValue(f); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| interface Force { | ||||
|     float getAcceleration(float f, float f2); | ||||
|  | ||||
|     boolean isAtEquilibrium(float f, float f2); | ||||
| } | ||||
| @@ -0,0 +1,144 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| import android.os.Looper; | ||||
| import android.util.AndroidRuntimeException; | ||||
| import androidx.dynamicanimation.animation.DynamicAnimation; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class SpringAnimation extends DynamicAnimation<SpringAnimation> { | ||||
|     private static final float UNSET = Float.MAX_VALUE; | ||||
|     private boolean mEndRequested; | ||||
|     private float mPendingPosition; | ||||
|     private SpringForce mSpring; | ||||
|  | ||||
|     public SpringForce getSpring() { | ||||
|         return this.mSpring; | ||||
|     } | ||||
|  | ||||
|     public SpringAnimation setSpring(SpringForce springForce) { | ||||
|         this.mSpring = springForce; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     void setValueThreshold(float f) { | ||||
|     } | ||||
|  | ||||
|     public SpringAnimation(FloatValueHolder floatValueHolder) { | ||||
|         super(floatValueHolder); | ||||
|         this.mSpring = null; | ||||
|         this.mPendingPosition = Float.MAX_VALUE; | ||||
|         this.mEndRequested = false; | ||||
|     } | ||||
|  | ||||
|     public <K> SpringAnimation(K k, FloatPropertyCompat<K> floatPropertyCompat) { | ||||
|         super(k, floatPropertyCompat); | ||||
|         this.mSpring = null; | ||||
|         this.mPendingPosition = Float.MAX_VALUE; | ||||
|         this.mEndRequested = false; | ||||
|     } | ||||
|  | ||||
|     public <K> SpringAnimation(K k, FloatPropertyCompat<K> floatPropertyCompat, float f) { | ||||
|         super(k, floatPropertyCompat); | ||||
|         this.mSpring = null; | ||||
|         this.mPendingPosition = Float.MAX_VALUE; | ||||
|         this.mEndRequested = false; | ||||
|         this.mSpring = new SpringForce(f); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     public void start() { | ||||
|         sanityCheck(); | ||||
|         this.mSpring.setValueThreshold(getValueThreshold()); | ||||
|         super.start(); | ||||
|     } | ||||
|  | ||||
|     public void animateToFinalPosition(float f) { | ||||
|         if (isRunning()) { | ||||
|             this.mPendingPosition = f; | ||||
|             return; | ||||
|         } | ||||
|         if (this.mSpring == null) { | ||||
|             this.mSpring = new SpringForce(f); | ||||
|         } | ||||
|         this.mSpring.setFinalPosition(f); | ||||
|         start(); | ||||
|     } | ||||
|  | ||||
|     public void skipToEnd() { | ||||
|         if (!canSkipToEnd()) { | ||||
|             throw new UnsupportedOperationException("Spring animations can only come to an end when there is damping"); | ||||
|         } | ||||
|         if (Looper.myLooper() != Looper.getMainLooper()) { | ||||
|             throw new AndroidRuntimeException("Animations may only be started on the main thread"); | ||||
|         } | ||||
|         if (this.mRunning) { | ||||
|             this.mEndRequested = true; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public boolean canSkipToEnd() { | ||||
|         return this.mSpring.mDampingRatio > 0.0d; | ||||
|     } | ||||
|  | ||||
|     private void sanityCheck() { | ||||
|         SpringForce springForce = this.mSpring; | ||||
|         if (springForce == null) { | ||||
|             throw new UnsupportedOperationException("Incomplete SpringAnimation: Either final position or a spring force needs to be set."); | ||||
|         } | ||||
|         double finalPosition = springForce.getFinalPosition(); | ||||
|         if (finalPosition > this.mMaxValue) { | ||||
|             throw new UnsupportedOperationException("Final position of the spring cannot be greater than the max value."); | ||||
|         } | ||||
|         if (finalPosition < this.mMinValue) { | ||||
|             throw new UnsupportedOperationException("Final position of the spring cannot be less than the min value."); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     boolean updateValueAndVelocity(long j) { | ||||
|         if (this.mEndRequested) { | ||||
|             float f = this.mPendingPosition; | ||||
|             if (f != Float.MAX_VALUE) { | ||||
|                 this.mSpring.setFinalPosition(f); | ||||
|                 this.mPendingPosition = Float.MAX_VALUE; | ||||
|             } | ||||
|             this.mValue = this.mSpring.getFinalPosition(); | ||||
|             this.mVelocity = 0.0f; | ||||
|             this.mEndRequested = false; | ||||
|             return true; | ||||
|         } | ||||
|         if (this.mPendingPosition != Float.MAX_VALUE) { | ||||
|             this.mSpring.getFinalPosition(); | ||||
|             long j2 = j / 2; | ||||
|             DynamicAnimation.MassState updateValues = this.mSpring.updateValues(this.mValue, this.mVelocity, j2); | ||||
|             this.mSpring.setFinalPosition(this.mPendingPosition); | ||||
|             this.mPendingPosition = Float.MAX_VALUE; | ||||
|             DynamicAnimation.MassState updateValues2 = this.mSpring.updateValues(updateValues.mValue, updateValues.mVelocity, j2); | ||||
|             this.mValue = updateValues2.mValue; | ||||
|             this.mVelocity = updateValues2.mVelocity; | ||||
|         } else { | ||||
|             DynamicAnimation.MassState updateValues3 = this.mSpring.updateValues(this.mValue, this.mVelocity, j); | ||||
|             this.mValue = updateValues3.mValue; | ||||
|             this.mVelocity = updateValues3.mVelocity; | ||||
|         } | ||||
|         this.mValue = Math.max(this.mValue, this.mMinValue); | ||||
|         this.mValue = Math.min(this.mValue, this.mMaxValue); | ||||
|         if (!isAtEquilibrium(this.mValue, this.mVelocity)) { | ||||
|             return false; | ||||
|         } | ||||
|         this.mValue = this.mSpring.getFinalPosition(); | ||||
|         this.mVelocity = 0.0f; | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     float getAcceleration(float f, float f2) { | ||||
|         return this.mSpring.getAcceleration(f, f2); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.DynamicAnimation | ||||
|     boolean isAtEquilibrium(float f, float f2) { | ||||
|         return this.mSpring.isAtEquilibrium(f, f2); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,163 @@ | ||||
| package androidx.dynamicanimation.animation; | ||||
|  | ||||
| import androidx.dynamicanimation.animation.DynamicAnimation; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class SpringForce implements Force { | ||||
|     public static final float DAMPING_RATIO_HIGH_BOUNCY = 0.2f; | ||||
|     public static final float DAMPING_RATIO_LOW_BOUNCY = 0.75f; | ||||
|     public static final float DAMPING_RATIO_MEDIUM_BOUNCY = 0.5f; | ||||
|     public static final float DAMPING_RATIO_NO_BOUNCY = 1.0f; | ||||
|     public static final float STIFFNESS_HIGH = 10000.0f; | ||||
|     public static final float STIFFNESS_LOW = 200.0f; | ||||
|     public static final float STIFFNESS_MEDIUM = 1500.0f; | ||||
|     public static final float STIFFNESS_VERY_LOW = 50.0f; | ||||
|     private static final double UNSET = Double.MAX_VALUE; | ||||
|     private static final double VELOCITY_THRESHOLD_MULTIPLIER = 62.5d; | ||||
|     private double mDampedFreq; | ||||
|     double mDampingRatio; | ||||
|     private double mFinalPosition; | ||||
|     private double mGammaMinus; | ||||
|     private double mGammaPlus; | ||||
|     private boolean mInitialized; | ||||
|     private final DynamicAnimation.MassState mMassState; | ||||
|     double mNaturalFreq; | ||||
|     private double mValueThreshold; | ||||
|     private double mVelocityThreshold; | ||||
|  | ||||
|     public float getDampingRatio() { | ||||
|         return (float) this.mDampingRatio; | ||||
|     } | ||||
|  | ||||
|     public float getFinalPosition() { | ||||
|         return (float) this.mFinalPosition; | ||||
|     } | ||||
|  | ||||
|     public float getStiffness() { | ||||
|         double d = this.mNaturalFreq; | ||||
|         return (float) (d * d); | ||||
|     } | ||||
|  | ||||
|     public SpringForce setFinalPosition(float f) { | ||||
|         this.mFinalPosition = f; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public SpringForce() { | ||||
|         this.mNaturalFreq = Math.sqrt(1500.0d); | ||||
|         this.mDampingRatio = 0.5d; | ||||
|         this.mInitialized = false; | ||||
|         this.mFinalPosition = Double.MAX_VALUE; | ||||
|         this.mMassState = new DynamicAnimation.MassState(); | ||||
|     } | ||||
|  | ||||
|     public SpringForce(float f) { | ||||
|         this.mNaturalFreq = Math.sqrt(1500.0d); | ||||
|         this.mDampingRatio = 0.5d; | ||||
|         this.mInitialized = false; | ||||
|         this.mFinalPosition = Double.MAX_VALUE; | ||||
|         this.mMassState = new DynamicAnimation.MassState(); | ||||
|         this.mFinalPosition = f; | ||||
|     } | ||||
|  | ||||
|     public SpringForce setStiffness(float f) { | ||||
|         if (f <= 0.0f) { | ||||
|             throw new IllegalArgumentException("Spring stiffness constant must be positive."); | ||||
|         } | ||||
|         this.mNaturalFreq = Math.sqrt(f); | ||||
|         this.mInitialized = false; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public SpringForce setDampingRatio(float f) { | ||||
|         if (f < 0.0f) { | ||||
|             throw new IllegalArgumentException("Damping ratio must be non-negative"); | ||||
|         } | ||||
|         this.mDampingRatio = f; | ||||
|         this.mInitialized = false; | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.Force | ||||
|     public float getAcceleration(float f, float f2) { | ||||
|         float finalPosition = f - getFinalPosition(); | ||||
|         double d = this.mNaturalFreq; | ||||
|         return (float) (((-(d * d)) * finalPosition) - (((d * 2.0d) * this.mDampingRatio) * f2)); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.dynamicanimation.animation.Force | ||||
|     public boolean isAtEquilibrium(float f, float f2) { | ||||
|         return ((double) Math.abs(f2)) < this.mVelocityThreshold && ((double) Math.abs(f - getFinalPosition())) < this.mValueThreshold; | ||||
|     } | ||||
|  | ||||
|     private void init() { | ||||
|         if (this.mInitialized) { | ||||
|             return; | ||||
|         } | ||||
|         if (this.mFinalPosition == Double.MAX_VALUE) { | ||||
|             throw new IllegalStateException("Error: Final position of the spring must be set before the animation starts"); | ||||
|         } | ||||
|         double d = this.mDampingRatio; | ||||
|         if (d > 1.0d) { | ||||
|             double d2 = this.mNaturalFreq; | ||||
|             this.mGammaPlus = ((-d) * d2) + (d2 * Math.sqrt((d * d) - 1.0d)); | ||||
|             double d3 = this.mDampingRatio; | ||||
|             double d4 = this.mNaturalFreq; | ||||
|             this.mGammaMinus = ((-d3) * d4) - (d4 * Math.sqrt((d3 * d3) - 1.0d)); | ||||
|         } else if (d >= 0.0d && d < 1.0d) { | ||||
|             this.mDampedFreq = this.mNaturalFreq * Math.sqrt(1.0d - (d * d)); | ||||
|         } | ||||
|         this.mInitialized = true; | ||||
|     } | ||||
|  | ||||
|     DynamicAnimation.MassState updateValues(double d, double d2, long j) { | ||||
|         double cos; | ||||
|         double d3; | ||||
|         init(); | ||||
|         double d4 = j / 1000.0d; | ||||
|         double d5 = d - this.mFinalPosition; | ||||
|         double d6 = this.mDampingRatio; | ||||
|         if (d6 > 1.0d) { | ||||
|             double d7 = this.mGammaMinus; | ||||
|             double d8 = this.mGammaPlus; | ||||
|             double d9 = d5 - (((d7 * d5) - d2) / (d7 - d8)); | ||||
|             double d10 = ((d5 * d7) - d2) / (d7 - d8); | ||||
|             d3 = (Math.pow(2.718281828459045d, d7 * d4) * d9) + (Math.pow(2.718281828459045d, this.mGammaPlus * d4) * d10); | ||||
|             double d11 = this.mGammaMinus; | ||||
|             double pow = d9 * d11 * Math.pow(2.718281828459045d, d11 * d4); | ||||
|             double d12 = this.mGammaPlus; | ||||
|             cos = pow + (d10 * d12 * Math.pow(2.718281828459045d, d12 * d4)); | ||||
|         } else if (d6 == 1.0d) { | ||||
|             double d13 = this.mNaturalFreq; | ||||
|             double d14 = d2 + (d13 * d5); | ||||
|             double d15 = d5 + (d14 * d4); | ||||
|             d3 = Math.pow(2.718281828459045d, (-d13) * d4) * d15; | ||||
|             double pow2 = d15 * Math.pow(2.718281828459045d, (-this.mNaturalFreq) * d4); | ||||
|             double d16 = this.mNaturalFreq; | ||||
|             cos = (d14 * Math.pow(2.718281828459045d, (-d16) * d4)) + (pow2 * (-d16)); | ||||
|         } else { | ||||
|             double d17 = 1.0d / this.mDampedFreq; | ||||
|             double d18 = this.mNaturalFreq; | ||||
|             double d19 = d17 * ((d6 * d18 * d5) + d2); | ||||
|             double pow3 = Math.pow(2.718281828459045d, (-d6) * d18 * d4) * ((Math.cos(this.mDampedFreq * d4) * d5) + (Math.sin(this.mDampedFreq * d4) * d19)); | ||||
|             double d20 = this.mNaturalFreq; | ||||
|             double d21 = this.mDampingRatio; | ||||
|             double d22 = (-d20) * pow3 * d21; | ||||
|             double pow4 = Math.pow(2.718281828459045d, (-d21) * d20 * d4); | ||||
|             double d23 = this.mDampedFreq; | ||||
|             double sin = (-d23) * d5 * Math.sin(d23 * d4); | ||||
|             double d24 = this.mDampedFreq; | ||||
|             cos = d22 + (pow4 * (sin + (d19 * d24 * Math.cos(d24 * d4)))); | ||||
|             d3 = pow3; | ||||
|         } | ||||
|         this.mMassState.mValue = (float) (d3 + this.mFinalPosition); | ||||
|         this.mMassState.mVelocity = (float) cos; | ||||
|         return this.mMassState; | ||||
|     } | ||||
|  | ||||
|     void setValueThreshold(double d) { | ||||
|         double abs = Math.abs(d); | ||||
|         this.mValueThreshold = abs; | ||||
|         this.mVelocityThreshold = abs * VELOCITY_THRESHOLD_MULTIPLIER; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user