Bug 24367 - Xamarin Support Library v7 RecyclerView remains problematic
Summary: Xamarin Support Library v7 RecyclerView remains problematic
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.18.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2014-11-08 22:03 UTC by Horácio J. C. Filho
Modified: 2015-11-19 18:14 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Horácio J. C. Filho 2014-11-08 22:03:47 UTC
Hello guys,

I've ran on a bug, some methods in RecyclerView.Adapter have its bindings incorrect.

RecyclerView.Adapter.OnViewAttachedToWindow(Java.Lang.Object p0) method is never called in a instance.

Looking inside RecyclerView.Adapter class:
It is:
[Register("onViewAttachedToWindow", "(Ljava/lang/Object;)V", "GetOnViewAttachedToWindow_Ljava_lang_Object_Handler")]
public virtual void OnViewAttachedToWindow(Java.Lang.Object p0)
It should be similar to:
[Register("onViewAttachedToWindow", "(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V", "GetOnViewAttachedToWindow_Ljava_lang_Object_Handler")]
public virtual void OnViewAttachedToWindow(RecyclerView.ViewHolder holder)

The problem here is that the binding is generating an method invalid and the Java method correct is becoming inaccessible. This method being registered does not exist. This does not happen only with this method. RecyclerView.Adapter.OnViewDetachedFromWindow(Java.Lang.Object p0) and OnViewRecycled(Java.Lang.Object p0) methods are affected by the same.

It is:
[Register("onViewDetachedFromWindow", "(Ljava/lang/Object;)V", "GetOnViewDetachedFromWindow_Ljava_lang_Object_Handler")]
public virtual void OnViewDetachedFromWindow(Java.Lang.Object p0)
It should be similar to:
[Register("onViewDetachedFromWindow", "(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V", "GetOnViewDetachedFromWindow_Ljava_lang_Object_Handler")]
public virtual void OnViewDetachedFromWindow(RecyclerView.ViewHolder holder)

It is:
[Register("onViewRecycled", "(Ljava/lang/Object;)V", "GetOnViewRecycled_Ljava_lang_Object_Handler")]
public virtual void OnViewRecycled(Java.Lang.Object p0)
It should be similar to:
[Register("onViewRecycled", "(Landroid/support/v7/widget/RecyclerView$ViewHolder;)V", "GetOnViewRecycled_Ljava_lang_Object_Handler")]
public virtual void OnViewRecycled(RecyclerView.ViewHolder holder)

Thanks in advance :D
Comment 1 Horácio J. C. Filho 2014-11-08 23:00:42 UTC
The problems showed here https://bugzilla.xamarin.com/show_bug.cgi?id=24066 remains too :'(
Comment 2 Atsushi Eno 2014-11-10 09:25:17 UTC
It may rather be similar to bug #22155 than 24066.
Comment 3 David Schwegler 2014-12-18 16:25:29 UTC
OnViewRecycled and OnViewDetachedFromWindow are being called for me in the latest version (v21.0.3.0). I didn't check OnViewAttachedToWindow.
Comment 4 dean.ellis 2015-11-04 07:24:57 UTC
On the latest version (v23.1.0.0) all of the mentioned methods 

OnViewAttachedToWindow
OnViewRecycled
OnViewDetachedFromWindow

Are being called. I was testing using the RecyclerViewer sample in monodroid-samples. I checked out the source and upgraded the packages to the latest versions.

https://github.com/xamarin/monodroid-samples/tree/master/android5.0/RecyclerViewer