diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt index 2f8c24ae..538192ff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt @@ -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 diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Config.kt index e243589e..2ec0e0b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Config.kt @@ -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() diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt index fe6f409e..d229a3b5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt @@ -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" diff --git a/app/src/main/res/layout/fragment_timer.xml b/app/src/main/res/layout/fragment_timer.xml index 9d5190bd..766a14e7 100644 --- a/app/src/main/res/layout/fragment_timer.xml +++ b/app/src/main/res/layout/fragment_timer.xml @@ -1,6 +1,5 @@ - + tools:text="00:00" /> + tools:text="05:00" /> + android:textSize="@dimen/bigger_text_size" /> @@ -65,7 +64,38 @@ android:padding="@dimen/activity_margin" android:textSize="@dimen/bigger_text_size" app:layout_constraintTop_toBottomOf="@+id/timer_vibrate_holder" - tools:text="Default alarm"/> + tools:text="Default alarm" /> + + + + + + + + app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintTop_toTopOf="@+id/timer_play_pause" />