Skip to content

Commit

Permalink
预览页优化
Browse files Browse the repository at this point in the history
  • Loading branch information
teach committed Sep 27, 2019
1 parent a89e256 commit 039d018
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ public Object instantiateItem(ViewGroup container, final int position) {
container.addView(currentView);
if (image.isGif()) {
currentView.setScaleType(ImageView.ScaleType.FIT_CENTER);
Glide.with(mContext).load(isAndroidQ ? image.getUri() : image.getPath())
Glide.with(mContext).load(isAndroidQ ? image.getUri() : image.getPath()).override(720,1080)
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
.into(currentView);
} else {
Glide.with(mContext).asBitmap()
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
.load(isAndroidQ ? image.getUri() : image.getPath()).into(new SimpleTarget<Bitmap>() {
.load(isAndroidQ ? image.getUri() : image.getPath()).into(new SimpleTarget<Bitmap>(720,1080) {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
int bw = resource.getWidth();
int bh = resource.getHeight();
if (bw > 8192 || bh > 8192) {
Bitmap bitmap = ImageUtil.zoomBitmap(resource, 8192, 8192);
if (bw > 4096 || bh > 4096) {
Bitmap bitmap = ImageUtil.zoomBitmap(resource, 4096, 4096);
setBitmap(currentView, bitmap);
} else {
setBitmap(currentView, resource);
Expand Down

0 comments on commit 039d018

Please sign in to comment.