mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Added view rotation animator extension to Utilities.kt
This commit is contained in:
1 parent
8164384498
commit
704dac6a75
1 file changed
+11
@@ -1,7 +1,9 @@
|
||||
package com.rtbishop.look4sat.utility
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.SharedPreferences
|
||||
import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.round
|
||||
@@ -26,6 +28,15 @@ object Utilities {
|
||||
return round(this * multiplier) / multiplier
|
||||
}
|
||||
|
||||
fun View.getRotationAnimator(): ObjectAnimator {
|
||||
return ObjectAnimator.ofFloat(this, "rotation", 0f, 360f).apply {
|
||||
duration = 800
|
||||
repeatCount = ObjectAnimator.INFINITE
|
||||
repeatMode = ObjectAnimator.RESTART
|
||||
interpolator = LinearInterpolator()
|
||||
}
|
||||
}
|
||||
|
||||
fun SharedPreferences.Editor.putDouble(key: String, double: Double) {
|
||||
putLong(key, double.toRawBits())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user