From 75a7b5c743f15791ae32bafd93ec697bd6b55507 Mon Sep 17 00:00:00 2001 From: teach Date: Fri, 27 Sep 2019 11:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=A1=B5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../imageselector/adapter/ImagePagerAdapter.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java b/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java index e182c1c..477a84c 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java @@ -6,6 +6,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.viewpager.widget.PagerAdapter; + +import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; @@ -76,18 +78,18 @@ public Object instantiateItem(ViewGroup container, final int position) { if (image.isGif()) { currentView.setScaleType(ImageView.ScaleType.FIT_CENTER); Glide.with(mContext).load(isAndroidQ ? image.getUri() : image.getPath()) - .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)).override(720,1080) .into(currentView); } else { Glide.with(mContext).asBitmap() .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) - .load(isAndroidQ ? image.getUri() : image.getPath()).into(new SimpleTarget() { + .load(isAndroidQ ? image.getUri() : image.getPath()).into(new SimpleTarget(720,1080) { @Override public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition 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);