Possible fix for #120

This commit is contained in:
inorichi 2016-02-16 18:19:54 +01:00
parent 1cd77a97a7
commit 1e81f75377
2 changed files with 18 additions and 5 deletions

View File

@ -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();

View File

@ -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() {