Skip to content

Commit

Permalink
[M]修复阶段动画抖动的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitomis committed May 28, 2020
1 parent 8e5aecc commit 02af3ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hitomi.tilibrary.transfer;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
Expand All @@ -10,6 +11,7 @@

import androidx.annotation.NonNull;

import com.gyf.immersionbar.ImmersionBar;
import com.hitomi.tilibrary.loader.ImageLoader;
import com.hitomi.tilibrary.view.image.TransferImage;

Expand Down Expand Up @@ -141,9 +143,11 @@ void startPreview(final TransferImage targetImage, final File source,
* @param clipSize 裁剪的尺寸数组
*/
void clipTargetImage(TransferImage targetImage, Drawable originDrawable, int[] clipSize) {
DisplayMetrics displayMetrics = transfer.getContext().getResources().getDisplayMetrics();
if (!(transfer.getContext() instanceof Activity)) return;
Activity activity = ((Activity) transfer.getContext());
DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
int width = displayMetrics.widthPixels;
int height = displayMetrics.heightPixels;
int height = displayMetrics.heightPixels + ImmersionBar.getNotchHeight(activity);

targetImage.setOriginalInfo(
originDrawable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import com.hitomi.tilibrary.transfer.Transferee;
import com.hitomi.transferimage.R;
import com.hitomi.transferimage.SourceConfig;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.squareup.picasso.Picasso;
import com.vansz.glideimageloader.GlideImageLoader;
import com.vansz.picassoimageloader.PicassoImageLoader;
Expand Down Expand Up @@ -60,14 +62,12 @@ private void noneViewDemo() {
}

private void singleViewDemo() {
Glide.with(this)
.load(SourceConfig.getMixingSourceGroup().get(0))
.placeholder(R.mipmap.ic_empty_photo)
.into(imageView);
ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(this));
ImageLoader.getInstance().displayImage(SourceConfig.getMixingSourceGroup().get(0), imageView);
imageView.setOnClickListener(v -> {
Transferee.getDefault(this).apply(TransferConfig.build()
.setSourceUrlList(SourceConfig.getMixingSourceGroup())
.setImageLoader(GlideImageLoader.with(getApplicationContext()))
.setImageLoader(UniversalImageLoader.with(getApplicationContext()))
.enableJustLoadHitPage(true)
.setCustomView(View.inflate(getBaseContext(), R.layout.layout_custom, null))
.bindImageView(imageView)
Expand Down

0 comments on commit 02af3ce

Please sign in to comment.