From 1e81f75377ef0febf310ecb929eb3cc78bb41ec8 Mon Sep 17 00:00:00 2001 From: inorichi Date: Tue, 16 Feb 2016 18:19:54 +0100 Subject: [PATCH] Possible fix for #120 --- .../ui/reader/viewer/pager/PagerReaderFragment.java | 11 ++++++++--- .../ui/reader/viewer/webtoon/WebtoonHolder.java | 12 ++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java index 3477a42a19..1d8c32875b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.java @@ -17,6 +17,7 @@ import android.widget.TextView; import com.davemorrissey.labs.subscaleview.ImageSource; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; +import java.io.File; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -145,8 +146,13 @@ public class PagerReaderFragment extends BaseFragment { if (page == null || page.getImagePath() == null) return; - imageView.setImage(ImageSource.uri(page.getImagePath())); - progressContainer.setVisibility(View.GONE); + File imagePath = new File(page.getImagePath()); + if (imagePath.exists()) { + imageView.setImage(ImageSource.uri(page.getImagePath())); + progressContainer.setVisibility(View.GONE); + } else { + page.setStatus(Page.ERROR); + } } private void showDownloading() { @@ -198,7 +204,6 @@ public class PagerReaderFragment extends BaseFragment { case Page.READY: showImage(); unsubscribeProgress(); - unsubscribeStatus(); break; case Page.ERROR: showError(); diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.java index 51cc392363..f0d52b496a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonHolder.java @@ -10,6 +10,8 @@ import android.widget.ProgressBar; import com.davemorrissey.labs.subscaleview.ImageSource; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; +import java.io.File; + import butterknife.Bind; import butterknife.ButterKnife; import eu.kanade.tachiyomi.R; @@ -62,7 +64,6 @@ public class WebtoonHolder extends RecyclerView.ViewHolder { if (event.getAction() == MotionEvent.ACTION_UP) { if (page != null) adapter.retryPage(page); - return true; } return true; }); @@ -99,7 +100,14 @@ public class WebtoonHolder extends RecyclerView.ViewHolder { setErrorButtonVisible(false); setProgressVisible(false); setImageVisible(true); - imageView.setImage(ImageSource.uri(page.getImagePath())); + + File imagePath = new File(page.getImagePath()); + if (imagePath.exists()) { + imageView.setImage(ImageSource.uri(page.getImagePath())); + } else { + page.setStatus(Page.ERROR); + onError(); + } } private void onError() {