add a Snooze button to Reminder activity

This commit is contained in:
tibbi
2018-03-14 19:21:03 +01:00
parent 10c5b07c90
commit 3c5fe3b935
4 changed files with 42 additions and 13 deletions

View File

@ -41,7 +41,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.15.17' implementation 'com.simplemobiletools:commons:3.15.18'
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

@ -7,9 +7,7 @@ import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.extensions.* import com.simplemobiletools.clock.extensions.*
import com.simplemobiletools.clock.helpers.ALARM_ID import com.simplemobiletools.clock.helpers.ALARM_ID
import com.simplemobiletools.clock.models.Alarm import com.simplemobiletools.clock.models.Alarm
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.updateTextColors
import kotlinx.android.synthetic.main.activity_reminder.* import kotlinx.android.synthetic.main.activity_reminder.*
class ReminderActivity : SimpleActivity() { class ReminderActivity : SimpleActivity() {
@ -36,6 +34,12 @@ class ReminderActivity : SimpleActivity() {
finish() finish()
} }
reminder_snooze.beVisibleIf(isAlarmReminder)
reminder_snooze.applyColorFilter(config.textColor)
reminder_snooze.setOnClickListener {
snoozeClicked()
}
Handler().postDelayed({ Handler().postDelayed({
if (isAlarmReminder) { if (isAlarmReminder) {
showAlarmNotification(alarm!!, true) showAlarmNotification(alarm!!, true)
@ -64,4 +68,8 @@ class ReminderActivity : SimpleActivity() {
} }
hideNotificationHandler.removeCallbacksAndMessages(null) hideNotificationHandler.removeCallbacksAndMessages(null)
} }
private fun snoozeClicked() {
}
} }

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" 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" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/reminder_holder" android:id="@+id/reminder_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -10,29 +11,50 @@
android:id="@+id/reminder_title" android:id="@+id/reminder_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp" android:layout_marginTop="100dp"
android:textSize="@dimen/extra_big_text_size" android:textSize="@dimen/extra_big_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Timer expired"/> tools:text="Timer expired"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/reminder_text" android:id="@+id/reminder_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/reminder_title"
android:layout_centerHorizontal="true"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:textSize="@dimen/big_text_size" android:textSize="@dimen/big_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/reminder_title"
tools:text="14:00"/> tools:text="14:00"/>
<ImageView
android:id="@+id/reminder_snooze"
style="@style/MyBorderlessBackgroundStyle"
android:layout_width="@dimen/stopwatch_button_small_size"
android:layout_height="@dimen/stopwatch_button_small_size"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/reminder_stop"
android:padding="@dimen/normal_margin"
android:src="@drawable/ic_snooze"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/reminder_stop"
app:layout_constraintEnd_toStartOf="@+id/reminder_stop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/reminder_stop"/>
<ImageView <ImageView
android:id="@+id/reminder_stop" android:id="@+id/reminder_stop"
android:layout_width="@dimen/stopwatch_button_size" android:layout_width="@dimen/stopwatch_button_size"
android:layout_height="@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:layout_marginBottom="@dimen/big_margin"
android:padding="@dimen/normal_margin" android:padding="@dimen/normal_margin"
android:src="@drawable/ic_stop"/> android:src="@drawable/ic_stop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"/>
</RelativeLayout> </android.support.constraint.ConstraintLayout>

View File

@ -105,7 +105,6 @@
style="@style/MyBorderlessBackgroundStyle" style="@style/MyBorderlessBackgroundStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/stopwatch_button_small_size" android:layout_height="@dimen/stopwatch_button_small_size"
android:layout_alignParentBottom="true"
android:gravity="center" android:gravity="center"
android:letterSpacing="0.1" android:letterSpacing="0.1"
android:paddingLeft="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"