Search in sources :

Example 1 with DefaultImageTextSubtextDateItem

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

the class ImageTextSubtextDateListItemActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listcomponent);
    Samples.initToolbar(this, getString(R.string.imageTextSubtextDateListItemActivity_title));
    RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
    recycler.setLayoutManager(new LinearLayoutManager(this));
    RowListAdapter adapter = new RowListAdapter<>(DefaultImageTextSubtextDateItem.class, ImageTextSubtextDateRow::new);
    adapter.addFactory(DefaultHeaderItem.class, PaddedHeaderRow.FACTORY);
    recycler.setAdapter(adapter);
    Drawable drawable = getResources().getDrawable(R.drawable.watermelon);
    String date = format.format(new Date().getTime());
    adapter.setItems(Arrays.asList(new DefaultHeaderItem("Header"), new DefaultImageTextSubtextDateItem(drawable, "text", "subtext", date), new DefaultImageTextSubtextDateItem(drawable, "text", "subtext", date), new DefaultHeaderItem("Header"), new DefaultImageTextSubtextDateItem(drawable, "text", "subtext", date), new DefaultImageTextSubtextDateItem(drawable, "text", "subtext", date)));
}
Also used : DefaultHeaderItem(carbon.component.DefaultHeaderItem) ImageTextSubtextDateRow(carbon.component.ImageTextSubtextDateRow) Drawable(android.graphics.drawable.Drawable) RowListAdapter(carbon.recycler.RowListAdapter) RecyclerView(carbon.widget.RecyclerView) DefaultImageTextSubtextDateItem(carbon.component.DefaultImageTextSubtextDateItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Date(java.util.Date)

Aggregations

Drawable (android.graphics.drawable.Drawable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 DefaultHeaderItem (carbon.component.DefaultHeaderItem)1 DefaultImageTextSubtextDateItem (carbon.component.DefaultImageTextSubtextDateItem)1 ImageTextSubtextDateRow (carbon.component.ImageTextSubtextDateRow)1 RowListAdapter (carbon.recycler.RowListAdapter)1 RecyclerView (carbon.widget.RecyclerView)1 Date (java.util.Date)1