mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-01-31 18:55:12 +01:00
removing timerState config, not sure why was it needed
This commit is contained in:
parent
36f692e652
commit
1ed261e534
@ -64,7 +64,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:7f3e880dc5'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:638d77dd39'
|
||||||
implementation 'com.facebook.stetho:stetho:1.5.1'
|
implementation 'com.facebook.stetho:stetho:1.5.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'com.shawnlin:number-picker:2.4.6'
|
implementation 'com.shawnlin:number-picker:2.4.6'
|
||||||
|
@ -10,6 +10,7 @@ import com.simplemobiletools.clock.extensions.config
|
|||||||
import com.simplemobiletools.clock.helpers.Converters
|
import com.simplemobiletools.clock.helpers.Converters
|
||||||
import com.simplemobiletools.clock.interfaces.TimerDao
|
import com.simplemobiletools.clock.interfaces.TimerDao
|
||||||
import com.simplemobiletools.clock.models.Timer
|
import com.simplemobiletools.clock.models.Timer
|
||||||
|
import com.simplemobiletools.clock.models.TimerState
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
@Database(entities = [Timer::class], version = 1)
|
@Database(entities = [Timer::class], version = 1)
|
||||||
@ -47,7 +48,7 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
Timer(
|
Timer(
|
||||||
id = null,
|
id = null,
|
||||||
seconds = config.timerSeconds,
|
seconds = config.timerSeconds,
|
||||||
state = config.timerState,
|
state = TimerState.Idle,
|
||||||
vibrate = config.timerVibrate,
|
vibrate = config.timerVibrate,
|
||||||
soundUri = config.timerSoundUri,
|
soundUri = config.timerSoundUri,
|
||||||
soundTitle = config.timerSoundTitle,
|
soundTitle = config.timerSoundTitle,
|
||||||
|
@ -26,6 +26,7 @@ import com.simplemobiletools.clock.interfaces.TimerDao
|
|||||||
import com.simplemobiletools.clock.models.Alarm
|
import com.simplemobiletools.clock.models.Alarm
|
||||||
import com.simplemobiletools.clock.models.MyTimeZone
|
import com.simplemobiletools.clock.models.MyTimeZone
|
||||||
import com.simplemobiletools.clock.models.Timer
|
import com.simplemobiletools.clock.models.Timer
|
||||||
|
import com.simplemobiletools.clock.models.TimerState
|
||||||
import com.simplemobiletools.clock.receivers.AlarmReceiver
|
import com.simplemobiletools.clock.receivers.AlarmReceiver
|
||||||
import com.simplemobiletools.clock.receivers.HideAlarmReceiver
|
import com.simplemobiletools.clock.receivers.HideAlarmReceiver
|
||||||
import com.simplemobiletools.clock.receivers.HideTimerReceiver
|
import com.simplemobiletools.clock.receivers.HideTimerReceiver
|
||||||
@ -85,7 +86,7 @@ fun Context.createNewTimer(): Timer {
|
|||||||
return Timer(
|
return Timer(
|
||||||
null,
|
null,
|
||||||
config.timerSeconds,
|
config.timerSeconds,
|
||||||
config.timerState,
|
TimerState.Idle,
|
||||||
config.timerVibrate,
|
config.timerVibrate,
|
||||||
config.timerSoundUri,
|
config.timerSoundUri,
|
||||||
config.timerSoundTitle,
|
config.timerSoundTitle,
|
||||||
|
@ -29,12 +29,6 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
get() = prefs.getInt(TIMER_SECONDS, 300)
|
get() = prefs.getInt(TIMER_SECONDS, 300)
|
||||||
set(lastTimerSeconds) = prefs.edit().putInt(TIMER_SECONDS, lastTimerSeconds).apply()
|
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
|
var timerVibrate: Boolean
|
||||||
get() = prefs.getBoolean(TIMER_VIBRATE, false)
|
get() = prefs.getBoolean(TIMER_VIBRATE, false)
|
||||||
set(timerVibrate) = prefs.edit().putBoolean(TIMER_VIBRATE, timerVibrate).apply()
|
set(timerVibrate) = prefs.edit().putBoolean(TIMER_VIBRATE, timerVibrate).apply()
|
||||||
|
@ -8,7 +8,6 @@ import kotlin.math.pow
|
|||||||
const val SELECTED_TIME_ZONES = "selected_time_zones"
|
const val SELECTED_TIME_ZONES = "selected_time_zones"
|
||||||
const val EDITED_TIME_ZONE_TITLES = "edited_time_zone_titles"
|
const val EDITED_TIME_ZONE_TITLES = "edited_time_zone_titles"
|
||||||
const val TIMER_SECONDS = "timer_seconds"
|
const val TIMER_SECONDS = "timer_seconds"
|
||||||
const val TIMER_STATE = "timer_state"
|
|
||||||
const val TIMER_VIBRATE = "timer_vibrate"
|
const val TIMER_VIBRATE = "timer_vibrate"
|
||||||
const val TIMER_SOUND_URI = "timer_sound_uri"
|
const val TIMER_SOUND_URI = "timer_sound_uri"
|
||||||
const val TIMER_SOUND_TITLE = "timer_sound_title"
|
const val TIMER_SOUND_TITLE = "timer_sound_title"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user