set the timer to 5 minutes by default
This commit is contained in:
parent
c995e79a1a
commit
a7c915b4fd
|
@ -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 = ":"
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/timer_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/timer_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/normal_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:textSize="@dimen/stopwatch_text_size"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="00:00"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
|
Loading…
Reference in New Issue