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:
parent
08f09cf06d
commit
85ec96e540
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user