This file contains hidden or 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
dependencies { | |
// ... other dependencies here | |
compile 'com.github.devahamed:multi-view-adapter:1.1.0' | |
} |
This file contains hidden or 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
@Override | |
public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { | |
canvas.save(); | |
final int leftWithMargin = convertDpToPixel(56); | |
final int right = parent.getWidth(); | |
final int childCount = parent.getChildCount(); | |
for (int i = 0; i < childCount; i++) { | |
final View child = parent.getChildAt(i); | |
int adapterPosition = parent.getChildAdapterPosition(child); |
This file contains hidden or 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
DividerItemDecoration decoration = new DividerItemDecoration(getApplicationContext(), VERTICAL); | |
recyclerView.addItemDecoration(decoration); |
This file contains hidden or 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
// ItemBinder for NewsSource | |
public class NewsSourceBinder extends ItemBinder<NewsSource, NewsSourceBinder.ViewHolder> { | |
@Override public ViewHolder createViewHolder(ViewGroup parent) { | |
return new ViewHolder(inflate(parent, R.layout.item_news_source)); | |
} | |
@Override public void bindViewHolder(ViewHolder holder, NewsSource item) { | |
holder.imageView.setImageResource(item.getIconResource()); | |
holder.textView.setText(item.getText()); |
This file contains hidden or 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
// 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 |