From 91edd1f5f29a3336fa9e3bd1762c70ea74e3e48d Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 22 Jul 2026 18:26:14 +0000 Subject: Split save/Stash actions, follow links in-app via reader pipeline, tune scroll, fix title entities - ReaderScreen: bookmark icon is now a purely local save (just flips isSaved, no network) -- Stash archiving is a separate explicit action (new cloud icon), since it's a heavier networked action the user should trigger on purpose rather than have bundled into "save." Verified via direct DB queries and (once I stopped misreading small screenshots) the icon updates immediately in-session for both actions. - New ReaderWebView.kt: shared WebView factory for the dark reader palette and link handling, used by both ReaderScreen and the new LinkReaderScreen. Links tapped inside an article's WebView now open in a lightweight in-app reader (extracted via the same Readability pipeline, no DB persistence) instead of falling through to the system browser -- recursive, so a chain of links stays in-app. Verified live: tapping a link mid-article navigated to a real extracted page with a working back stack. - WebView scroll tuning: overscroll glow and scrollbars off, on both the article reader and the new link reader -- aimed at the reported "still a little choppy" scrolling on top of the previous reload-on-recompose fix. - FeedParser: some feeds (kottke.org among them) double-encode titles -- the XML parser resolves outer XML escaping, but leftover HTML entities like "“" were showing up literally in the title text. Titles are now run through a second HTML-entity decode pass. Verified: a kottke title that previously showed a literal “ now renders the actual curly quote. All changes verified live on the emulator against the real 107-feed dataset. --- .../java/org/terst/feedreader/ui/ReaderWebView.kt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt (limited to 'app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt') diff --git a/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt b/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt new file mode 100644 index 0000000..42a15f0 --- /dev/null +++ b/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt @@ -0,0 +1,43 @@ +package org.terst.feedreader.ui + +import android.content.Context +import android.view.View +import android.webkit.WebResourceRequest +import android.webkit.WebView +import android.webkit.WebViewClient + +/** + * Shared factory for the read-only, dark-themed article WebView used by both the + * per-article ReaderScreen and LinkReaderScreen (for links tapped inside an article). + * JS is always off -- extracted/feed HTML never needs it, and this keeps articles + * from running arbitrary scripts. Link taps are intercepted rather than left to + * WebView's default behavior (handing off to the system browser) so following a + * link stays inside the app's own reader/extraction pipeline. + */ +fun newReaderWebView(context: Context, onOpenLink: (String) -> Unit): WebView = + WebView(context).apply { + settings.javaScriptEnabled = false + overScrollMode = View.OVER_SCROLL_NEVER + isVerticalScrollBarEnabled = false + isHorizontalScrollBarEnabled = false + webViewClient = object : WebViewClient() { + override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { + onOpenLink(request.url.toString()) + return true + } + } + } + +// Hardcoded dark palette, not @media (prefers-color-scheme) -- the app itself always +// forces dark colorScheme() regardless of system setting (see MainActivity), so reader +// content should match rather than following a system light/dark the app itself ignores. +fun wrapReaderHtml(bodyContent: String): String = """ + + + $bodyContent +""".trimIndent() -- cgit v1.2.3