Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

respect animator duration scale in own animation

how can I respect the animator duration scale setting in own animations? Can I read the setting and multiply it to my duration or what is a good way for this?

like image 662
ligi Avatar asked Jul 15 '14 11:07

ligi


People also ask

What happens if I turn off animation scale?

However, turning off animations completely may cause bugs in some apps. If that happens to you, speed up the animations to the fastest level, which is the lowest number. Animations also drain the battery on your device faster.

Is it good to turn off window animation scale?

Should I disable animations in Android developer options? Disabling the animations would give you at least this advantage: you'll save some work of your CPU (or even the GPU) that will not have to do this task (of animating things on the screen) anymore.

What does animator duration scale do?

For example, when you tap an option in your smartphone's settings or back out of a menu. Animator duration scale changes the speed of pretty much every other animation that happens within the OS. That includes opening and closing apps, pulling down your notification shade, and so on.

How do I make animations smoother on Android?

Method 1: Developer Options If you're a little more tech oriented then most, you most likely know what the developer options are all about. Using these options, you can change the animation duration scale of transitions, windows, and general animations.


1 Answers

You can try something like this:

    final float animatorSpeed;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        animatorSpeed = Settings.Global.getFloat(
                context.getContentResolver(),
                Settings.Global.ANIMATOR_DURATION_SCALE,
                0);
    } else {
        animatorSpeed = Settings.System.getFloat(
                context.getContentResolver(),
                Settings.System.ANIMATOR_DURATION_SCALE,
                0);
    }
like image 141
IuriiO Avatar answered Sep 25 '22 04:09

IuriiO