Reputation: 606
Any Android phone has developer options to modify animation speed. Window animation scale, Transition animation scale, and Animator duration scale are the three settings I'm talking about.
The below code snippet ignores your settings:
.delay(200, TimeUnit.MILLISECONDS).subscribe
The code ignores animation settings because "delay" is not inherently tied to animations. In my code's case, it is.
How can I get this code in my app to scale based on the device's developer options animation scale settings?
Upvotes: 2
Views: 113
Reputation: 606
So I found out how to get the system settings for a multiplier...
.delay(getScaledDelayDuration(200), TimeUnit.MILLISECONDS).subscribe
private long getScaledDelayDuration(long delay) {
float multiplier = Settings.System.getFloat(
this.getContext().getContentResolver(),
Settings.System.TRANSITION_ANIMATION_SCALE, 1);
return (long) (multiplier * delay);
}
...but that not only doesn't solve the root issue I'm having, it also is just not a good way to go about this at all. I'm thinking I should just delete the question at this point.
Upvotes: 1
Reputation: 5635
Do not tie your code to animation using delay in milliseconds. While this is an easy solution, the animation delay or duration, may differ from the value you set to it. Instead, you can use animation listeners callbacks.
Upvotes: 1