Anchor log collapse at the current viewport
This commit is contained in:
@@ -123,8 +123,8 @@ class ViewLogsFragment : Fragment(R.layout.fragment_view_logs) {
|
|||||||
val metadata = metadataValues(row.entry, settings)
|
val metadata = metadataValues(row.entry, settings)
|
||||||
val contents = fieldValue(LogField.CONTENTS, row.entry, settings)
|
val contents = fieldValue(LogField.CONTENTS, row.entry, settings)
|
||||||
val hasContents = LogField.CONTENTS in settings.visibleFields && !contents.isNullOrEmpty()
|
val hasContents = LogField.CONTENTS in settings.visibleFields && !contents.isNullOrEmpty()
|
||||||
val collapseAnchor = if (expanded) captureCollapseAnchor(this@apply) else null
|
|
||||||
val toggleExpanded = {
|
val toggleExpanded = {
|
||||||
|
val collapseAnchor = if (expanded) captureCollapseAnchor(this@apply) else null
|
||||||
if (!expandedIds.add(row.entry.id)) expandedIds.remove(row.entry.id)
|
if (!expandedIds.add(row.entry.id)) expandedIds.remove(row.entry.id)
|
||||||
renderExpanded(row.entry.id in expandedIds)
|
renderExpanded(row.entry.id in expandedIds)
|
||||||
collapseAnchor?.let(::restoreCollapseAnchor)
|
collapseAnchor?.let(::restoreCollapseAnchor)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
"image" -> postImage()
|
"image" -> postImage()
|
||||||
"dismissible" -> postDismissible()
|
"dismissible" -> postDismissible()
|
||||||
"big_text" -> postBigText()
|
"big_text" -> postBigText()
|
||||||
|
"very_long_text" -> postVeryLongText()
|
||||||
"inbox" -> postInbox()
|
"inbox" -> postInbox()
|
||||||
"progress" -> postProgress(25)
|
"progress" -> postProgress(25)
|
||||||
"progress_update" -> postProgress(75)
|
"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 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 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())
|
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 MESSAGING_ID = 3
|
||||||
const val DISMISSIBLE_ID = 4
|
const val DISMISSIBLE_ID = 4
|
||||||
const val BIG_TEXT_ID = 5
|
const val BIG_TEXT_ID = 5
|
||||||
|
const val VERY_LONG_TEXT_ID = 13
|
||||||
const val INBOX_ID = 6
|
const val INBOX_ID = 6
|
||||||
const val PROGRESS_ID = 7
|
const val PROGRESS_ID = 7
|
||||||
const val CHRONOMETER_ID = 8
|
const val CHRONOMETER_ID = 8
|
||||||
@@ -116,6 +127,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val ACTIONS = listOf(
|
val ACTIONS = listOf(
|
||||||
"Post text" to "post_text", "Edit text" to "edit_text", "Post messaging" to "messaging",
|
"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 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 inbox" to "inbox", "Post progress" to "progress", "Update progress" to "progress_update",
|
||||||
"Post chronometer" to "chronometer", "Post timeout" to "timeout", "Post group" to "group",
|
"Post chronometer" to "chronometer", "Post timeout" to "timeout", "Post group" to "group",
|
||||||
"Cancel text" to "cancel_text", "Cancel all" to "cancel_all",
|
"Cancel text" to "cancel_text", "Cancel all" to "cancel_all",
|
||||||
|
|||||||
Reference in New Issue
Block a user