views:

27

answers:

1

Firstly, I realize this doesn't follow any particular convention. I'm just wondering if it is possible.

I'd like to give my users the ability to perform an action on many items in a ListView. My ListView items already contain a checkbox for something different; and adding another checkbox is not an option (it would look ugly?).

I was wondering if it's possible to programmatically highlight multiple items by determining which items were covered by a two-finger swipe.

This would require a few things:

1) Android's ListView would have to be capable of determining the difference between a two-finger swipe and a single-finger swipe. 2) I would need to be able to clarify which code a two-finger swipe invokes. 3) Ideally, if I'm two-finger swiping, and my fingers reach the bottom of the screen, the ListView would begin scrolling; so I could continue to highlight items that are originally off the screen. 4) The ListView would have to be capable of highlighting more than one option.

Number 4 could probably be hacked around so long as I could determine which items were passed over with the two-fingers. I could hack together my own "selection." After doing this, I would provide some functionality via the Menu button to do something to these highlighted items.

Does any of this seem possible? What do you think?

A: 

#1 and #2 could be handled via GestureDetector, layered atop your ListView. However, that probably runs counter to #3. #4 probably would not be handled by standard Android "selection" state, but you could manually adjust the views (e.g., show a previously invisible icon, change the background color of something).

#3, though, really feels like it would require modifications to ListView itself, and that strikes me as being rather unpleasant, given the ListView (and AbsListView) code.

One way around that would be to interpret your gestures as additive (a new two-finger gesture does not clear the previous multi-select, but adds more to the existing one), using a menu choice to clear the previous selections. Then, the user can select some, scroll, select some more, etc.

All that being said, I suspect that this will not be very discoverable. You're assuming people will find out about the gestures by RTFM, and we both know how well that works. Having this as an option is cool, but make sure that whatever is done this way can also be done by some other more conventional means.

CommonsWare
Thanks for your response. I'll play around with it when I have time and I'll let you know if I come up with anything
Andrew