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.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import java.io.File;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -145,8 +146,13 @@ public class PagerReaderFragment extends BaseFragment {
if (page == null || page.getImagePath() == null) if (page == null || page.getImagePath() == null)
return; return;
imageView.setImage(ImageSource.uri(page.getImagePath())); File imagePath = new File(page.getImagePath());
progressContainer.setVisibility(View.GONE); if (imagePath.exists()) {
imageView.setImage(ImageSource.uri(page.getImagePath()));
progressContainer.setVisibility(View.GONE);
} else {
page.setStatus(Page.ERROR);
}
} }
private void showDownloading() { private void showDownloading() {
@ -198,7 +204,6 @@ public class PagerReaderFragment extends BaseFragment {
case Page.READY: case Page.READY:
showImage(); showImage();
unsubscribeProgress(); unsubscribeProgress();
unsubscribeStatus();
break; break;
case Page.ERROR: case Page.ERROR:
showError(); showError();

View File

@ -10,6 +10,8 @@ import android.widget.ProgressBar;
import com.davemorrissey.labs.subscaleview.ImageSource; import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import java.io.File;
import butterknife.Bind; import butterknife.Bind;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import eu.kanade.tachiyomi.R; import eu.kanade.tachiyomi.R;
@ -62,7 +64,6 @@ public class WebtoonHolder extends RecyclerView.ViewHolder {
if (event.getAction() == MotionEvent.ACTION_UP) { if (event.getAction() == MotionEvent.ACTION_UP) {
if (page != null) if (page != null)
adapter.retryPage(page); adapter.retryPage(page);
return true;
} }
return true; return true;
}); });
@ -99,7 +100,14 @@ public class WebtoonHolder extends RecyclerView.ViewHolder {
setErrorButtonVisible(false); setErrorButtonVisible(false);
setProgressVisible(false); setProgressVisible(false);
setImageVisible(true); 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() { private void onError() {