-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathAMAAnimationsStatusModule.kt
More file actions
38 lines (33 loc) · 1.25 KB
/
AMAAnimationsStatusModule.kt
File metadata and controls
38 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.reactnativeama.modules
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.Promise
import android.provider.Settings
import androidx.annotation.NonNull
class AMAAnimationsStatusModule(private val context: ReactApplicationContext) :
ReactContextBaseJavaModule(context) {
@NonNull
override fun getName(): String {
return "AMAAnimationsStatus"
}
@ReactMethod
fun areAnimationsEnabled(promise: Promise) {
val animationDurationScale = Settings.Global.getFloat(
context.getContentResolver(),
Settings.Global.ANIMATOR_DURATION_SCALE,
1.0f
)
val transitionAnimationScale = Settings.Global.getFloat(
context.getContentResolver(),
Settings.Global.TRANSITION_ANIMATION_SCALE,
1.0f
)
val windowAnimationScale = Settings.Global.getFloat(
context.getContentResolver(),
Settings.Global.WINDOW_ANIMATION_SCALE,
1.0f
)
promise.resolve(animationDurationScale == 1f && transitionAnimationScale == 1f && windowAnimationScale == 1f)
}
}