beraybentesen / glide-xamarin-android

Glide Xamarin Binding
https://www.nuget.org/packages/Glide.Xamarin/
61 stars 14 forks source link

Cant use OnResource ready callback #2

Closed 25RBazookas closed 7 years ago

25RBazookas commented 7 years ago

Hello I can't make a SimpleTarget callback to know when my image is loaded. Is this also binded in this project?

I can make a class that inherits from SimpleTarget but I'm unable to find the onResourceReady().

Callbacks described here: Glide Callbacks

25RBazookas commented 7 years ago

Sorry didn't saw #1

25RBazookas commented 7 years ago

The image wont be shown with this code. If I leave .Listener(new MyImageListener() { Listener = _listener, MyImageView = this }) everything works fine. But if I place this code in my request builder I don't see my image. Can you help me?

If i do (imageView as ImageView_Base).SetImageBitmap((bitmapDrawable as GlideBitmapDrawable).Bitmap); in my onresourceready it won't work either.

builder.Listener(new MyImageListener() { Listener = _listener, MyImageView = this }).Into(this);

public class MyImageListener : Java.Lang.Object, IRequestListener
    {
        public MyImageCallback Listener { get; set; }
        public ImageView_Base MyImageView { get; set; }

        public bool OnException(Java.Lang.Exception p0, Java.Lang.Object p1, ITarget p2, bool p3)
        {
            Listener?.OnError();
            return false;
        }

        public bool OnResourceReady(Java.Lang.Object bitmapDrawable, Java.Lang.Object path, ITarget imageView, bool p3, bool p4)
        {
            MyImageView.SetImageBitmap((bitmapDrawable as GlideBitmapDrawable).Bitmap);
            Listener?.OnSuccess();
            return true;
        }
    }
25RBazookas commented 7 years ago

if i use this MyImageView.SetImageDrawable(bitmapDrawable as GlideBitmapDrawable); shows the image the images is shown