AsymmetricGridView icon indicating copy to clipboard operation
AsymmetricGridView copied to clipboard

OnItemClickListener issues with specified layouts

Open flightz8403 opened this issue 11 years ago • 4 comments

Hi Felipe,

Great library. It basically has all the functionalities that fits my needs.

This is the layout that I am trying to use in my app:

u9k2r

I modified the code in the sample app with the following in order to achieve my desired layout:

adapter.appendItems(getMoreItems(5)); listView.setAllowReordering(true); listView.setRequestedColumnCount(4); listView.determineColumns(); listView.setAdapter(adapter);

listView.setOnItemClickListener(this);

In getMoreItems(), the item in the first position (index = 0) has a row/column span of 2 while the others have a row/column span of 1.

However, the OnItemClickListener() stopped firing in Android 2.3.x for this layout.

Thanks.

flightz8403 avatar Aug 11 '14 03:08 flightz8403

Hi Felipe and flightz8403,

I have the same problem in Android 2.3.x !!

In my case, onClick is not fired only in the first cell of the grid, all the other cells are firing properly. Moreover, when any other element on the screen is clicked, the first cell start to work, and fires onClicks, include the previous onClicks that has not fired, as they are waiting on the event queue. It's like, this clicks on the first cell are been queued but not fired until another UI element queue another click, in that moment all the events are fired, either from first cell and the other UI element.

In my case, the layout is like a 3 columns and 2 rows symmetric grid.

thanks a lot,

tgamez avatar Aug 28 '14 08:08 tgamez

Hi again,

I think it's a race condition between ViewPager and ICSLinearLayout. I have checked if I disable ViewPager onClicks are fired properly.

The Issue is commented in ActionBarSherlock project:. https://github.com/jakewharton/actionbarsherlock/issues/442#issuecomment-6132410

I have trying the workaround pointed in the link, repopulating Grid after viewPager is layout, but I'm not sure where make the call. I don't know when ViewPager are finishing its layout method, which is that mess the grid up.

Another workaround is to change ICSLinearLayout for LinearLayout, but I think the cell insets are lost, right ?

thanks,

tgamez avatar Aug 28 '14 14:08 tgamez

Finally, I have change reference to ICSLinearLayout to LinearLayout, as I haven't succeed with the other solution. Hopefully cell insets are working !!

tgamez avatar Aug 29 '14 09:08 tgamez

@tgamez thanks for your investigation on this issue. Were you able to confirm this was an issue specifically related to ICSLinearLayout on Gingerbread (Android 2.3.x)?

felipecsl avatar Sep 02 '14 23:09 felipecsl