feat(ui): smoothen timer progress by increasing update rate

This commit is contained in:
Nishant Mishra
2025-11-09 19:44:47 +05:30
parent e1fa6c28b9
commit 8f22452691
4 changed files with 3 additions and 6 deletions

View File

@@ -93,6 +93,6 @@ class MainActivity : ComponentActivity() {
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
// Increase the timer loop frequency again when visible to make the progress smoother // Increase the timer loop frequency again when visible to make the progress smoother
appContainer.appTimerRepository.timerFrequency = 10f appContainer.appTimerRepository.timerFrequency = 60f
} }
} }

View File

@@ -54,7 +54,7 @@ class AppTimerRepository : TimerRepository {
override var shortBreakTime = 5 * 60 * 1000L override var shortBreakTime = 5 * 60 * 1000L
override var longBreakTime = 15 * 60 * 1000L override var longBreakTime = 15 * 60 * 1000L
override var sessionLength = 4 override var sessionLength = 4
override var timerFrequency: Float = 10f override var timerFrequency: Float = 60f
override var alarmEnabled = true override var alarmEnabled = true
override var vibrateEnabled = true override var vibrateEnabled = true
override var dndEnabled: Boolean = false override var dndEnabled: Boolean = false

View File

@@ -113,7 +113,7 @@ fun SharedTransitionScope.AlwaysOnDisplay(
} }
onDispose { onDispose {
setTimerFrequency(10f) setTimerFrequency(60f)
window.clearFlags( window.clearFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON

View File

@@ -116,9 +116,6 @@ class TimerViewModel(
) )
).toUri() ).toUri()
preferenceRepository.getBooleanPreference("aod_enabled")
?: preferenceRepository.saveBooleanPreference("aod_enabled", false)
_time.update { timerRepository.focusTime } _time.update { timerRepository.focusTime }
cycles = 0 cycles = 0
startTime = 0L startTime = 0L