mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-06-05 22:19:17 +02:00
allow changing the timer duration by clicking at the top time too
This commit is contained in:
@ -80,12 +80,12 @@ class TimerFragment : Fragment() {
|
|||||||
stopTimer()
|
stopTimer()
|
||||||
}
|
}
|
||||||
|
|
||||||
timer_initial_time.setOnClickListener {
|
timer_time.setOnClickListener {
|
||||||
MyTimePickerDialogDialog(activity as SimpleActivity, config.timerSeconds) { seconds ->
|
changeDuration()
|
||||||
val timerSeconds = if (seconds <= 0) 10 else seconds
|
|
||||||
config.timerSeconds = timerSeconds
|
|
||||||
timer_initial_time.text = timerSeconds.getFormattedDuration()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timer_initial_time.setOnClickListener {
|
||||||
|
changeDuration()
|
||||||
}
|
}
|
||||||
|
|
||||||
timer_vibrate_holder.setOnClickListener {
|
timer_vibrate_holder.setOnClickListener {
|
||||||
@ -126,6 +126,19 @@ class TimerFragment : Fragment() {
|
|||||||
view.timer_time.text = activity?.config?.timerSeconds?.getFormattedDuration()
|
view.timer_time.text = activity?.config?.timerSeconds?.getFormattedDuration()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun changeDuration() {
|
||||||
|
MyTimePickerDialogDialog(activity as SimpleActivity, context!!.config.timerSeconds) { seconds ->
|
||||||
|
val timerSeconds = if (seconds <= 0) 10 else seconds
|
||||||
|
activity?.config?.timerSeconds = timerSeconds
|
||||||
|
val duration = timerSeconds.getFormattedDuration()
|
||||||
|
view.timer_initial_time.text = duration
|
||||||
|
|
||||||
|
if (view.timer_reset.isGone()) {
|
||||||
|
stopTimer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onMessageEvent(state: TimerState.Idle) {
|
fun onMessageEvent(state: TimerState.Idle) {
|
||||||
view.timer_time.text = requiredActivity.config.timerSeconds.getFormattedDuration()
|
view.timer_time.text = requiredActivity.config.timerSeconds.getFormattedDuration()
|
||||||
|
Reference in New Issue
Block a user