From a77afcaf707fded78c7ecd018533663bf372d1f4 Mon Sep 17 00:00:00 2001 From: Paul Woitaschek Date: Sun, 10 Feb 2019 15:34:11 +0100 Subject: [PATCH] Handle the back-press when selecting the cover from the internet and there was a network error. --- .../features/imagepicker/CoverFromInternetController.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/ph1b/audiobook/features/imagepicker/CoverFromInternetController.kt b/app/src/main/java/de/ph1b/audiobook/features/imagepicker/CoverFromInternetController.kt index c47d5fbb04..4f32c5ce5f 100644 --- a/app/src/main/java/de/ph1b/audiobook/features/imagepicker/CoverFromInternetController.kt +++ b/app/src/main/java/de/ph1b/audiobook/features/imagepicker/CoverFromInternetController.kt @@ -67,8 +67,8 @@ class CoverFromInternetController(bundle: Bundle) : BaseController(bundle) { displayZoomControls = false javaScriptEnabled = true userAgentString = - "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) " + - "AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" + "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) " + + "AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" } webView.webViewClient = object : WebViewClient() { @@ -269,6 +269,10 @@ class CoverFromInternetController(bundle: Bundle) : BaseController(bundle) { return true } + if (noNetwork.isVisible) { + return false + } + if (webView.canGoBack()) { webView.goBack() return true