From ea4fa60e017c938540c975eb418ae6db63a1c94d Mon Sep 17 00:00:00 2001 From: inorichi Date: Fri, 29 Jan 2016 14:54:53 +0100 Subject: [PATCH] Trying improvements for webtoon viewer. #71 --- .../reader/viewer/webtoon/WebtoonHolder.java | 19 +++++++------------ .../SubsamplingScaleImageView.java | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) 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 e49986f5b..181cca3c0 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 @@ -4,8 +4,6 @@ import android.support.v7.widget.RecyclerView; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.ProgressBar; @@ -16,6 +14,7 @@ import butterknife.Bind; import butterknife.ButterKnife; import eu.kanade.tachiyomi.R; import eu.kanade.tachiyomi.data.source.model.Page; +import eu.kanade.tachiyomi.ui.reader.ReaderActivity; public class WebtoonHolder extends RecyclerView.ViewHolder { @@ -24,7 +23,6 @@ public class WebtoonHolder extends RecyclerView.ViewHolder { @Bind(R.id.progress) ProgressBar progressBar; @Bind(R.id.retry_button) Button retryButton; - private Animation fadeInAnimation; private Page page; private WebtoonAdapter adapter; @@ -32,20 +30,17 @@ public class WebtoonHolder extends RecyclerView.ViewHolder { super(view); this.adapter = adapter; ButterKnife.bind(this, view); - - fadeInAnimation = AnimationUtils.loadAnimation(view.getContext(), R.anim.fade_in); + + int maxDim = ((ReaderActivity)adapter.getReader().getActivity()).getMaxBitmapSize(); imageView.setParallelLoadingEnabled(true); imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED); imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE); - imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE); + imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH); + imageView.setMaxScale(10); imageView.setOnTouchListener(touchListener); - imageView.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() { - @Override - public void onImageLoaded() { - imageView.startAnimation(fadeInAnimation); - } - }); + imageView.setMaxDimensions(maxDim, maxDim); + progressBar.setMinimumHeight(view.getResources().getDisplayMetrics().heightPixels); container.setOnTouchListener(touchListener); diff --git a/libs/SubsamplingScaleImageView/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java b/libs/SubsamplingScaleImageView/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java index 40830d40a..15664a7d0 100644 --- a/libs/SubsamplingScaleImageView/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java +++ b/libs/SubsamplingScaleImageView/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java @@ -870,7 +870,7 @@ public class SubsamplingScaleImageView extends View { } // When using tiles, on first render with no tile map ready, initialise it and kick off async base image loading. - if (tileMap == null && decoder != null) { + if (tileMap == null && decoder != null && cWidth == 0 && cHeight == 0) { initialiseBaseLayer(getMaxBitmapDimensions(canvas)); }