mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-02-08 07:58:38 +01:00
add a FAB at the alarm fragment
This commit is contained in:
parent
f6d1bf3cb5
commit
0e4744a0d2
@ -6,6 +6,8 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.clock.R
|
import com.simplemobiletools.clock.R
|
||||||
|
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||||
|
import kotlinx.android.synthetic.main.fragment_alarm.view.*
|
||||||
|
|
||||||
class AlarmFragment : Fragment() {
|
class AlarmFragment : Fragment() {
|
||||||
lateinit var view: ViewGroup
|
lateinit var view: ViewGroup
|
||||||
@ -14,4 +16,22 @@ class AlarmFragment : Fragment() {
|
|||||||
view = inflater.inflate(R.layout.fragment_alarm, container, false) as ViewGroup
|
view = inflater.inflate(R.layout.fragment_alarm, container, false) as ViewGroup
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
setupViews()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupViews() {
|
||||||
|
view.apply {
|
||||||
|
context!!.updateTextColors(alarm_fragment)
|
||||||
|
alarm_fab.setOnClickListener {
|
||||||
|
fabClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fabClicked() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ class ClockFragment : Fragment() {
|
|||||||
private val ONE_SECOND = 1000L
|
private val ONE_SECOND = 1000L
|
||||||
|
|
||||||
private var passedSeconds = 0
|
private var passedSeconds = 0
|
||||||
private var isFirstResume = true
|
|
||||||
private var displayOtherTimeZones = false
|
private var displayOtherTimeZones = false
|
||||||
private var calendar = Calendar.getInstance()
|
private var calendar = Calendar.getInstance()
|
||||||
private val updateHandler = Handler()
|
private val updateHandler = Handler()
|
||||||
@ -33,19 +32,13 @@ class ClockFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
view = inflater.inflate(R.layout.fragment_clock, container, false) as ViewGroup
|
view = inflater.inflate(R.layout.fragment_clock, container, false) as ViewGroup
|
||||||
setupDateTime()
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
displayOtherTimeZones = context!!.config.displayOtherTimeZones
|
displayOtherTimeZones = context!!.config.displayOtherTimeZones
|
||||||
if (!isFirstResume) {
|
setupDateTime()
|
||||||
setupDateTime()
|
|
||||||
}
|
|
||||||
|
|
||||||
isFirstResume = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
@ -5,4 +5,19 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/alarm_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyFloatingActionButton
|
||||||
|
android:id="@+id/alarm_fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="@dimen/activity_margin"
|
||||||
|
android:src="@drawable/ic_plus"/>
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user