aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-07-03 14:39:16 -0700
committerGitHub <noreply@github.com>2019-07-03 14:39:16 -0700
commit99badbbfad64f69d6699385e1f9a958e5abb8310 (patch)
treeab153dcf828a12780bac6f091376ce7811f043ef /app/src/main
parent00bb4c7a54bb2aaf8a765acd4478e2cc22ff44ba (diff)
parentcadf684a733767d8a892b0d42dec33e423a83d42 (diff)
downloadfrost-99badbbfad64f69d6699385e1f9a958e5abb8310.tar.gz
frost-99badbbfad64f69d6699385e1f9a958e5abb8310.tar.bz2
frost-99badbbfad64f69d6699385e1f9a958e5abb8310.zip
Merge pull request #1471 from AllanWang/image-not-found-uiv2.3.1
Image not found ui
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt6
-rw-r--r--app/src/main/res/values/strings_errors.xml1
2 files changed, 7 insertions, 0 deletions
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 5cab957a..f05cd6a9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
@@ -41,6 +41,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
@@ -150,6 +151,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")
with(binding) {
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