Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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) #14

Open
huangchenggang opened this issue Oct 13, 2016 · 11 comments

Comments

@huangchenggang
Copy link

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)

@pungrue26
Copy link
Owner

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

@pungrue26
Copy link
Owner

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

@zanderisrael
Copy link

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

@pungrue26
Copy link
Owner

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

@zanderisrael
Copy link

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" />

@pungrue26
Copy link
Owner

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... 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
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AENeBTA2jE2hZMls_fV3MN75K5XibZhsks5rAB48gaJpZM4KVbaS
.

@huangjinhong
Copy link

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

1 similar comment
@oooo7777777
Copy link

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

@hpuhsp
Copy link

hpuhsp commented Mar 13, 2017

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

@pungrue26
Copy link
Owner

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

@mradzinski
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants