mirror of
https://github.com/dzeiocom/OpenHealth.git
synced 2025-06-07 07:19:54 +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.duration = 300 // ms
|
||||||
animator.addUpdateListener {
|
animator.addUpdateListener {
|
||||||
|
val localView = view
|
||||||
|
if (localView == null) {
|
||||||
|
return@addUpdateListener
|
||||||
|
}
|
||||||
this.oldValue = (it.animatedValue as Int).toFloat()
|
this.oldValue = (it.animatedValue as Int).toFloat()
|
||||||
val value = 100 * it.animatedValue as Int / viewModel.dailyWaterIntake
|
val value = 100 * it.animatedValue as Int / viewModel.dailyWaterIntake
|
||||||
|
|
||||||
@ -248,7 +252,7 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentHomeBinding>(HomeViewMo
|
|||||||
100f,
|
100f,
|
||||||
rect,
|
rect,
|
||||||
MaterialColors.getColor(
|
MaterialColors.getColor(
|
||||||
requireView(),
|
localView,
|
||||||
com.google.android.material.R.attr.colorOnPrimary
|
com.google.android.material.R.attr.colorOnPrimary
|
||||||
),
|
),
|
||||||
3f
|
3f
|
||||||
@ -260,7 +264,7 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentHomeBinding>(HomeViewMo
|
|||||||
min(max(value, 0.01f), 100f),
|
min(max(value, 0.01f), 100f),
|
||||||
rect,
|
rect,
|
||||||
MaterialColors.getColor(
|
MaterialColors.getColor(
|
||||||
requireView(),
|
localView,
|
||||||
com.google.android.material.R.attr.colorPrimary
|
com.google.android.material.R.attr.colorPrimary
|
||||||
),
|
),
|
||||||
6f
|
6f
|
||||||
|
Loading…
x
Reference in New Issue
Block a user