add a stop button to the reminder activity

This commit is contained in:
tibbi 2018-03-14 15:54:58 +01:00
parent 50f5cf3cc5
commit afe7c695af
5 changed files with 27 additions and 7 deletions

View File

@ -41,7 +41,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.15.15' implementation 'com.simplemobiletools:commons:3.15.17'
implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.shawnlin:number-picker:2.4.6' implementation 'com.shawnlin:number-picker:2.4.6'

View File

@ -161,8 +161,8 @@ class MainActivity : SimpleActivity() {
val faqItems = arrayListOf( val faqItems = arrayListOf(
FAQItem(R.string.faq_1_title, R.string.faq_1_text), FAQItem(R.string.faq_1_title, R.string.faq_1_text),
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons), FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons), FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons),
FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons) FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons)
) )
startAboutActivity(R.string.app_name, LICENSE_STETHO or LICENSE_NUMBER_PICKER, BuildConfig.VERSION_NAME, faqItems) startAboutActivity(R.string.app_name, LICENSE_STETHO or LICENSE_NUMBER_PICKER, BuildConfig.VERSION_NAME, faqItems)

View File

@ -1,10 +1,13 @@
package com.simplemobiletools.clock.activities package com.simplemobiletools.clock.activities
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import com.simplemobiletools.clock.R import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.extensions.hideTimerNotification import com.simplemobiletools.clock.extensions.hideTimerNotification
import com.simplemobiletools.clock.extensions.showOverLockscreen import com.simplemobiletools.clock.extensions.showOverLockscreen
import com.simplemobiletools.clock.extensions.showTimerNotification import com.simplemobiletools.clock.extensions.showTimerNotification
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
import kotlinx.android.synthetic.main.activity_reminder.* import kotlinx.android.synthetic.main.activity_reminder.*
@ -15,13 +18,21 @@ class ReminderActivity : SimpleActivity() {
setContentView(R.layout.activity_reminder) setContentView(R.layout.activity_reminder)
showOverLockscreen() showOverLockscreen()
updateTextColors(reminder_holder) updateTextColors(reminder_holder)
reminder_title.text = getString(R.string.timer) reminder_title.text = getString(R.string.timer)
reminder_text.text = getString(R.string.time_expired) reminder_text.text = getString(R.string.time_expired)
showTimerNotification() reminder_stop.background = resources.getColoredDrawableWithColor(R.drawable.circle_background_filled, getAdjustedPrimaryColor())
reminder_stop.setOnClickListener {
finish()
}
Handler().postDelayed({
showTimerNotification()
}, 1000L)
} }
override fun onDestroy() { override fun onStop() {
super.onDestroy() super.onStop()
hideTimerNotification() hideTimerNotification()
} }
} }

View File

@ -19,7 +19,6 @@ import com.simplemobiletools.clock.extensions.*
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import kotlinx.android.synthetic.main.fragment_timer.view.* import kotlinx.android.synthetic.main.fragment_timer.view.*
class TimerFragment : Fragment() { class TimerFragment : Fragment() {
private val UPDATE_INTERVAL = 1000L private val UPDATE_INTERVAL = 1000L

View File

@ -25,4 +25,14 @@
android:textSize="@dimen/big_text_size" android:textSize="@dimen/big_text_size"
tools:text="14:00"/> tools:text="14:00"/>
<ImageView
android:id="@+id/reminder_stop"
android:layout_width="@dimen/stopwatch_button_size"
android:layout_height="@dimen/stopwatch_button_size"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/big_margin"
android:padding="@dimen/normal_margin"
android:src="@drawable/ic_stop"/>
</RelativeLayout> </RelativeLayout>