From fefc6ba0e9454ddd626f8731b2fa377bf0ba3bc2 Mon Sep 17 00:00:00 2001 From: inorichi Date: Thu, 22 Oct 2015 17:24:17 +0200 Subject: [PATCH] Disable tiling, for now --- app/build.gradle | 3 ++ .../mangafeed/ui/activity/ReaderActivity.java | 7 ++++ .../ui/fragment/ReaderPageFragment.java | 38 ++++--------------- .../kanade/mangafeed/util/PageFileTarget.java | 4 +- build.gradle | 5 +++ 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4d5e8854f..7c8d8e959 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,6 @@ apply plugin: 'com.android.application' +// This does not break the build when Android Studio is missing the JRebel for Android plugin. +apply plugin: 'com.zeroturnaround.jrebel.android' apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'me.tatarka.retrolambda' @@ -77,6 +79,7 @@ dependencies { compile 'com.jakewharton.timber:timber:3.1.0' compile 'uk.co.ribot:easyadapter:1.5.0@aar' compile 'ch.acra:acra:4.6.2' + compile 'com.github.castorflex.verticalviewpager:library:19.0.1' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.4.1' compile "frankiesardo:icepick:$ICEPICK_VERSION" provided "frankiesardo:icepick-processor:$ICEPICK_VERSION" diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java index 8950bdd3f..6df3e43b7 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/ReaderActivity.java @@ -42,6 +42,7 @@ public class ReaderActivity extends BaseRxActivity { createAdapter(); setupViewPager(); + enableHardwareAcceleration(); } @Override @@ -122,4 +123,10 @@ public class ReaderActivity extends BaseRxActivity { } + public void enableHardwareAcceleration() { + getWindow().setFlags( + WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, + WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); + } + } diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java index 58de69606..61fc4363e 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/ReaderPageFragment.java @@ -13,6 +13,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.data.models.Page; import eu.kanade.mangafeed.ui.activity.ReaderActivity; +import eu.kanade.mangafeed.util.MangaImageRegionDecoder; import eu.kanade.mangafeed.util.PageFileTarget; public class ReaderPageFragment extends Fragment { @@ -52,9 +53,12 @@ public class ReaderPageFragment extends Fragment { } private void loadImage() { - Glide.with(getActivity()) - .load(mUrl) - .downloadOnly(new PageFileTarget(imageView)); + if (mUrl != null) { + Glide.with(getActivity()) + .load(mUrl) + .downloadOnly(new PageFileTarget(imageView)); + } + } @Override @@ -65,36 +69,10 @@ public class ReaderPageFragment extends Fragment { imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE); imageView.setOnTouchListener((view, motionEvent) -> ((ReaderActivity) getActivity()).getViewPager().onImageTouch(motionEvent)); - imageView.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() { - @Override - public void onReady() { - imageView.setVisibility(View.VISIBLE); - } - @Override - public void onImageLoaded() { - } - - @Override - public void onPreviewLoadError(Exception e) { - } - - @Override - public void onImageLoadError(Exception e) { - } - - @Override - public void onTileLoadError(Exception e) { - } - }); + loadImage(); return imageView; } - @Override - public void onActivityCreated(@Nullable Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - loadImage(); - } - } diff --git a/app/src/main/java/eu/kanade/mangafeed/util/PageFileTarget.java b/app/src/main/java/eu/kanade/mangafeed/util/PageFileTarget.java index a94a9d45f..7470daedd 100644 --- a/app/src/main/java/eu/kanade/mangafeed/util/PageFileTarget.java +++ b/app/src/main/java/eu/kanade/mangafeed/util/PageFileTarget.java @@ -13,7 +13,6 @@ import java.io.File; import eu.kanade.mangafeed.R; public class PageFileTarget extends ViewTarget { - public static final String TAG = PageFileTarget.class.getSimpleName(); public PageFileTarget(SubsamplingScaleImageView view) { super(view); @@ -31,6 +30,7 @@ public class PageFileTarget extends ViewTarget @Override public void onResourceReady(File resource, GlideAnimation glideAnimation) { - view.setImage(ImageSource.uri(Uri.fromFile(resource))); + view.setImage(ImageSource.uri(Uri.fromFile(resource)) + .tilingDisabled()); } } diff --git a/build.gradle b/build.gradle index 2384b2907..d591678ac 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,14 @@ buildscript { repositories { jcenter() + maven { + url 'https://repos.zeroturnaround.com/nexus/content/repositories/zt-public-releases' + } } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' + // This does not break the build when Android Studio is missing the JRebel for Android plugin. + classpath 'com.zeroturnaround.jrebel.android:jr-android-gradle:0.9.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7' classpath 'me.tatarka:gradle-retrolambda:3.2.3' // NOTE: Do not place your application dependencies here; they belong