Reputation: 2914
I want to add loading animation for my App. Two dots next to each other blinking alternately (similar to railway crossing lights). It is working fine for other phones but Huawei has something wrong with animation duration and these two dots animation starting to be more and more out of sync and suddently they start to blink at the same time.
Anyone has this issue before? I can confirm I tested it on Razer Phone 2, Xiaomi Mi A1 and Samsung Galaxy S7 and it is working fine without glitches. Just Huawei phones have this issue. Also Huawei Android version is the same as Xiaomi Mi A1 version so it is not version related.
Code:
val anim1 = ObjectAnimator.ofFloat(dotAnimView1, View.ALPHA, 1f, 0f).apply {
duration = 900
repeatMode = ValueAnimator.REVERSE
repeatCount = Animation.INFINITE
}
val anim2 = ObjectAnimator.ofFloat(dotAnimView2, View.ALPHA, 1f, 0f).apply {
duration = 900
repeatMode = ValueAnimator.REVERSE
repeatCount = Animation.INFINITE
}
if((anim1?.isRunning == false || anim2?.isRunning == false)){
anim1.start()
post(900){ anim2.start() }
}
Upvotes: 0
Views: 286
Reputation: 3167
Check Developer Options --> Animator Duration Scale. If it is set to 0.5x or Animation off you might see this weird occasion. If that is the case, try setting it to 1x which is the default value.
Upvotes: 1