1
0
mirror of https://github.com/dzeiocom/OpenHealth.git synced 2025-04-22 19:02:16 +00:00

fix: crash while app is animating the homepage (#151)

This commit is contained in:
Florian Bouillon 2023-02-26 16:24:11 +01:00 committed by GitHub
parent 08f09cf06d
commit 85ec96e540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,6 +230,10 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentHomeBinding>(HomeViewMo
)
animator.duration = 300 // ms
animator.addUpdateListener {
val localView = view
if (localView == null) {
return@addUpdateListener
}
this.oldValue = (it.animatedValue as Int).toFloat()
val value = 100 * it.animatedValue as Int / viewModel.dailyWaterIntake
@ -248,7 +252,7 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentHomeBinding>(HomeViewMo
100f,
rect,
MaterialColors.getColor(
requireView(),
localView,
com.google.android.material.R.attr.colorOnPrimary
),
3f
@ -260,7 +264,7 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentHomeBinding>(HomeViewMo
min(max(value, 0.01f), 100f),
rect,
MaterialColors.getColor(
requireView(),
localView,
com.google.android.material.R.attr.colorPrimary
),
6f