diff --git a/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmFragment.kt b/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmFragment.kt index 7ad134b..feb70e5 100644 --- a/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmFragment.kt +++ b/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmFragment.kt @@ -119,7 +119,7 @@ class RhythmFragment : BaseFragment(R.layout.fragment_rhy ivRhythmBg.setImageResource(getResource("img_rhythm_bg_$color", DRAWABLE)) lottieRhythmBg.apply { setAnimation(getResource("stempo_rhythm_$color", RAW)) - speed = viewModel.bpm / 120.00000000000F + speed = viewModel.bpm / FLOAT_120 playAnimation() } } @@ -237,5 +237,7 @@ class RhythmFragment : BaseFragment(R.layout.fragment_rhy private const val COLOR = "color" private const val DRAWABLE = "drawable" private const val RAW = "raw" + + private const val FLOAT_120 = 120.00000000000000000000F } } \ No newline at end of file diff --git a/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmViewModel.kt b/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmViewModel.kt index 9177d7a..0de4e0a 100644 --- a/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmViewModel.kt +++ b/presentation/src/main/java/com/kkkk/presentation/main/rhythm/RhythmViewModel.kt @@ -47,7 +47,7 @@ constructor( private fun initRhythmLevelFromDataStore() { val currentLevel = userRepository.getBpmLevel() filename = "stempo_level_$currentLevel" - bpm = 40 + currentLevel * 10 + bpm = setBpm(currentLevel) _rhythmLevel.value = currentLevel tempRhythmLevel.value = currentLevel } @@ -67,8 +67,8 @@ constructor( fun setRhythmLevel() { isSubmitted = true filename = "stempo_level_" + tempRhythmLevel.value.toString() - bpm = 40 + (tempRhythmLevel.value?.times(10) ?: 10) - _rhythmLevel.value = tempRhythmLevel.value ?: -1 + bpm = setBpm(tempRhythmLevel.value ?: 1) + _rhythmLevel.value = tempRhythmLevel.value ?: 1 userRepository.setBpmLevel(rhythmLevel.value) } @@ -111,6 +111,8 @@ constructor( } } + fun setBpm(level: Int) = 40 + level * 10 + companion object { const val LEVEL_UNDEFINED = -1 }