Skip to content

Commit

Permalink
Merge pull request #3918 from kiwix/Fixes#3912
Browse files Browse the repository at this point in the history
Fixed: latency in showing whether a bookmark is added in the toggle button.
  • Loading branch information
kelson42 authored Jul 1, 2024
2 parents ad9e7e6 + 5f9ef86 commit 3c0397d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,6 @@ abstract class CoreReaderFragment :
}
updateTableOfContents()
tabsAdapter?.notifyDataSetChanged()
updateUrlProcessor()
updateBottomToolbarArrowsAlpha()
val zimFileReader = zimReaderContainer?.zimFileReader
if (hasValidFileAndUrl(getCurrentWebView()?.url, zimFileReader)) {
Expand Down Expand Up @@ -2150,13 +2149,18 @@ abstract class CoreReaderFragment :

override fun webViewFailedLoading(url: String) {
if (isAdded) {
// If a URL fails to load, update the bookmark toggle.
// This fixes the scenario where the previous page is bookmarked and the next
// page fails to load, ensuring the bookmark toggle is unset correctly.
updateUrlProcessor()
Log.d(TAG_KIWIX, String.format(getString(R.string.error_article_url_not_found), url))
}
}

@Suppress("MagicNumber")
override fun webViewProgressChanged(progress: Int, webView: WebView) {
if (isAdded) {
updateUrlProcessor()
progressBar?.apply {
visibility = View.VISIBLE
show()
Expand Down

0 comments on commit 3c0397d

Please sign in to comment.