bindingxamarin.androidyandex-maps

Xamarin YandexMapKit Android Binding


I'm trying to use YandexMapKit for Android in my Xamarin Project.

I downloaded latest release of YandexMapKit (yandexmapkit-2.5.4.aar), created Xamarin.Android Binding Library and included it to my project. But I got many errors after building it. I found this project: https://github.com/pocheshire/Xamarin.YandexMaps.Android and used Transforms and Additions from it. After that only one build error left:
Error CS0542 'OverlayItem': member names cannot be the same as their enclosing type

In genereated sources this block contains error:

    public event EventHandler<global::RU.Yandex.Yandexmapkit.Overlay.OverlayItemEventArgs> OverlayItem {
        add {
            global::Java.Interop.EventHelper.AddEventHandler<global::RU.Yandex.Yandexmapkit.Overlay.IOnOverlayItemListener, global::RU.Yandex.Yandexmapkit.Overlay.IOnOverlayItemListenerImplementor>(
                    ref weak_implementor___SetOverlayItemListener,
                    __CreateIOnOverlayItemListenerImplementor,
                    __v => OverlayItemListener = __v,
                    __h => __h.Handler += value);
        }
        remove {
            global::Java.Interop.EventHelper.RemoveEventHandler<global::RU.Yandex.Yandexmapkit.Overlay.IOnOverlayItemListener, global::RU.Yandex.Yandexmapkit.Overlay.IOnOverlayItemListenerImplementor>(
                    ref weak_implementor___SetOverlayItemListener,
                    global::RU.Yandex.Yandexmapkit.Overlay.IOnOverlayItemListenerImplementor.__IsEmpty,
                    __v => OverlayItemListener = null,
                    __h => __h.Handler -= value);
        }
    }

    WeakReference weak_implementor___SetOverlayItemListener;

    global::RU.Yandex.Yandexmapkit.Overlay.IOnOverlayItemListenerImplementor __CreateIOnOverlayItemListenerImplementor ()
    {
        return new global::RU.Yandex.Yandexmapkit.Overlay.IOnOverlayItemListenerImplementor (this);
    }

It was generated from this Java block:

public interface OnOverlayItemListener
{
    void onClick(OverlayItem paramOverlayItem);
}
...

private OnOverlayItemListener m;
...

public OnOverlayItemListener getOverlayItemListener()
{
    return this.m;
}

public void setOverlayItemListener(OnOverlayItemListener paramOnOverlayItemListener)
{
    this.m = paramOnOverlayItemListener;
}

How to correctly implement this feature in Xamarin project?

Thanks.


Solution

  • Just rename OverlayItem to OnOverlayItem and Build, but not Rebuild