I am using AnimationDrawable to show loading. Something like this:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/loader_00000" android:duration="12" />
<item android:drawable="@drawable/loader_00001" android:duration="12" />
<item android:drawable="@drawable/loader_00002" android:duration="12" />
...
</animation-list>
I am using Fragment. I have this animation in ImageView as src and I am showing it above the content of fragment_layout.
I am running animation like this:
(image_view.drawable as AnimationDrawable).start()
Animation works quite well. But I am loading stuff from a server and populating it to components below animation. I am loading stuff in a background thread. Using CoroutineScope with Dispatchers.IO. However, populating of stuff is causing lagging of my animation. How can I improve it to not lag? Is it possible? Is there a better approach?