removing timerState config, not sure why was it needed

This commit is contained in:
tibbi 2022-07-03 15:26:39 +02:00
parent 36f692e652
commit 1ed261e534
5 changed files with 5 additions and 10 deletions

View File

@ -64,7 +64,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:7f3e880dc5'
implementation 'com.github.SimpleMobileTools:Simple-Commons:638d77dd39'
implementation 'com.facebook.stetho:stetho:1.5.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.shawnlin:number-picker:2.4.6'

View File

@ -10,6 +10,7 @@ import com.simplemobiletools.clock.extensions.config
import com.simplemobiletools.clock.helpers.Converters
import com.simplemobiletools.clock.interfaces.TimerDao
import com.simplemobiletools.clock.models.Timer
import com.simplemobiletools.clock.models.TimerState
import java.util.concurrent.Executors
@Database(entities = [Timer::class], version = 1)
@ -47,7 +48,7 @@ abstract class AppDatabase : RoomDatabase() {
Timer(
id = null,
seconds = config.timerSeconds,
state = config.timerState,
state = TimerState.Idle,
vibrate = config.timerVibrate,
soundUri = config.timerSoundUri,
soundTitle = config.timerSoundTitle,

View File

@ -26,6 +26,7 @@ import com.simplemobiletools.clock.interfaces.TimerDao
import com.simplemobiletools.clock.models.Alarm
import com.simplemobiletools.clock.models.MyTimeZone
import com.simplemobiletools.clock.models.Timer
import com.simplemobiletools.clock.models.TimerState
import com.simplemobiletools.clock.receivers.AlarmReceiver
import com.simplemobiletools.clock.receivers.HideAlarmReceiver
import com.simplemobiletools.clock.receivers.HideTimerReceiver
@ -85,7 +86,7 @@ fun Context.createNewTimer(): Timer {
return Timer(
null,
config.timerSeconds,
config.timerState,
TimerState.Idle,
config.timerVibrate,
config.timerSoundUri,
config.timerSoundTitle,

View File

@ -29,12 +29,6 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(TIMER_SECONDS, 300)
set(lastTimerSeconds) = prefs.edit().putInt(TIMER_SECONDS, lastTimerSeconds).apply()
var timerState: TimerState
get() = prefs.getString(TIMER_STATE, null)?.let { state ->
gson.fromJson(state, StateWrapper::class.java)
}?.state ?: TimerState.Idle
set(state) = prefs.edit().putString(TIMER_STATE, gson.toJson(StateWrapper(state))).apply()
var timerVibrate: Boolean
get() = prefs.getBoolean(TIMER_VIBRATE, false)
set(timerVibrate) = prefs.edit().putBoolean(TIMER_VIBRATE, timerVibrate).apply()

View File

@ -8,7 +8,6 @@ import kotlin.math.pow
const val SELECTED_TIME_ZONES = "selected_time_zones"
const val EDITED_TIME_ZONE_TITLES = "edited_time_zone_titles"
const val TIMER_SECONDS = "timer_seconds"
const val TIMER_STATE = "timer_state"
const val TIMER_VIBRATE = "timer_vibrate"
const val TIMER_SOUND_URI = "timer_sound_uri"
const val TIMER_SOUND_TITLE = "timer_sound_title"