Created
March 16, 2017 20:37
-
-
Save cdflynn/071181aae186b680d5cceffe97eaa71f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Provides information about a sorted scrollable collection with sectioned contents. | |
*/ | |
public interface SectionScrollAdapter { | |
/** | |
* Return the number of sections in your scrollable collection.<br> | |
* | |
* For instance, if your data set is an alphabetical list where each letter is represented | |
* at least once, you would return 26. | |
*/ | |
int getSectionCount(); | |
/** | |
* Return a title for the section at {@code position}. | |
* <br> | |
* In the alphabet example, returned values would be: | |
* <br> | |
* <pre> | |
* getSectionTitle(0) -> "A" | |
* getSectionTitle(1) -> "B" | |
* ... | |
* getSectionTitle(25) -> "Z" | |
* </pre> | |
* | |
* @param position The zero-indexed position of the section. | |
*/ | |
String getSectionTitle(int position); | |
/** | |
* Return an integer that describes the size of the section at {@code position}. | |
* The returned value may be in any arbitrary units, but should be comparable in relative | |
* terms to other section sizes. If all of your items in all sections have the same | |
* visible dimensions (as is sometimes the case in a simple recycler view), you can just | |
* return the number of items in the section at {@code position}. | |
* <br><br> | |
* Returned values should be greater than zero. If you have an empty section that you'd like to | |
* hide, instead of returning 0 here you should correctly report its absence by returning the | |
* number of visible sections in {@link #getSectionCount()}, and inform the scroller of runtime | |
* changes by calling {@link BubbleScroller#notifySectionsChanged()}. | |
* | |
* @param position the zero-indexed position of the section | |
*/ | |
@IntRange(from = 1) | |
int getSectionWeight(int position); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment