Clarify previous contents in edited logs
This commit is contained in:
@@ -12,6 +12,7 @@ import android.content.ComponentName
|
||||
import android.app.NotificationManager
|
||||
import android.text.TextPaint
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
@@ -280,10 +281,10 @@ class ViewLogsFragment : Fragment(R.layout.fragment_view_logs) {
|
||||
}
|
||||
addView(message)
|
||||
if (expanded && row.entry.action == NotificationAction.EDITED && !row.entry.previousContents.isNullOrEmpty()) {
|
||||
addView(previousDivider())
|
||||
addView(TextView(context).apply {
|
||||
text = "Previous: ${row.entry.previousContents}"
|
||||
text = row.entry.previousContents
|
||||
setLineSpacing(0f, 1f)
|
||||
setPadding(0, dp(4), 0, 0)
|
||||
})
|
||||
}
|
||||
if (expanded && row.entry.imageId != null) {
|
||||
@@ -316,6 +317,24 @@ class ViewLogsFragment : Fragment(R.layout.fragment_view_logs) {
|
||||
setOnLongClickListener { showDeleteDialog(row.entry.id) }
|
||||
}
|
||||
|
||||
private fun previousDivider(): LinearLayout = LinearLayout(requireContext()).apply {
|
||||
gravity = Gravity.CENTER_VERTICAL
|
||||
setPadding(0, dp(8), 0, dp(4))
|
||||
fun line() = View(context).apply {
|
||||
setBackgroundColor(ContextCompat.getColor(context, R.color.log_row_separator))
|
||||
layoutParams = LinearLayout.LayoutParams(0, dp(1), 1f)
|
||||
}
|
||||
addView(line())
|
||||
addView(TextView(context).apply {
|
||||
text = "Previous"
|
||||
textSize = 12f
|
||||
setTextColor(ContextCompat.getColor(context, R.color.on_surface))
|
||||
setBackgroundColor(ContextCompat.getColor(context, R.color.window_background))
|
||||
setPadding(dp(8), 0, dp(8), 0)
|
||||
})
|
||||
addView(line())
|
||||
}
|
||||
|
||||
private fun metadataValues(entry: NotificationLogEntry, settings: LogViewSettings): List<MetadataValue> = buildList {
|
||||
if (LogField.TIMESTAMP in settings.visibleFields) add(MetadataValue(timestamp(entry.recordedAtEpochMillis, settings, entry.eventTimeZoneId), 12f, isTimestamp = true))
|
||||
if (LogField.APP_NAME in settings.visibleFields) add(MetadataValue(entry.appName, 15f, indented = true, bold = true))
|
||||
|
||||
Reference in New Issue
Block a user