diff --git a/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt b/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt index c1a42d503..2035b92b7 100644 --- a/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt @@ -198,19 +198,18 @@ class LogViewerActivity : AppCompatActivity() { recyclerView?.let { val shouldScroll = haveScrolled && !it.canScrollVertically(1) logLines.add(logLine) - if (haveScrolled) logAdapter.notifyDataSetChanged() + if (haveScrolled) logAdapter.notifyItemInserted(logLines.size - 1) if (shouldScroll) it.scrollToPosition(logLines.size - 1) } } else { logLines.lastOrNull()?.msg += "\n$line" - if (haveScrolled) logAdapter.notifyDataSetChanged() + if (haveScrolled) logAdapter.notifyItemChanged(logLines.size - 1) } if (!haveScrolled) { val end = System.nanoTime() val scroll = (end - start) > 1000000000L * 2.5 || !stdout.ready() if (logLines.isNotEmpty() && (scroll || (end - startPeriod) > 1000000000L / 4)) { - logAdapter.notifyDataSetChanged() recyclerView?.scrollToPosition(logLines.size - 1) startPeriod = end }