diff options
author | Allan Wang <me@allanwang.ca> | 2019-07-03 12:51:21 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-07-03 12:51:21 -0700 |
commit | a0c835779335d37d0524ec4bf93bfe2198cce9b6 (patch) | |
tree | b002c7d9a648776c43073354ee90255b9630f5e8 /app | |
parent | 6685ed8d7194a495820b2a06378f738cd6612ad3 (diff) | |
download | frost-a0c835779335d37d0524ec4bf93bfe2198cce9b6.tar.gz frost-a0c835779335d37d0524ec4bf93bfe2198cce9b6.tar.bz2 frost-a0c835779335d37d0524ec4bf93bfe2198cce9b6.zip |
Cancel image loading if activity is not found
Diffstat (limited to 'app')
3 files changed, 8 insertions, 0 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt index 61b4a194..8a8e48c9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt @@ -46,6 +46,7 @@ import com.pitchedapps.frost.utils.BiometricUtils import com.pitchedapps.frost.utils.EXTRA_COOKIES import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs +import com.pitchedapps.frost.utils.launchImageActivity import com.pitchedapps.frost.utils.launchNewTask import com.pitchedapps.frost.utils.loadAssets import com.raizlabs.android.dbflow.kotlinextensions.from diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt index c7d31032..7f52d500 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -39,6 +39,7 @@ import ca.allanwang.kau.utils.materialDialog import ca.allanwang.kau.utils.scaleXY import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.tint +import ca.allanwang.kau.utils.toast import ca.allanwang.kau.utils.withAlpha import ca.allanwang.kau.utils.withMinAlpha import com.davemorrissey.labs.subscaleview.ImageSource @@ -145,6 +146,11 @@ class ImageActivity : KauBaseActivity() { else Prefs.bgColor.withMinAlpha(235) private fun loadError(e: Throwable) { + if (e.message?.contains("<!DOCTYPE html>") == true) { + applicationContext.toast(R.string.image_not_found) + finish() + return + } errorRef = e e.logFrostEvent("Image load error") if (image_progress.isVisible) diff --git a/app/src/main/res/values/strings_errors.xml b/app/src/main/res/values/strings_errors.xml index 0cec420c..72a30563 100644 --- a/app/src/main/res/values/strings_errors.xml +++ b/app/src/main/res/values/strings_errors.xml @@ -11,4 +11,5 @@ <string name="error_notification">An error occurred when fetching notifications</string> <string name="error_sdk">Your device\'s SDK (%d) is incompatible. Frost only supports Lollipop (SDK 21) and above</string> <string name="error_webview">Your device does not seem to have a webview. Please add or enable one.</string> + <string name="image_not_found">Image not found.</string> </resources>
\ No newline at end of file |