Search in sources :

Example 1 with DividerItem

use of carbon.component.DividerItem in project Carbon by ZieIony.

the class AvatarTextListItemActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listcomponent);
    Samples.initToolbar(this, getString(R.string.avatarTextListItemActivity_title));
    RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
    RowListAdapter adapter = new RowListAdapter<>(DefaultAvatarTextItem.class, AvatarTextRow.FACTORY);
    adapter.addFactory(DividerItem.class, DividerRow.FACTORY);
    recycler.setAdapter(adapter);
    Drawable avatar = getResources().getDrawable(R.drawable.iceland);
    adapter.setItems(Arrays.asList(new DefaultAvatarTextItem(avatar, "text"), new DefaultAvatarTextItem(avatar, "text"), new DividerItem(), new DefaultAvatarTextItem(avatar, "text"), new DefaultAvatarTextItem(avatar, "text")));
}
Also used : Drawable(android.graphics.drawable.Drawable) DefaultAvatarTextItem(carbon.component.DefaultAvatarTextItem) RowListAdapter(carbon.recycler.RowListAdapter) RecyclerView(carbon.widget.RecyclerView) DividerItem(carbon.component.DividerItem)

Aggregations

Drawable (android.graphics.drawable.Drawable)1 DefaultAvatarTextItem (carbon.component.DefaultAvatarTextItem)1 DividerItem (carbon.component.DividerItem)1 RowListAdapter (carbon.recycler.RowListAdapter)1 RecyclerView (carbon.widget.RecyclerView)1