Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Confusing loading state in Battery Saver on older versions of Android #5710

Open
graciouselectric opened this issue May 2, 2024 · 6 comments
Labels

Comments

@graciouselectric
Copy link

graciouselectric commented May 2, 2024

Summary

Dear developers,

I noticed that, when I enable Battery Saver on Android 8.1, the indeterminate ProgressBars in the app are not properly shown. This is a known problem in Android API level <28, see e.g. this StackOverflow question. Battery Saver disables animations, also on progress bars on these versions. This is quite confusing because the loading state is not properly represented. It is fixed in later Android versions, where progress bars do appear and animate.

Looking at the code, indeterminate progress bars are created here, among other places:

className='fr.free.nrw.commons.contributions.ContributionViewHolder', lineNumber=146

To fix this issue, one can check ValueAnimator.areAnimatorsEnabled() and provide a different UI element, such as a text label, when animations are disabled.

Steps to reproduce

  1. Open the app in Battery Saver mode

Expected behaviour

Progress bar animates

Actual behaviour

A 'reload' icon is shown

Device name

No response

Android version

Android 8.1

Commons app version

4.2.1

Device logs

No response

Screen-shots

fr.free.nrw.commons.mov

Would you like to work on the issue?

None

@graciouselectric graciouselectric changed the title [Bug]: [Bug]: Confusing loading state in Battery Saver May 2, 2024
@nicolas-raoul nicolas-raoul changed the title [Bug]: Confusing loading state in Battery Saver [Bug]: Confusing loading state in Battery Saver on Android 8.1 May 2, 2024
@RitikaPahwa4444
Copy link
Collaborator

RitikaPahwa4444 commented May 2, 2024

Are we sure this is specific to API levels < 28? I remember seeing this reload icon even on an Android 12 device. I don't have that device now to confirm if it still happens, but it would be good to validate for all the cases.

@nicolas-raoul nicolas-raoul changed the title [Bug]: Confusing loading state in Battery Saver on Android 8.1 [Bug]: Confusing loading state in Battery Saver on older versions of Android May 2, 2024
@graciouselectric
Copy link
Author

That interesting, I've never seen it on more recent versions. Building a toy project just now on the Android 12 emulator, I can't reproduce the bug there.

@RitikaPahwa4444
Copy link
Collaborator

I used to test a lot with different battery saver conditions on my Android 8.1 device, never saw this reload icon. I tested again, the progress bar still appears normal on that device. Turning animations off from the developer options does make it appear like a reload icon, though.

Also, I managed to get this icon on an Android 14 device by turning animations off. So, it's possible that I turned it off while running UI tests on that Android 12 device too (with the battery saver turned on, hence the confusion).

@graciouselectric
Copy link
Author

Aha. On many (most?) devices BS turns off animations too, but I guess this depends on OEM implementation. I'm emulating a Pixel 7. Alas, the areAnimatorsEnabled() check works as far as I can tell, or are you seeing the 'reload' icon while the check returns true too?

@RitikaPahwa4444
Copy link
Collaborator

I'll check this for both the devices and share my observations :)

@graciouselectric
Copy link
Author

Hi @RitikaPahwa4444, have you had time to look at this already? Happy to help out if I can be of use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@RitikaPahwa4444 @graciouselectric and others