use of me.drakeet.multitype.sample.weibo.content.SimpleImage in project MultiType by drakeet.
the class WeiboActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
/* WeiboAdapter! */
adapter = new WeiboAdapter();
adapter.register(SimpleText.class, new SimpleTextViewBinder());
adapter.register(SimpleImage.class, new SimpleImageViewBinder());
recyclerView.setAdapter(adapter);
items = new Items();
User user = new User("drakeet", R.mipmap.avatar);
SimpleText simpleText = new SimpleText("A simple text Weibo: Hello World.");
SimpleImage simpleImage = new SimpleImage(R.drawable.img_10);
for (int i = 0; i < 20; i++) {
items.add(new Weibo(user, simpleText));
items.add(new Weibo(user, simpleImage));
}
adapter.setItems(items);
adapter.notifyDataSetChanged();
assertAllRegistered(adapter, items);
loadRemoteData();
}
Aggregations