material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.38k stars 3.07k forks source link

[Progress indicator] Doesn't spin on API level 21 #4179

Open Leonidius20 opened 6 months ago

Leonidius20 commented 6 months ago

Description: Neither the circular progress indicator, nor the linear one have animation on Android 5.0 (api level 21). They are just stuck in one state without any animation. At the same time, the same code produces a progress indicator with proper animation on Android 12.

Interestingly enough, there is exactly the same issue with the Jetpack Compose version of progress indicators (don't spin on android 5, do spin on android 12), although I understand that it is a separate issue.

Android API version: 21

Material Library version: 1.11.0

Device: ASUS ZenPad C 7.0 (P01Y)

pekingme commented 6 months ago

Do you mind to provide a minimum repro sample? It animates with no problems in our catalog on API 21 emulator.

Leonidius20 commented 6 months ago

Here's what happens with linear progress indicators in the app at https://github.com/Leonidius20/Lugat (you can download apk from the releases section):

On Android 12 (works as intended):

https://github.com/material-components/material-components-android/assets/25536411/3f4d4ccb-c533-4862-8216-180daef459ee

On Android 5 (no animation):

https://github.com/material-components/material-components-android/assets/25536411/6bdf4cc1-0cac-40a4-a622-7744584f58c3

Leonidius20 commented 6 months ago

Here's where the indicator is defined in the layout: https://github.com/Leonidius20/Lugat/blob/29952c18a4f211f563f8487950a47cec399402ed/app/src/main/res/layout/fragment_word_details.xml#L57

And here are the only manipulations that happen with the indicator in the code, which is that the visibility changes between Visible and Gone https://github.com/Leonidius20/Lugat/blob/29952c18a4f211f563f8487950a47cec399402ed/app/src/main/java/io/github/leonidius20/lugat/features/details/ui/WordDetailsFragment.kt#L90