From f1fe2cf1fa1d8760e15e38778b01dc1175dd2640 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 14 Mar 2018 13:50:51 +0100 Subject: [PATCH] send the reminder title and text to ReminderActivity via extras --- .../clock/activities/ReminderActivity.kt | 7 +++++++ .../clock/fragments/TimerFragment.kt | 6 +++--- .../clock/helpers/Constants.kt | 2 ++ app/src/main/res/layout/activity_reminder.xml | 20 +++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt index 2c60c150..456cc84c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt @@ -3,6 +3,10 @@ package com.simplemobiletools.clock.activities import android.os.Bundle import com.simplemobiletools.clock.R import com.simplemobiletools.clock.extensions.showOverLockscreen +import com.simplemobiletools.clock.helpers.REMINDER_TEXT +import com.simplemobiletools.clock.helpers.REMINDER_TITLE +import com.simplemobiletools.commons.extensions.updateTextColors +import kotlinx.android.synthetic.main.activity_reminder.* class ReminderActivity : SimpleActivity() { @@ -10,5 +14,8 @@ class ReminderActivity : SimpleActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_reminder) showOverLockscreen() + updateTextColors(reminder_holder) + reminder_title.text = intent.getStringExtra(REMINDER_TITLE) + reminder_text.text = intent.getStringExtra(REMINDER_TEXT) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt index e6d91e2d..8bc6311e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt @@ -28,9 +28,7 @@ import com.simplemobiletools.clock.extensions.colorLeftDrawable import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.extensions.hideNotification import com.simplemobiletools.clock.extensions.isScreenOn -import com.simplemobiletools.clock.helpers.OPEN_TAB -import com.simplemobiletools.clock.helpers.TAB_TIMER -import com.simplemobiletools.clock.helpers.TIMER_NOTIF_ID +import com.simplemobiletools.clock.helpers.* import com.simplemobiletools.clock.receivers.TimerReceiver import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.isLollipopPlus @@ -199,6 +197,8 @@ class TimerFragment : Fragment() { }, context?.config!!.timerMaxReminderSecs * 1000L) } else { Intent(context, ReminderActivity::class.java).apply { + putExtra(REMINDER_TITLE, context!!.getString(R.string.timer)) + putExtra(REMINDER_TEXT, context!!.getString(R.string.time_expired)) activity?.startActivity(this) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt index 9b5503ae..da6424f5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/helpers/Constants.kt @@ -22,6 +22,8 @@ const val DEFAULT_ALARM_MINUTES = 480 const val DAY_MINUTES = 1440 const val DEFAULT_MAX_ALARM_REMINDER_SECS = 300 const val DEFAULT_MAX_TIMER_REMINDER_SECS = 60 +const val REMINDER_TITLE = "reminder_title" +const val REMINDER_TEXT = "reminder_text" const val OPEN_ALARMS_TAB_INTENT_ID = 9996 const val UPDATE_WIDGET_INTENT_ID = 9997 diff --git a/app/src/main/res/layout/activity_reminder.xml b/app/src/main/res/layout/activity_reminder.xml index 1f44dd27..97b8c198 100644 --- a/app/src/main/res/layout/activity_reminder.xml +++ b/app/src/main/res/layout/activity_reminder.xml @@ -1,8 +1,28 @@ + + + +