clock: add notification actions for timer & stopwatch #324
- Commit
1bed9a280dcdef209ca28e73a63badd5e2b3ac13- Author
- Vayun Mathur <[email protected]>
- When
- 2026-07-22 05:37 UTC (4 months ago)
- Parents
97381ef
Diff
clock/src/main/AndroidManifest.xml
diff --git a/clock/src/main/AndroidManifest.xml b/clock/src/main/AndroidManifest.xmlindex b0b1fd9d78..78c4239081 100644--- a/clock/src/main/AndroidManifest.xml+++ b/clock/src/main/AndroidManifest.xml@@ -49,6 +49,14 @@ android:name=".util.TimerReceiver" android:enabled="true" android:exported="false" />+ <receiver+ android:name=".util.TimerActionReceiver"+ android:enabled="true"+ android:exported="false" />+ <receiver+ android:name=".util.StopwatchActionReceiver"+ android:enabled="true"+ android:exported="false" /> <receiver android:name=".util.AlarmReceiver" android:enabled="true"
clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.kt b/clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.ktindex d90f774cb0..b751f662de 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.kt@@ -418,16 +418,71 @@ fun sendTimerNotification(context: Context, timer: Timer, isStarting: Boolean) { } val endTimestamp = System.currentTimeMillis() + remaining.inWholeMilliseconds + // Create action intents+ val pauseIntent = PendingIntent.getBroadcast(+ context, notificationId + 1,+ Intent(context, com.vayunmathur.clock.util.TimerActionReceiver::class.java).apply {+ action = com.vayunmathur.clock.util.TimerActionReceiver.ACTION_PAUSE+ putExtra("timer_id", timer.id)+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ val resumeIntent = PendingIntent.getBroadcast(+ context, notificationId + 2,+ Intent(context, com.vayunmathur.clock.util.TimerActionReceiver::class.java).apply {+ action = com.vayunmathur.clock.util.TimerActionReceiver.ACTION_RESUME+ putExtra("timer_id", timer.id)+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ val cancelIntent = PendingIntent.getBroadcast(+ context, notificationId + 3,+ Intent(context, com.vayunmathur.clock.util.TimerActionReceiver::class.java).apply {+ action = com.vayunmathur.clock.util.TimerActionReceiver.ACTION_CANCEL+ putExtra("timer_id", timer.id)+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ val resetIntent = PendingIntent.getBroadcast(+ context, notificationId + 4,+ Intent(context, com.vayunmathur.clock.util.TimerActionReceiver::class.java).apply {+ action = com.vayunmathur.clock.util.TimerActionReceiver.ACTION_RESET+ putExtra("timer_id", timer.id)+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )++ // Content intent to open app+ val contentIntent = PendingIntent.getActivity(+ context, notificationId + 5,+ Intent(context, com.vayunmathur.clock.MainActivity::class.java).apply {+ flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ // 2. Create the Visual Notification (UI-driven)- val notification = NotificationCompat.Builder(context, "active_timers_channel")+ val builder = NotificationCompat.Builder(context, "active_timers_channel") .setSmallIcon(R.drawable.outline_timer_24)- .setContentTitle(timer.name)+ .setContentTitle(timer.name.ifBlank { context.getString(R.string.label_timer) }) .setUsesChronometer(true) .setChronometerCountDown(true) .setWhen(endTimestamp) .setOngoing(true) // Makes it harder to swipe away accidentally .setCategory(NotificationCompat.CATEGORY_ALARM)- .build()+ .setContentIntent(contentIntent)+ .setOnlyAlertOnce(true)++ // Add actions based on timer state+ if (timer.isRunning) {+ builder.addAction(R.drawable.ic_pause_24, context.getString(R.string.action_pause), pauseIntent)+ } else {+ builder.addAction(R.drawable.ic_play_24, context.getString(R.string.action_resume), resumeIntent)+ }+ builder.addAction(R.drawable.ic_cancel_24, context.getString(R.string.action_cancel), cancelIntent)+ builder.addAction(R.drawable.ic_reset_24, context.getString(R.string.action_reset), resetIntent)++ val notification = builder.build() nm.notify(notificationId, notification)
clock/src/main/java/com/vayunmathur/clock/util/ClockViewModel.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/util/ClockViewModel.kt b/clock/src/main/java/com/vayunmathur/clock/util/ClockViewModel.ktindex f02f8a1c96..0e8e1725c3 100644--- a/clock/src/main/java/com/vayunmathur/clock/util/ClockViewModel.kt+++ b/clock/src/main/java/com/vayunmathur/clock/util/ClockViewModel.kt@@ -29,6 +29,7 @@ import kotlinx.coroutines.launch import kotlinx.datetime.LocalTime import kotlin.time.Clock import kotlin.time.Duration+import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds import kotlin.time.Instant @@ -140,6 +141,37 @@ class ClockViewModel( private val _lapTimes = MutableStateFlow<List<Duration>>(emptyList()) val lapTimes: StateFlow<List<Duration>> = _lapTimes.asStateFlow()+ + private fun loadStopwatchState() {+ val ctx = getApplication<Application>()+ val ds = DataStoreUtils.getInstance(ctx)+ viewModelScope.launch(Dispatchers.IO) {+ val isRunning = ds.getBoolean(StopwatchActionReceiver.KEY_STOPWATCH_RUNNING, false)+ val totalMs = ds.getLong(StopwatchActionReceiver.KEY_STOPWATCH_TOTAL) ?: 0L+ val startMs = ds.getLong(StopwatchActionReceiver.KEY_STOPWATCH_START) ?: 0L+ val lapsStr = ds.getString(StopwatchActionReceiver.KEY_STOPWATCH_LAPS) ?: ""+ + _stopwatchRunning.value = isRunning+ _stopwatchTotal.value = totalMs.milliseconds+ _stopwatchStart.value = if (startMs > 0) Instant.fromEpochMilliseconds(startMs) else Clock.System.now()+ + if (lapsStr.isNotEmpty()) {+ _lapTimes.value = lapsStr.split(",").mapNotNull { it.toLongOrNull()?.milliseconds }+ }+ }+ }+ + private fun persistStopwatchState() {+ val ctx = getApplication<Application>()+ val ds = DataStoreUtils.getInstance(ctx)+ viewModelScope.launch(Dispatchers.IO) {+ ds.setBoolean(StopwatchActionReceiver.KEY_STOPWATCH_RUNNING, _stopwatchRunning.value)+ ds.setLong(StopwatchActionReceiver.KEY_STOPWATCH_TOTAL, _stopwatchTotal.value.inWholeMilliseconds)+ ds.setLong(StopwatchActionReceiver.KEY_STOPWATCH_START, _stopwatchStart.value.toEpochMilliseconds())+ val lapsStr = _lapTimes.value.joinToString(",") { it.inWholeMilliseconds.toString() }+ ds.setString(StopwatchActionReceiver.KEY_STOPWATCH_LAPS, lapsStr)+ }+ } /** * Elapsed time the stopwatch should display. When running this includes the@@ -160,6 +192,7 @@ class ClockViewModel( ) fun toggleStopwatch() {+ val ctx = getApplication<Application>() if (_stopwatchRunning.value) { _stopwatchTotal.value = _stopwatchTotal.value + (Clock.System.now() - _stopwatchStart.value) _stopwatchRunning.value = false@@ -167,16 +200,24 @@ class ClockViewModel( _stopwatchStart.value = Clock.System.now() _stopwatchRunning.value = true }+ persistStopwatchState()+ StopwatchNotificationHelper.updateNotification(ctx) } fun resetStopwatch() {+ val ctx = getApplication<Application>() _stopwatchRunning.value = false _stopwatchTotal.value = Duration.ZERO _lapTimes.value = emptyList()+ persistStopwatchState()+ StopwatchNotificationHelper.updateNotification(ctx) } fun addLap() {+ val ctx = getApplication<Application>() _lapTimes.update { it + stopwatchCountingTime.value }+ persistStopwatchState()+ StopwatchNotificationHelper.updateNotification(ctx) } // --- Timer countdown helper ----------------------------------------------@@ -255,6 +296,7 @@ class ClockViewModel( init { loadCities()+ loadStopwatchState() } private fun loadCities() {
clock/src/main/java/com/vayunmathur/clock/util/NotificationUtils.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/util/NotificationUtils.kt b/clock/src/main/java/com/vayunmathur/clock/util/NotificationUtils.ktindex fffa86ac76..18ab7581e9 100644--- a/clock/src/main/java/com/vayunmathur/clock/util/NotificationUtils.kt+++ b/clock/src/main/java/com/vayunmathur/clock/util/NotificationUtils.kt@@ -31,6 +31,12 @@ fun createNotificationChannels(context: Context) { setSound(null, null) // Service handles sound via MediaPlayer enableVibration(false) lockscreenVisibility = Notification.VISIBILITY_PUBLIC+ },+ // 3. Stopwatch channel+ NotificationChannel("stopwatch_channel", context.getString(R.string.channel_stopwatch_name), NotificationManager.IMPORTANCE_LOW).apply {+ description = context.getString(R.string.channel_stopwatch_description)+ setShowBadge(false)+ setSound(null, null) } )) }
clock/src/main/java/com/vayunmathur/clock/util/StopwatchActionReceiver.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/util/StopwatchActionReceiver.kt b/clock/src/main/java/com/vayunmathur/clock/util/StopwatchActionReceiver.ktnew file mode 100644index 0000000000..cb1e5c81b9--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/util/StopwatchActionReceiver.kt@@ -0,0 +1,85 @@+package com.vayunmathur.clock.util++import android.app.NotificationManager+import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import com.vayunmathur.library.util.DataStoreUtils+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.launch+import kotlin.time.Clock+import kotlin.time.Duration+import kotlin.time.Duration.Companion.seconds++class StopwatchActionReceiver : BroadcastReceiver() {+ override fun onReceive(context: Context, intent: Intent) {+ val action = intent.action ?: return+ val pendingResult = goAsync()+ val ds = DataStoreUtils.getInstance(context)++ CoroutineScope(SupervisorJob() + Dispatchers.IO).launch {+ try {+ when (action) {+ ACTION_TOGGLE -> {+ val isRunning = ds.getBoolean(KEY_STOPWATCH_RUNNING, false)+ val totalMs = ds.getLong(KEY_STOPWATCH_TOTAL) ?: 0L+ val startMs = ds.getLong(KEY_STOPWATCH_START) ?: 0L+ + if (isRunning) {+ // Pause: add elapsed time to total+ val now = Clock.System.now().toEpochMilliseconds()+ val elapsed = now - startMs+ ds.setLong(KEY_STOPWATCH_TOTAL, totalMs + elapsed)+ ds.setBoolean(KEY_STOPWATCH_RUNNING, false)+ } else {+ // Resume: set start time to now+ ds.setLong(KEY_STOPWATCH_START, Clock.System.now().toEpochMilliseconds())+ ds.setBoolean(KEY_STOPWATCH_RUNNING, true)+ }+ // Update notification+ StopwatchNotificationHelper.updateNotification(context)+ }+ ACTION_LAP -> {+ val isRunning = ds.getBoolean(KEY_STOPWATCH_RUNNING, false)+ if (!isRunning) return@launch+ + val totalMs = ds.getLong(KEY_STOPWATCH_TOTAL) ?: 0L+ val startMs = ds.getLong(KEY_STOPWATCH_START) ?: 0L+ val now = Clock.System.now().toEpochMilliseconds()+ val currentTotal = totalMs + (now - startMs)+ + val lapsStr = ds.getString(KEY_STOPWATCH_LAPS) ?: ""+ val newLapsStr = if (lapsStr.isEmpty()) currentTotal.toString() else "$lapsStr,$currentTotal"+ ds.setString(KEY_STOPWATCH_LAPS, newLapsStr)+ + StopwatchNotificationHelper.updateNotification(context)+ }+ ACTION_STOP -> {+ ds.setBoolean(KEY_STOPWATCH_RUNNING, false)+ ds.setLong(KEY_STOPWATCH_TOTAL, 0L)+ ds.setString(KEY_STOPWATCH_LAPS, "")+ val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager+ nm.cancel(STOPWATCH_NOTIFICATION_ID)+ }+ }+ } catch (_: Exception) {+ } finally {+ pendingResult.finish()+ }+ }+ }++ companion object {+ const val ACTION_TOGGLE = "com.vayunmathur.clock.STOPWATCH_TOGGLE"+ const val ACTION_LAP = "com.vayunmathur.clock.STOPWATCH_LAP"+ const val ACTION_STOP = "com.vayunmathur.clock.STOPWATCH_STOP"+ + const val KEY_STOPWATCH_RUNNING = "stopwatch_running"+ const val KEY_STOPWATCH_TOTAL = "stopwatch_total_ms"+ const val KEY_STOPWATCH_START = "stopwatch_start_ms"+ const val KEY_STOPWATCH_LAPS = "stopwatch_laps"+ const val STOPWATCH_NOTIFICATION_ID = 9001+ }+}\ No newline at end of file
clock/src/main/java/com/vayunmathur/clock/util/StopwatchNotificationHelper.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/util/StopwatchNotificationHelper.kt b/clock/src/main/java/com/vayunmathur/clock/util/StopwatchNotificationHelper.ktnew file mode 100644index 0000000000..4301472685--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/util/StopwatchNotificationHelper.kt@@ -0,0 +1,93 @@+package com.vayunmathur.clock.util++import android.app.NotificationManager+import android.app.PendingIntent+import android.content.Context+import android.content.Intent+import androidx.core.app.NotificationCompat+import com.vayunmathur.clock.MainActivity+import com.vayunmathur.clock.R+import com.vayunmathur.library.util.DataStoreUtils+import kotlin.time.Clock++object StopwatchNotificationHelper {+ fun updateNotification(context: Context) {+ val ds = DataStoreUtils.getInstance(context)+ val isRunning = ds.getBoolean(StopwatchActionReceiver.KEY_STOPWATCH_RUNNING, false)+ val totalMs = ds.getLong(StopwatchActionReceiver.KEY_STOPWATCH_TOTAL) ?: 0L+ val startMs = ds.getLong(StopwatchActionReceiver.KEY_STOPWATCH_START) ?: 0L+ + val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager+ + if (!isRunning && totalMs == 0L) {+ // Stopwatch is reset, cancel notification+ nm.cancel(StopwatchActionReceiver.STOPWATCH_NOTIFICATION_ID)+ return+ }+ + val elapsedMs = if (isRunning) {+ totalMs + (Clock.System.now().toEpochMilliseconds() - startMs)+ } else {+ totalMs+ }+ + val minutes = elapsedMs / 60000+ val seconds = (elapsedMs % 60000) / 1000+ val contentText = String.format("%02d:%02d", minutes, seconds)+ + // Content intent to open app+ val contentIntent = PendingIntent.getActivity(+ context, 0,+ Intent(context, MainActivity::class.java).apply {+ flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ + // Pause/Resume action+ val toggleIntent = PendingIntent.getBroadcast(+ context, 1,+ Intent(context, StopwatchActionReceiver::class.java).apply {+ action = StopwatchActionReceiver.ACTION_TOGGLE+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ + // Lap action+ val lapIntent = PendingIntent.getBroadcast(+ context, 2,+ Intent(context, StopwatchActionReceiver::class.java).apply {+ action = StopwatchActionReceiver.ACTION_LAP+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ + // Stop action+ val stopIntent = PendingIntent.getBroadcast(+ context, 3,+ Intent(context, StopwatchActionReceiver::class.java).apply {+ action = StopwatchActionReceiver.ACTION_STOP+ },+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ + val builder = NotificationCompat.Builder(context, "stopwatch_channel")+ .setSmallIcon(R.drawable.outline_timer_24)+ .setContentTitle(context.getString(R.string.label_stopwatch))+ .setContentText(contentText)+ .setContentIntent(contentIntent)+ .setOngoing(true)+ .setOnlyAlertOnce(true)+ .setShowWhen(false)+ + if (isRunning) {+ builder.addAction(R.drawable.ic_pause_24, context.getString(R.string.action_pause), toggleIntent)+ builder.addAction(R.drawable.ic_lap_24, context.getString(R.string.action_lap), lapIntent)+ } else {+ builder.addAction(R.drawable.ic_play_24, context.getString(R.string.action_resume), toggleIntent)+ }+ builder.addAction(R.drawable.ic_stop_24, context.getString(R.string.action_stop), stopIntent)+ + nm.notify(StopwatchActionReceiver.STOPWATCH_NOTIFICATION_ID, builder.build())+ }+}\ No newline at end of file
clock/src/main/java/com/vayunmathur/clock/util/TimerActionReceiver.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/util/TimerActionReceiver.kt b/clock/src/main/java/com/vayunmathur/clock/util/TimerActionReceiver.ktnew file mode 100644index 0000000000..068d73ec00--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/util/TimerActionReceiver.kt@@ -0,0 +1,113 @@+package com.vayunmathur.clock.util++import android.app.AlarmManager+import android.app.NotificationManager+import android.app.PendingIntent+import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import androidx.core.app.NotificationCompat+import com.vayunmathur.clock.R+import com.vayunmathur.clock.data.ClockDatabase+import com.vayunmathur.clock.data.Timer+import com.vayunmathur.library.room.buildDatabase+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.launch+import kotlin.time.Clock+import kotlin.time.Duration++class TimerActionReceiver : BroadcastReceiver() {+ override fun onReceive(context: Context, intent: Intent) {+ val action = intent.action ?: return+ val timerId = intent.getLongExtra("timer_id", 0L)+ val pendingResult = goAsync()++ CoroutineScope(SupervisorJob() + Dispatchers.IO).launch {+ try {+ val db = context.buildDatabase<ClockDatabase>(useDeviceProtectedStorage = true)+ val timer = db.timerDao().get(timerId)+ val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager+ val am = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager+ val notificationId = timerId.hashCode()++ when (action) {+ ACTION_PAUSE -> {+ // Pause the timer: calculate remaining, update DB, cancel alarm and notification+ val now = Clock.System.now()+ val remaining = if (timer.isRunning) {+ timer.remainingLength - (now - timer.remainingStartTime)+ } else {+ timer.remainingLength+ }+ val pausedTimer = timer.copy(isRunning = false, remainingLength = remaining.coerceAtLeast(Duration.ZERO))+ db.timerDao().upsert(pausedTimer)+ + // Cancel alarm+ val alarmIntent = Intent(context, TimerReceiver::class.java).apply {+ putExtra("timer_id", timerId)+ putExtra("timer_name", timer.name)+ }+ val pendingAlarm = PendingIntent.getBroadcast(+ context, notificationId, alarmIntent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ am.cancel(pendingAlarm)+ nm.cancel(notificationId)+ }+ ACTION_RESUME -> {+ // Resume the timer: update DB with new start time, reschedule notification+ val resumedTimer = timer.copy(isRunning = true, remainingStartTime = Clock.System.now())+ db.timerDao().upsert(resumedTimer)+ com.vayunmathur.clock.ui.sendTimerNotification(context, resumedTimer, true)+ }+ ACTION_CANCEL -> {+ // Delete timer, cancel alarm and notification+ db.timerDao().delete(timer)+ val alarmIntent = Intent(context, TimerReceiver::class.java).apply {+ putExtra("timer_id", timerId)+ putExtra("timer_name", timer.name)+ }+ val pendingAlarm = PendingIntent.getBroadcast(+ context, notificationId, alarmIntent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ am.cancel(pendingAlarm)+ nm.cancel(notificationId)+ }+ ACTION_RESET -> {+ // Reset timer to original total length, pause it+ val resetTimer = timer.copy(+ isRunning = false,+ remainingLength = timer.totalLength,+ remainingStartTime = Clock.System.now()+ )+ db.timerDao().upsert(resetTimer)+ + val alarmIntent = Intent(context, TimerReceiver::class.java).apply {+ putExtra("timer_id", timerId)+ putExtra("timer_name", timer.name)+ }+ val pendingAlarm = PendingIntent.getBroadcast(+ context, notificationId, alarmIntent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE+ )+ am.cancel(pendingAlarm)+ nm.cancel(notificationId)+ }+ }+ } catch (_: Exception) {+ } finally {+ pendingResult.finish()+ }+ }+ }++ companion object {+ const val ACTION_PAUSE = "com.vayunmathur.clock.TIMER_PAUSE"+ const val ACTION_RESUME = "com.vayunmathur.clock.TIMER_RESUME"+ const val ACTION_CANCEL = "com.vayunmathur.clock.TIMER_CANCEL"+ const val ACTION_RESET = "com.vayunmathur.clock.TIMER_RESET"+ }+}\ No newline at end of file
clock/src/main/res/drawable/ic_cancel_24.xml
diff --git a/clock/src/main/res/drawable/ic_cancel_24.xml b/clock/src/main/res/drawable/ic_cancel_24.xmlnew file mode 100644index 0000000000..27824df360--- /dev/null+++ b/clock/src/main/res/drawable/ic_cancel_24.xml@@ -0,0 +1,3 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">+ <path android:fillColor="#FFFFFF" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>+</vector>\ No newline at end of file
clock/src/main/res/drawable/ic_lap_24.xml
diff --git a/clock/src/main/res/drawable/ic_lap_24.xml b/clock/src/main/res/drawable/ic_lap_24.xmlnew file mode 100644index 0000000000..25bc9d8046--- /dev/null+++ b/clock/src/main/res/drawable/ic_lap_24.xml@@ -0,0 +1,4 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">+ <path android:fillColor="#FFFFFF" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>+ <path android:fillColor="#FFFFFF" android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>+</vector>\ No newline at end of file
clock/src/main/res/drawable/ic_pause_24.xml
diff --git a/clock/src/main/res/drawable/ic_pause_24.xml b/clock/src/main/res/drawable/ic_pause_24.xmlnew file mode 100644index 0000000000..492713a9c0--- /dev/null+++ b/clock/src/main/res/drawable/ic_pause_24.xml@@ -0,0 +1,3 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">+ <path android:fillColor="#FFFFFF" android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>+</vector>\ No newline at end of file
clock/src/main/res/drawable/ic_play_24.xml
diff --git a/clock/src/main/res/drawable/ic_play_24.xml b/clock/src/main/res/drawable/ic_play_24.xmlnew file mode 100644index 0000000000..1f997e77be--- /dev/null+++ b/clock/src/main/res/drawable/ic_play_24.xml@@ -0,0 +1,3 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">+ <path android:fillColor="#FFFFFF" android:pathData="M8,5.14v14l11,-7l-11,-7z"/>+</vector>\ No newline at end of file
clock/src/main/res/drawable/ic_reset_24.xml
diff --git a/clock/src/main/res/drawable/ic_reset_24.xml b/clock/src/main/res/drawable/ic_reset_24.xmlnew file mode 100644index 0000000000..fbca33f570--- /dev/null+++ b/clock/src/main/res/drawable/ic_reset_24.xml@@ -0,0 +1,3 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">+ <path android:fillColor="#FFFFFF" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>+</vector>\ No newline at end of file
clock/src/main/res/drawable/ic_stop_24.xml
diff --git a/clock/src/main/res/drawable/ic_stop_24.xml b/clock/src/main/res/drawable/ic_stop_24.xmlnew file mode 100644index 0000000000..6e604a13bb--- /dev/null+++ b/clock/src/main/res/drawable/ic_stop_24.xml@@ -0,0 +1,3 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">+ <path android:fillColor="#FFFFFF" android:pathData="M6,6h12v12H6z"/>+</vector>\ No newline at end of file
clock/src/main/res/values/strings.xml
diff --git a/clock/src/main/res/values/strings.xml b/clock/src/main/res/values/strings.xmlindex f6cffd6b61..d6653a63f7 100644--- a/clock/src/main/res/values/strings.xml+++ b/clock/src/main/res/values/strings.xml@@ -26,6 +26,8 @@ <string name="channel_completed_timers_description">Alerts when timers finish</string> <string name="channel_alarms_name">Alarms</string> <string name="channel_alarms_description">Notifications for scheduled alarms</string>+ <string name="channel_stopwatch_name">Stopwatch</string>+ <string name="channel_stopwatch_description">Stopwatch controls</string> <!-- StopwatchPage column headers --> <string name="header_laps">Laps</string>@@ -44,6 +46,16 @@ <string name="timer_finished_title">Timer Finished</string> <string name="timer_finished_text">%1$s has ended!</string> + <!-- Timer notification actions -->+ <string name="action_pause">Pause</string>+ <string name="action_resume">Resume</string>+ <string name="action_cancel">Cancel</string>+ <string name="action_reset">Reset</string>++ <!-- Stopwatch notification actions -->+ <string name="action_lap">Lap</string>+ <string name="action_stop">Stop</string>+ <!-- NewTimerDialog --> <string name="label_new_timer">New Timer</string> <string name="field_label">Label</string>