add a FAB at the alarm fragment

This commit is contained in:
tibbi 2018-03-03 23:00:48 +01:00
parent f6d1bf3cb5
commit 0e4744a0d2
3 changed files with 36 additions and 8 deletions

View File

@ -6,6 +6,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.simplemobiletools.clock.R
import com.simplemobiletools.commons.extensions.updateTextColors
import kotlinx.android.synthetic.main.fragment_alarm.view.*
class AlarmFragment : Fragment() {
lateinit var view: ViewGroup
@ -14,4 +16,22 @@ class AlarmFragment : Fragment() {
view = inflater.inflate(R.layout.fragment_alarm, container, false) as ViewGroup
return view
}
override fun onResume() {
super.onResume()
setupViews()
}
private fun setupViews() {
view.apply {
context!!.updateTextColors(alarm_fragment)
alarm_fab.setOnClickListener {
fabClicked()
}
}
}
private fun fabClicked() {
}
}

View File

@ -24,7 +24,6 @@ class ClockFragment : Fragment() {
private val ONE_SECOND = 1000L
private var passedSeconds = 0
private var isFirstResume = true
private var displayOtherTimeZones = false
private var calendar = Calendar.getInstance()
private val updateHandler = Handler()
@ -33,19 +32,13 @@ class ClockFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
view = inflater.inflate(R.layout.fragment_clock, container, false) as ViewGroup
setupDateTime()
return view
}
override fun onResume() {
super.onResume()
displayOtherTimeZones = context!!.config.displayOtherTimeZones
if (!isFirstResume) {
setupDateTime()
}
isFirstResume = false
setupDateTime()
}
override fun onPause() {

View File

@ -5,4 +5,19 @@
android:layout_width="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>