Clear the refresh spinner when an article fails to load (closes #197)#198
Open
jim-daf wants to merge 1 commit into
Open
Clear the refresh spinner when an article fails to load (closes #197)#198jim-daf wants to merge 1 commit into
jim-daf wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #197
What this does
Adds an
onReceivedError(view, errorCode, description, failingUrl)override toHNReaderWebViewClientinArticleReaderActivity.java. The override does the same teardown asonPageFinished. It callssetShowRefreshing(false), setsmWebViewIsLoading = false, and logs the error code, description and failing URL viaLog.w. Adds one privateTAGconstant on the inner class.Why
Today, when the WebView fails to load the article (network down, DNS failure, captive portal, ...), Android fires
onReceivedErrorand does not fireonPageFinished. The spinner is only cleared inonPageFinished, so the reader sits there with the spinner running until the user backs out. After this change the spinner clears as soon as the load fails and the failure shows up in logcat.No new UI, no new strings, no behaviour change in the happy path.
Note on the signature
The deprecated 4-arg form was kept on purpose. The new
(WebView, WebResourceRequest, WebResourceError)overload only dispatches on API 23 plus, and the framework still dispatches the deprecated form for every supported API level when nothing else is overridden. One override therefore covers all users instead of needing an SDK_INT guard. Happy to switch to the new signature gated onBuild.VERSION.SDK_INT >= Mif you would prefer that style.