Search in sources :

Example 1 with TextItem

use of me.drakeet.multitype.sample.normal.TextItem in project MultiType by drakeet.

the class SimpleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
    Items items = new Items();
    adapter = new MultiTypeAdapter();
    adapter.register(TextItem.class, new TextItemWithOutsizeDataViewBinder(aFieldValue));
    recyclerView.setAdapter(adapter);
    assertHasTheSameAdapter(recyclerView, adapter);
    for (int i = 0; i < 20; i++) {
        items.add(new TextItem(valueOf(i)));
    }
    adapter.setItems(items);
    adapter.notifyDataSetChanged();
    assertAllRegistered(adapter, items);
}
Also used : TextItem(me.drakeet.multitype.sample.normal.TextItem) RecyclerView(android.support.v7.widget.RecyclerView) Items(me.drakeet.multitype.Items) MultiTypeAdapter(me.drakeet.multitype.MultiTypeAdapter)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 Items (me.drakeet.multitype.Items)1 MultiTypeAdapter (me.drakeet.multitype.MultiTypeAdapter)1 TextItem (me.drakeet.multitype.sample.normal.TextItem)1