Anchor log collapse at the current viewport
This commit is contained in:
@@ -50,6 +50,7 @@ class MainActivity : AppCompatActivity() {
|
||||
"image" -> postImage()
|
||||
"dismissible" -> postDismissible()
|
||||
"big_text" -> postBigText()
|
||||
"very_long_text" -> postVeryLongText()
|
||||
"inbox" -> postInbox()
|
||||
"progress" -> postProgress(25)
|
||||
"progress_update" -> postProgress(75)
|
||||
@@ -83,6 +84,15 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
private fun postBigText() = manager.notify(BIG_TEXT_ID, base().setStyle(Notification.BigTextStyle().bigText("A long notification body used to exercise Notification.EXTRA_BIG_TEXT.".repeat(3))).build())
|
||||
|
||||
private fun postVeryLongText() = manager.notify(
|
||||
VERY_LONG_TEXT_ID,
|
||||
base().setStyle(
|
||||
Notification.BigTextStyle().bigText(
|
||||
"A deliberately very long notification body used to exercise scrolling and collapse anchoring. ".repeat(180),
|
||||
),
|
||||
).build(),
|
||||
)
|
||||
|
||||
private fun postInbox() = manager.notify(INBOX_ID, base().setStyle(Notification.InboxStyle().addLine("First inbox line").addLine("Second inbox line")).build())
|
||||
|
||||
private fun postProgress(progress: Int) = manager.notify(PROGRESS_ID, base().setContentTitle("Download").setContentText("$progress% complete").setOnlyAlertOnce(true).setProgress(100, progress, false).build())
|
||||
@@ -105,6 +115,7 @@ class MainActivity : AppCompatActivity() {
|
||||
const val MESSAGING_ID = 3
|
||||
const val DISMISSIBLE_ID = 4
|
||||
const val BIG_TEXT_ID = 5
|
||||
const val VERY_LONG_TEXT_ID = 13
|
||||
const val INBOX_ID = 6
|
||||
const val PROGRESS_ID = 7
|
||||
const val CHRONOMETER_ID = 8
|
||||
@@ -116,6 +127,7 @@ class MainActivity : AppCompatActivity() {
|
||||
val ACTIONS = listOf(
|
||||
"Post text" to "post_text", "Edit text" to "edit_text", "Post messaging" to "messaging",
|
||||
"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",
|
||||
"Post chronometer" to "chronometer", "Post timeout" to "timeout", "Post group" to "group",
|
||||
"Cancel text" to "cancel_text", "Cancel all" to "cancel_all",
|
||||
|
||||
Reference in New Issue
Block a user