Skip to content

Commit 7d753a3

Browse files
committed
match live update codelab changes and update to use chronometer for countdown
Change-Id: Id4766a84292834a9a4ebe5364e804e356397ffa5
1 parent 54e8d1c commit 7d753a3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

samples/user-interface/live-updates/src/main/java/com/example/platform/ui/live_updates/SnackbarNotificationManager.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ object SnackbarNotificationManager {
5555
.setSmallIcon(R.drawable.ic_launcher_foreground)
5656
.setContentTitle("You order is being placed")
5757
.setContentText("Confirming with bakery...")
58+
.setShortCriticalText("Placing")
5859
.setStyle(buildBaseProgressStyle(INITIALIZING).setProgressIndeterminate(true))
5960
}
6061
},
@@ -64,6 +65,7 @@ object SnackbarNotificationManager {
6465
return buildBaseNotification(appContext, FOOD_PREPARATION)
6566
.setContentTitle("Your order is being prepared")
6667
.setContentText("Next step will be delivery")
68+
.setShortCriticalText("Prepping")
6769
.setLargeIcon(
6870
IconCompat.createWithResource(
6971
appContext, R.drawable.cupcake
@@ -92,6 +94,9 @@ object SnackbarNotificationManager {
9294
appContext, R.drawable.cupcake
9395
).toIcon(appContext)
9496
)
97+
.setWhen(System.currentTimeMillis().plus(11 * 60 * 1000 /* 10 min */))
98+
.setUsesChronometer(true)
99+
.setChronometerCountDown(true)
95100
}
96101
},
97102
FOOD_ARRIVING(18000) {
@@ -114,6 +119,9 @@ object SnackbarNotificationManager {
114119
appContext, R.drawable.cupcake
115120
).toIcon(appContext)
116121
)
122+
.setWhen(System.currentTimeMillis().plus(11 * 60 * 500 /* 5 min */))
123+
.setUsesChronometer(true)
124+
.setChronometerCountDown(true)
117125
}
118126
},
119127
ORDER_COMPLETE(21000) {
@@ -131,6 +139,7 @@ object SnackbarNotificationManager {
131139
)
132140
.setProgress(100)
133141
)
142+
.setShortCriticalText("Arrived")
134143
.setLargeIcon(
135144
IconCompat.createWithResource(
136145
appContext, R.drawable.cupcake
@@ -224,7 +233,7 @@ object SnackbarNotificationManager {
224233
null, "Rate delivery", null).build()
225234
)
226235
}
227-
return notificationBuilder
236+
return notificationBuilder
228237
}
229238

230239
abstract fun buildNotification(): NotificationCompat.Builder

0 commit comments

Comments
 (0)