From 5273ea431bea76ad78ea0217426edfd7a853a062 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Sep 2017 18:57:04 +0200 Subject: [PATCH] show an error toast if something breaks during loading the image --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 8a1f24ffc..c722958f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -26,8 +26,10 @@ import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.simplemobiletools.commons.extensions.beGone import com.simplemobiletools.commons.extensions.beVisible +import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getFileSignature @@ -221,9 +223,10 @@ class PhotoFragment : ViewPagerFragment() { override fun onPreviewReleased() { } - override fun onImageLoadError(e: Exception?) { + override fun onImageLoadError(e: Exception) { background = ColorDrawable(Color.TRANSPARENT) beGone() + (activity as SimpleActivity).showErrorToast(e) } override fun onPreviewLoadError(e: Exception?) {