Skip to content

Instantly share code, notes, and snippets.

@DevAhamed
Created May 20, 2019 06:41
Show Gist options
  • Save DevAhamed/a62316c8423661b0c249425a414a3a4f to your computer and use it in GitHub Desktop.
Save DevAhamed/a62316c8423661b0c249425a414a3a4f to your computer and use it in GitHub Desktop.
// NewsPaperSources
ListSection<NewsSource> newsPaperSources = new ListSection();
ItemSection<NewsSource> newsPaperNoneItem = new ItemSection(new NewsSource(NewsSource.NONE));
// Create a nested section for NewsPaperSources
NestedSection nestedNewsPaperSection = new NestedSection();
nestedNewsPaperSection.addSection(newsPaperSources);
nestedNewsPaperSection.addSection(newsPaperNoneItem);
// NewsChannelSources
ListSection<NewsSource> newsChannelSources = new ListSection();
ItemSection<NewsSource> newsChannelNoneItem = new ItemSection(new NewsSource(NewsSource.NONE));
// Create a nested section for NewsChannelSources
NestedSection nestedNewsChannelSection = new NestedSection();
nestedNewsChannelSection.addSection(newsChannelSources);
nestedNewsChannelSection.addSection(newsChannelNoneItem);
// Add sections to adapter
adapter.addSection(nestedNewsPaperSection);
adapter.addSection(nestedNewsChannelSection);
// Set the selection modes
adapter.setSelectionMode(Mode.MULTIPLE);
newsPaperSources.setSelectionMode(Mode.MULTIPLE);
nestedNewsPaperSection.setSelectionMode(Mode.SINGLE);
newsChannelSources.setSelectionMode(Mode.MULTIPLE);
nestedNewsChannelSection.setSelectionMode(Mode.SINGLE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment