Capture later structured messaging updates
This commit is contained in:
@@ -46,7 +46,8 @@ class MainActivity : AppCompatActivity() {
|
||||
when (action) {
|
||||
"post_text" -> postText("Text message")
|
||||
"edit_text" -> postText("Edited message")
|
||||
"messaging" -> postMessaging()
|
||||
"messaging" -> postMessaging(updated = false)
|
||||
"messaging_update" -> postMessaging(updated = true)
|
||||
"image" -> postImage()
|
||||
"dismissible" -> postDismissible()
|
||||
"big_text" -> postBigText()
|
||||
@@ -66,12 +67,14 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
private fun postText(text: String) = manager.notify(TEXT_ID, base().setContentTitle("Helper").setContentText(text).build())
|
||||
|
||||
private fun postMessaging() {
|
||||
private fun postMessaging(updated: Boolean) {
|
||||
val me = Person.Builder().setName("Me").build()
|
||||
val alice = Person.Builder().setName("Alice").build()
|
||||
val style = Notification.MessagingStyle(me)
|
||||
.addMessage("Hello from Alice", 1, alice)
|
||||
.addMessage("A reply from me", 2, null as Person?)
|
||||
val style = Notification.MessagingStyle(me).addMessage("Hello from Alice", 1, alice)
|
||||
if (updated) {
|
||||
style.addMessage("Another message from Alice", 2, alice)
|
||||
.addMessage("A reply from me", 3, null as Person?)
|
||||
}
|
||||
manager.notify(MESSAGING_ID, base().setSmallIcon(android.R.drawable.ic_dialog_email).setStyle(style).build())
|
||||
}
|
||||
|
||||
@@ -126,6 +129,7 @@ class MainActivity : AppCompatActivity() {
|
||||
const val GROUP_KEY = "helper-group"
|
||||
val ACTIONS = listOf(
|
||||
"Post text" to "post_text", "Edit text" to "edit_text", "Post messaging" to "messaging",
|
||||
"Update messaging" to "messaging_update",
|
||||
"Post image" to "image", "Post dismissible" to "dismissible", "Post big text" to "big_text",
|
||||
"Post very long text" to "very_long_text",
|
||||
"Post inbox" to "inbox", "Post progress" to "progress", "Update progress" to "progress_update",
|
||||
|
||||
Reference in New Issue
Block a user