diff --git a/common/src/main/java/com/habitrpg/common/habitica/views/ValueBar.kt b/common/src/main/java/com/habitrpg/common/habitica/views/ValueBar.kt index 54d70ad78..2e3a4a87b 100644 --- a/common/src/main/java/com/habitrpg/common/habitica/views/ValueBar.kt +++ b/common/src/main/java/com/habitrpg/common/habitica/views/ValueBar.kt @@ -184,11 +184,16 @@ class ValueBar(context: Context, attrs: AttributeSet?) : FrameLayout(context, at if (animationDuration == 0L || binding.valueTextView.text.isEmpty()) { currentValue = value } else { - val animator = ValueAnimator.ofInt(currentValue.toInt(), value.toInt()) + val animator = if (0 < value && value < 1) { + // Show floating points in animation only if the value is between 0 to 1 + ValueAnimator.ofFloat(currentValue.toFloat(), value.toFloat()) + } else { + ValueAnimator.ofInt(currentValue.toInt(), value.toInt()) + } animator.duration = animationDuration animator.startDelay = animationDelay animator.addUpdateListener { - currentValue = (it.animatedValue as Int).toDouble() + currentValue = (it.animatedValue as? Int)?.toDouble() ?: (it.animatedValue as Float).toDouble() updateBar() } animator.start()