Skip to content

Commit

Permalink
disable forced resize, seems to work fine on my devices
Browse files Browse the repository at this point in the history
waiting for bug reports to roll in though
  • Loading branch information
edeso committed Nov 9, 2023
1 parent dfa3606 commit e4b3c40
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions app/src/main/java/com/nkanaev/comics/fragment/ReaderFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.nkanaev.comics.view.PageImageView;
import com.squareup.picasso.MemoryPolicy;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import com.squareup.picasso.Target;

import java.io.File;
Expand Down Expand Up @@ -670,16 +671,19 @@ private void loadImage(MyTarget t) {
pos = mViewPager.getAdapter().getCount() - t.position - 1;
}

// mDblTapScale in PageImageView is 1.5 currently, so set this as our limit
int max = Utils.getMaxPageSize();

mPicasso.load(mComicHandler.getPageUri(pos))
RequestCreator rc = mPicasso.load(mComicHandler.getPageUri(pos))
.memoryPolicy(MemoryPolicy.NO_STORE)
.tag(getActivity())
.resize(max, max)
.centerInside()
.onlyScaleDown()
.into(t);
.tag(getActivity());
// disabled as tests on real devices flawlessly load bitmap > texturesize
// might be needed in future though depending on bug reports
if (false) {
// mDblTapScale in PageImageView is 1.5 currently, so set this as our limit
int max = Utils.getMaxPageSize();

int glmax = Utils.glMaxTextureSize();
rc = rc.resize(glmax, glmax).centerInside().onlyScaleDown();
}
rc.into(t);
}

// toggle visibility states
Expand Down Expand Up @@ -748,7 +752,7 @@ public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
// TODO: show error stack in textview
Log.e("", "", e);
Log.e("MyTarget:onBitmapFailed()", "", e);
setVisibility(Show.ERROR);
}

Expand Down

0 comments on commit e4b3c40

Please sign in to comment.