lyft / scissors

✂ Android image cropping library
https://eng.lyft.com/scissors-an-image-cropping-library-for-android-a56369154a19
Apache License 2.0
1.84k stars 235 forks source link

I find sth Question by use this With Glide,and setViewportRatio(1f) aslo has some Question #54

Closed ycpbyht closed 2 years ago

ycpbyht commented 8 years ago

Thanks for you share the Demo。

if i use <com.lyft.android.scissors.CropView android:id="@+id/clipfilter_img" android:layout_width="match_parent" android:layout_height="match_parent" app:cropviewViewportOverlayColor="#a0000000" /> at layout XML ,the picture display like fit end on bottom cropline(picture bottom coincidence with app:cropviewViewportRatio line),not the bottom your CropView。 and i use cropview.setViewportRatio(1f) aslo has this questiong.

i find that if the picture not load done then use cropview.setViewportRatio(1) will has this question。 so i ues the Glide.with(this).load(imgPath).listener(new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target target, boolean isFirstResource) { return false; }

        @Override
        public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    imageView.setViewportRatio(1f);
                }
            }, 0);
            return false;
        }
    }).into(imageView);

it can solve thisquestion。 but i find another question ,the android:scaleType="" not work。the pic always fill the corpview like i use the fitXY,even a square picture aslo stretch to fill parent。

Now i use @Override protected void onResume() { super.onResume(); handler.postDelayed(new Runnable() { @Override public void run() { imageView.setViewportRatio(1f); } }, 300); } ,but if the pic is too big or my phone not have a stronger CPU,cropView load pic 0.3S not done aslo has the fist question 。but the time aslo can't set too long which cause i can saw the setViewportRatio anim 。

Thank you。

dschaller commented 2 years ago

Thank you for you contribution to this repository.

Closing this contribution as this repository is being archived.