Clock - Add labels to timers

This commit is contained in:
Pavol Franek
2020-03-15 07:47:59 +01:00
parent 08aa7bf62c
commit ceeb3ccd22
4 changed files with 48 additions and 8 deletions

View File

@ -43,6 +43,7 @@ class TimerFragment : Fragment() {
val textColor = config.textColor
timer_time.text = config.timerSeconds.getFormattedDuration()
timer_label.setText(config.timerLabel)
requiredActivity.updateTextColors(timer_fragment)
timer_play_pause.background = resources.getColoredDrawableWithColor(R.drawable.circle_background_filled, context!!.getAdjustedPrimaryColor())
@ -109,6 +110,10 @@ class TimerFragment : Fragment() {
context.checkAlarmsWithDeletedSoundUri(sound.uri)
})
}
timer_label.onTextChangeListener { text ->
config.timerLabel = text
}
}
return view

View File

@ -53,6 +53,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(TIMER_MAX_REMINDER_SECS, DEFAULT_MAX_TIMER_REMINDER_SECS)
set(timerMaxReminderSecs) = prefs.edit().putInt(TIMER_MAX_REMINDER_SECS, timerMaxReminderSecs).apply()
var timerLabel: String?
get() = prefs.getString(TIMER_LABEL, null)
set(label) = prefs.edit().putString(TIMER_LABEL, label).apply()
var alarmMaxReminderSecs: Int
get() = prefs.getInt(ALARM_MAX_REMINDER_SECS, DEFAULT_MAX_ALARM_REMINDER_SECS)
set(alarmMaxReminderSecs) = prefs.edit().putInt(ALARM_MAX_REMINDER_SECS, alarmMaxReminderSecs).apply()

View File

@ -13,6 +13,7 @@ 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"
const val TIMER_LABEL = "timer_label"
const val TIMER_MAX_REMINDER_SECS = "timer_max_reminder_secs"
const val ALARM_MAX_REMINDER_SECS = "alarm_max_reminder_secs"
const val ALARM_LAST_CONFIG = "alarm_last_config"