ccomeaux / boardgamegeek4android

BoardGameGeek application for Android (unofficial)
GNU General Public License v3.0
228 stars 47 forks source link

Fast scroll letter for game list #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As seen here: 
http://stackoverflow.com/questions/5122749/create-easy-alphabetical-scrolling-in
-listview/5122846

Would make it much easier to find a game in the list.

Original issue reported on code.google.com by nib...@gmail.com on 28 Jun 2011 at 5:39

GoogleCodeExporter commented 9 years ago
Here's some code from the API Demos:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/
apis/view/List9.html

Maybe we should also look into alphabetic dividers in the list view, similar to 
the contacts list. Though doing both may be overkill.

Original comment by chris.co...@gmail.com on 28 Jun 2011 at 2:21

GoogleCodeExporter commented 9 years ago
Okay,  I gave this a try last night with mixed results. I tried using the 
AlphabetIndexer which was really easy (about 6 LoC) but has two issues, one 
minor, one moderate:
1) The AlphabetIndexer works by having you specify a fixed alphabet upfront and 
then dividing up the scroll area evenly amongst the characters it contains. 
This works well if your items cover a reasonable portion of the alphabet, but 
it's a bit strange to use if the results are more sparse. For example, if your 
alphabet was " ABCDE" and you only had games beginning with A, D and E, the A 
would appear to occupy the top 60% of the scroll area (since there is actually 
a B and a C which take up space but don't have any results) and the D and E 
would occupy only 20% of the scroll area each. Like I say, if you have a 
reasonably well spread collection, this is barely noticeable, but if you only 
buy Age of Steam and Zombies!!! games, it's a bit weird (for many reasons ;-)
2) The AlphabetIndexer doesn't play nice with accented characters. This isn't 
too bad if you just leave the accented characters out of your alphabet, but if 
you had a few games with different character it might seem odd. Adding the 
accented characters to the alphabet causes untold horror as the internal logic 
of the Indexer seems to be splitting the accented character into its component 
code points and this means that your accented "A" will also match games 
beginning with plain "A".

I then tried implementing my own SectionIndexer, by computing the set of first 
characters we have available. This basically involved scanning all the rows 
under the cursor, which really defeats the point of having one in the first 
place so I wound up dropping it.

The AlphabetIndexer works, but it's a little clunky. I'm going to try and find 
the time to try the method in the code sample Chris linked to and just display 
the character based on the first visible item. This will be a little more code, 
but should work better with sparse lists and accented characters.

Original comment by garethpm...@gmail.com on 22 Jul 2011 at 9:53

GoogleCodeExporter commented 9 years ago

Original comment by chris.co...@gmail.com on 9 Jan 2012 at 4:16