mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-06-05 22:19:17 +02:00
set the timer to 5 minutes by default
This commit is contained in:
@ -6,14 +6,19 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.simplemobiletools.clock.R
|
||||
import com.simplemobiletools.clock.extensions.config
|
||||
import com.simplemobiletools.commons.extensions.getFormattedDuration
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import kotlinx.android.synthetic.main.fragment_timer.*
|
||||
import kotlinx.android.synthetic.main.fragment_timer.view.*
|
||||
|
||||
class TimerFragment : Fragment() {
|
||||
lateinit var view: ViewGroup
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
view = inflater.inflate(R.layout.fragment_timer, container, false) as ViewGroup
|
||||
view = (inflater.inflate(R.layout.fragment_timer, container, false) as ViewGroup).apply {
|
||||
timer_time.text = context!!.config.lastTimerSeconds.getFormattedDuration()
|
||||
}
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
@ -26,6 +31,7 @@ class TimerFragment : Fragment() {
|
||||
view.apply {
|
||||
context!!.updateTextColors(timer_fragment)
|
||||
}
|
||||
setupTimer()
|
||||
}
|
||||
|
||||
private fun setupTimer() {
|
||||
|
@ -23,4 +23,8 @@ class Config(context: Context) : BaseConfig(context) {
|
||||
var editedTimeZoneTitles: Set<String>
|
||||
get() = prefs.getStringSet(EDITED_TIME_ZONE_TITLES, HashSet())
|
||||
set(editedTimeZoneTitles) = prefs.edit().putStringSet(EDITED_TIME_ZONE_TITLES, editedTimeZoneTitles).apply()
|
||||
|
||||
var lastTimerSeconds: Int
|
||||
get() = prefs.getInt(LAST_TIMER_SECONDS, 300)
|
||||
set(lastTimerSeconds) = prefs.edit().putInt(LAST_TIMER_SECONDS, lastTimerSeconds).apply()
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ const val SHOW_SECONDS = "show_seconds"
|
||||
const val DISPLAY_OTHER_TIME_ZONES = "display_other_time_zones"
|
||||
const val SELECTED_TIME_ZONES = "selected_time_zones"
|
||||
const val EDITED_TIME_ZONE_TITLES = "edited_time_zone_titles"
|
||||
const val LAST_TIMER_SECONDS = "last_timer_seconds"
|
||||
|
||||
const val TABS_COUNT = 4
|
||||
const val EDITED_TIME_ZONE_SEPARATOR = ":"
|
||||
|
Reference in New Issue
Block a user