set the timer to 5 minutes by default

This commit is contained in:
tibbi
2018-03-08 19:32:17 +01:00
parent c995e79a1a
commit a7c915b4fd
4 changed files with 29 additions and 2 deletions

View File

@ -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() {

View File

@ -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()
}

View File

@ -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 = ":"