mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 19:11:50 +01:00
Trying improvements for webtoon viewer. #71
This commit is contained in:
parent
4b60560a9f
commit
ea4fa60e01
@ -4,8 +4,6 @@ import android.support.v7.widget.RecyclerView;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
|
||||||
import android.view.animation.AnimationUtils;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
@ -16,6 +14,7 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.tachiyomi.R;
|
import eu.kanade.tachiyomi.R;
|
||||||
import eu.kanade.tachiyomi.data.source.model.Page;
|
import eu.kanade.tachiyomi.data.source.model.Page;
|
||||||
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity;
|
||||||
|
|
||||||
public class WebtoonHolder extends RecyclerView.ViewHolder {
|
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.progress) ProgressBar progressBar;
|
||||||
@Bind(R.id.retry_button) Button retryButton;
|
@Bind(R.id.retry_button) Button retryButton;
|
||||||
|
|
||||||
private Animation fadeInAnimation;
|
|
||||||
private Page page;
|
private Page page;
|
||||||
private WebtoonAdapter adapter;
|
private WebtoonAdapter adapter;
|
||||||
|
|
||||||
@ -32,20 +30,17 @@ public class WebtoonHolder extends RecyclerView.ViewHolder {
|
|||||||
super(view);
|
super(view);
|
||||||
this.adapter = adapter;
|
this.adapter = adapter;
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
|
|
||||||
fadeInAnimation = AnimationUtils.loadAnimation(view.getContext(), R.anim.fade_in);
|
int maxDim = ((ReaderActivity)adapter.getReader().getActivity()).getMaxBitmapSize();
|
||||||
|
|
||||||
imageView.setParallelLoadingEnabled(true);
|
imageView.setParallelLoadingEnabled(true);
|
||||||
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED);
|
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED);
|
||||||
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE);
|
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.setOnTouchListener(touchListener);
|
||||||
imageView.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() {
|
imageView.setMaxDimensions(maxDim, maxDim);
|
||||||
@Override
|
|
||||||
public void onImageLoaded() {
|
|
||||||
imageView.startAnimation(fadeInAnimation);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
progressBar.setMinimumHeight(view.getResources().getDisplayMetrics().heightPixels);
|
progressBar.setMinimumHeight(view.getResources().getDisplayMetrics().heightPixels);
|
||||||
|
|
||||||
container.setOnTouchListener(touchListener);
|
container.setOnTouchListener(touchListener);
|
||||||
|
@ -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.
|
// 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));
|
initialiseBaseLayer(getMaxBitmapDimensions(canvas));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user