Disable tiling, for now

This commit is contained in:
inorichi 2015-10-22 17:24:17 +02:00
parent 3a748a9453
commit fefc6ba0e9
5 changed files with 25 additions and 32 deletions

View file

@ -1,4 +1,6 @@
apply plugin: 'com.android.application' 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: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda' apply plugin: 'me.tatarka.retrolambda'
@ -77,6 +79,7 @@ dependencies {
compile 'com.jakewharton.timber:timber:3.1.0' compile 'com.jakewharton.timber:timber:3.1.0'
compile 'uk.co.ribot:easyadapter:1.5.0@aar' compile 'uk.co.ribot:easyadapter:1.5.0@aar'
compile 'ch.acra:acra:4.6.2' 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 'com.davemorrissey.labs:subsampling-scale-image-view:3.4.1'
compile "frankiesardo:icepick:$ICEPICK_VERSION" compile "frankiesardo:icepick:$ICEPICK_VERSION"
provided "frankiesardo:icepick-processor:$ICEPICK_VERSION" provided "frankiesardo:icepick-processor:$ICEPICK_VERSION"

View file

@ -42,6 +42,7 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
createAdapter(); createAdapter();
setupViewPager(); setupViewPager();
enableHardwareAcceleration();
} }
@Override @Override
@ -122,4 +123,10 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
} }
public void enableHardwareAcceleration() {
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
}
} }

View file

@ -13,6 +13,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.models.Page; import eu.kanade.mangafeed.data.models.Page;
import eu.kanade.mangafeed.ui.activity.ReaderActivity; import eu.kanade.mangafeed.ui.activity.ReaderActivity;
import eu.kanade.mangafeed.util.MangaImageRegionDecoder;
import eu.kanade.mangafeed.util.PageFileTarget; import eu.kanade.mangafeed.util.PageFileTarget;
public class ReaderPageFragment extends Fragment { public class ReaderPageFragment extends Fragment {
@ -52,11 +53,14 @@ public class ReaderPageFragment extends Fragment {
} }
private void loadImage() { private void loadImage() {
if (mUrl != null) {
Glide.with(getActivity()) Glide.with(getActivity())
.load(mUrl) .load(mUrl)
.downloadOnly(new PageFileTarget(imageView)); .downloadOnly(new PageFileTarget(imageView));
} }
}
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
imageView = (SubsamplingScaleImageView)inflater.inflate(R.layout.fragment_page, container, false); imageView = (SubsamplingScaleImageView)inflater.inflate(R.layout.fragment_page, container, false);
@ -65,36 +69,10 @@ public class ReaderPageFragment extends Fragment {
imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE); imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE);
imageView.setOnTouchListener((view, motionEvent) -> imageView.setOnTouchListener((view, motionEvent) ->
((ReaderActivity) getActivity()).getViewPager().onImageTouch(motionEvent)); ((ReaderActivity) getActivity()).getViewPager().onImageTouch(motionEvent));
imageView.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
@Override
public void onReady() {
imageView.setVisibility(View.VISIBLE);
}
@Override loadImage();
public void onImageLoaded() {
}
@Override
public void onPreviewLoadError(Exception e) {
}
@Override
public void onImageLoadError(Exception e) {
}
@Override
public void onTileLoadError(Exception e) {
}
});
return imageView; return imageView;
} }
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
loadImage();
}
} }

View file

@ -13,7 +13,6 @@ import java.io.File;
import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.R;
public class PageFileTarget extends ViewTarget<SubsamplingScaleImageView, File> { public class PageFileTarget extends ViewTarget<SubsamplingScaleImageView, File> {
public static final String TAG = PageFileTarget.class.getSimpleName();
public PageFileTarget(SubsamplingScaleImageView view) { public PageFileTarget(SubsamplingScaleImageView view) {
super(view); super(view);
@ -31,6 +30,7 @@ public class PageFileTarget extends ViewTarget<SubsamplingScaleImageView, File>
@Override @Override
public void onResourceReady(File resource, GlideAnimation<? super File> glideAnimation) { public void onResourceReady(File resource, GlideAnimation<? super File> glideAnimation) {
view.setImage(ImageSource.uri(Uri.fromFile(resource))); view.setImage(ImageSource.uri(Uri.fromFile(resource))
.tilingDisabled());
} }
} }

View file

@ -3,9 +3,14 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven {
url 'https://repos.zeroturnaround.com/nexus/content/repositories/zt-public-releases'
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.3.0' 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 'com.neenbedankt.gradle.plugins:android-apt:1.7'
classpath 'me.tatarka:gradle-retrolambda:3.2.3' classpath 'me.tatarka:gradle-retrolambda:3.2.3'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong