summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/terst/feedreader/ui
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/ui')
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
index 692c198..cef17c5 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
@@ -231,7 +231,12 @@ private fun ReaderContent(articleId: String, onBack: () -> Unit) {
loadDataWithBaseURL(baseUrl, wrapHtml(content), "text/html", "UTF-8", null)
}
},
- update = { webView -> webView.loadDataWithBaseURL(baseUrl, wrapHtml(content), "text/html", "UTF-8", null) }
+ update = { webView -> webView.loadDataWithBaseURL(baseUrl, wrapHtml(content), "text/html", "UTF-8", null) },
+ // AndroidView does not destroy() the underlying WebView on its own --
+ // without this, swiping through many articles (each page holding its own
+ // WebView) leaks a WebView's native resources per page and eventually
+ // exhausts memory over a long reading session.
+ onRelease = { webView -> webView.destroy() }
)
} else if (isExtracting) {
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))