SelectableRoundedImageView icon indicating copy to clipboard operation
SelectableRoundedImageView copied to clipboard

java.lang.ClassCastException: android.graphics.drawable.TransitionDrawable cannot be cast to com.gongpingjia.view.SelectableRoundedImageView$SelectableRoundedCornerDrawable at com.gongpingjia.view.SelectableRoundedImageView.updateDrawable(SelectableRoundedImageView.java:201) at com.gongpingjia.view.SelectableRoundedImageView.setImageDrawable(SelectableRoundedImageView.java:149)

Open huangchenggang opened this issue 9 years ago • 11 comments

java.lang.ClassCastException: android.graphics.drawable.TransitionDrawable cannot be cast to com.gongpingjia.view.SelectableRoundedImageView$SelectableRoundedCornerDrawable at com.gongpingjia.view.SelectableRoundedImageView.updateDrawable(SelectableRoundedImageView.java:201) at com.gongpingjia.view.SelectableRoundedImageView.setImageDrawable(SelectableRoundedImageView.java:149)

huangchenggang avatar Oct 13 '16 02:10 huangchenggang

Which image loading library do you use? Can you share some code that throws this exception?

pungrue26 avatar Oct 14 '16 03:10 pungrue26

@huangchenggang this thread will be closed unless you share me more details in next 2 weeks. :)

pungrue26 avatar Oct 30 '16 02:10 pungrue26

This is an issue when using Glide as the Async image loader, I think this has something to do with the animation.

zanderisrael avatar Nov 20 '16 10:11 zanderisrael

@zanderisrael if you have experienced the same issue, could you share some code that reproduce the issue?

pungrue26 avatar Nov 20 '16 10:11 pungrue26

sure:

JAVA

public static void setImage(Context context, int defaultResource, String url,ImageView imageView,Transformation<Bitmap>... bitmapTransformations) {
        if(url == null || url == "")
            url = "about:blank";

        GlideUrl glideUrl = PZM_SESSIONManager.sharedInstance().getGlideUrl(url);
        RequestManager manager = Glide.with(context);

        DrawableTypeRequest request = manager.load(glideUrl);
        request.asBitmap();
        /* this fixes the issue - request.dontAnimate(); */
        request.placeholder(defaultResource);

        if (bitmapTransformations != null)
            request.bitmapTransform(bitmapTransformations);

        request.diskCacheStrategy(DiskCacheStrategy.SOURCE)
        .into(imageView);
    }

XML

<pazam.zanderisrael.pazam.Libraries.SelectableRoundedImageView
                                xmlns:app="http://schemas.android.com/apk/res-auto"
                                android:id="@+id/pzm_favorites_friend_extend_avatar"
                                android:layout_width="40dp"
                                android:layout_height="40dp"
                                android:scaleType="centerCrop"
                                app:sriv_border_width="2dip"
                                app:sriv_border_color="#ffffff"
                                app:sriv_oval="true"
                                android:layout_gravity="bottom|center_horizontal"
                                android:adjustViewBounds="true" />

zanderisrael avatar Nov 20 '16 10:11 zanderisrael

Thanks for sharing! I will look into it. :)

      1. 오후 7:17에 "zanderisrael" [email protected]님이 작성:

sure:

JAVA

public static void setImage(Context context, int defaultResource, String url,ImageView imageView,Transformation<Bitmap>... bitmapTransformations) { if(url == null || url == "") url = "about:blank";

    GlideUrl glideUrl = PZM_SESSIONManager.sharedInstance().getGlideUrl(url);
    RequestManager manager = Glide.with(context);

    DrawableTypeRequest request = manager.load(glideUrl);
    request.asBitmap();
    /* this fixes the issue - request.dontAnimate(); */
    request.placeholder(defaultResource);

    if (bitmapTransformations != null)
        request.bitmapTransform(bitmapTransformations);

    request.diskCacheStrategy(DiskCacheStrategy.SOURCE)
    .into(imageView);
}

XML

<pazam.zanderisrael.pazam.Libraries.SelectableRoundedImageView xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/pzm_favorites_friend_extend_avatar" android:layout_width="40dp" android:layout_height="40dp" android:scaleType="centerCrop" app:sriv_border_width="2dip" app:sriv_border_color="#ffffff" app:sriv_oval="true" android:layout_gravity="bottom|center_horizontal" android:adjustViewBounds="true" />

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pungrue26/SelectableRoundedImageView/issues/14#issuecomment-261769698, or mute the thread https://github.com/notifications/unsubscribe-auth/AENeBTA2jE2hZMls_fV3MN75K5XibZhsks5rAB48gaJpZM4KVbaS .

pungrue26 avatar Nov 20 '16 11:11 pungrue26

I met the same problem!using Glide as the image loader

huangjinhong avatar Feb 16 '17 02:02 huangjinhong

I met the same problem!using Glide as the image loader

oooo7777777 avatar Mar 07 '17 06:03 oooo7777777

anyone here? why the author has no responds but closed instead?

hpuhsp avatar Mar 13 '17 02:03 hpuhsp

@hpuhsp I am HERE! I just have no time for digging into this. Contributes are welcome!

pungrue26 avatar Mar 13 '17 03:03 pungrue26

This has nothing to do with this library. Its a known issue of using either Picasso or Glide as your image loading library. Please, check Glide's README file where it clearly specifies that you either have to use dontAnimate() option or implement your own animation. @pungrue26, you wanna close this.

mradzinski avatar Apr 19 '17 04:04 mradzinski