From 607e89938e95b9f651337ebc30764a807bf477dd Mon Sep 17 00:00:00 2001 From: ajp_anton Date: Sun, 26 Jul 2026 23:53:14 +0000 Subject: [PATCH] Show complete metadata in log pills --- .../notificationlog/ViewLogsFragment.kt | 18 +++++++++++++++--- app/src/main/res/values/dimens.xml | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/se/ajpanton/notificationlog/ViewLogsFragment.kt b/app/src/main/java/se/ajpanton/notificationlog/ViewLogsFragment.kt index d61112a..bed327c 100644 --- a/app/src/main/java/se/ajpanton/notificationlog/ViewLogsFragment.kt +++ b/app/src/main/java/se/ajpanton/notificationlog/ViewLogsFragment.kt @@ -79,7 +79,7 @@ class ViewLogsFragment : Fragment(R.layout.fragment_view_logs) { val metadataPill = metadataPill(metadata).apply { layoutParams = LinearLayout.LayoutParams( if (hasContents) 0 else LinearLayout.LayoutParams.MATCH_PARENT, - if (hasContents) LinearLayout.LayoutParams.MATCH_PARENT else LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT, if (hasContents) LEFT_PILL_WEIGHT else 0f, ).apply { if (hasContents) marginEnd = dp(6) @@ -87,7 +87,7 @@ class ViewLogsFragment : Fragment(R.layout.fragment_view_logs) { } if (metadata.isNotEmpty()) addView(metadataPill) if (hasContents) { - addView(contentsPill(row, contents!!, metadata.size.coerceAtLeast(1), expanded) { + val contentsPill = contentsPill(row, contents!!, metadata.size.coerceAtLeast(1), expanded) { if (!expandedIds.add(row.entry.id)) expandedIds.remove(row.entry.id) renderExpanded(row.entry.id in expandedIds) }.apply { @@ -96,7 +96,9 @@ class ViewLogsFragment : Fragment(R.layout.fragment_view_logs) { LinearLayout.LayoutParams.WRAP_CONTENT, if (metadata.isNotEmpty()) RIGHT_PILL_WEIGHT else 0f, ) - }) + } + addView(contentsPill) + if (metadata.isNotEmpty()) equalizePillHeights(metadataPill, contentsPill) } } @@ -216,6 +218,16 @@ class ViewLogsFragment : Fragment(R.layout.fragment_view_logs) { return true } + private fun equalizePillHeights(left: View, right: View) { + left.post { + val targetHeight = maxOf(left.height, right.height) + if (left.minimumHeight != targetHeight || right.minimumHeight != targetHeight) { + left.minimumHeight = targetHeight + right.minimumHeight = targetHeight + } + } + } + private fun dp(value: Int): Int = (value * resources.displayMetrics.density).toInt() private data class LogRow(val entry: NotificationLogEntry, val imageBytes: ByteArray?) diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index faefcc3..dcaf8c5 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,6 +1,6 @@ - 177dp + 159dp 360dp 48dp 86dp