use of carbon.widget.RecyclerView 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")));
}
use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class IconTextListItemActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listcomponent);
Samples.initToolbar(this, getString(R.string.iconTextListItemActivity_title));
RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
recycler.setLayoutManager(new LinearLayoutManager(this));
RowListAdapter adapter = new RowListAdapter<>(DefaultIconTextItem.class, IconTextRow::new);
adapter.addFactory(DefaultIconSearchItem.class, parent -> new IconSearchRow(parent, new ArraySearchDataProvider(new String[] {}), filterResults -> {
}));
recycler.setAdapter(adapter);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(new ColorDrawable(Carbon.getThemeColor(this, R.attr.carbon_dividerColor)), getResources().getDimensionPixelSize(R.dimen.carbon_1dip));
dividerItemDecoration.setDrawRules(position -> position == 0);
recycler.addItemDecoration(dividerItemDecoration);
VectorDrawable drawable = new VectorDrawable(getResources(), R.raw.ic_face_24px);
adapter.setItems(Arrays.asList(new DefaultIconSearchItem(this), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text")));
}
use of carbon.widget.RecyclerView 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)));
}
use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class RegisterActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listcomponent);
Samples.initToolbar(this, getString(R.string.registerActivity_title));
RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
RowListAdapter adapter = new RowListAdapter<>(DefaultIconEditTextItem.class, IconEditTextRow.FACTORY);
adapter.addFactory(DividerItem.class, DividerRow.FACTORY);
adapter.addFactory(DefaultIconPasswordItem.class, IconPasswordRow.FACTORY);
adapter.addFactory(DefaultIconDropDownItem.class, IconDropDownRow.FACTORY);
recycler.setAdapter(adapter);
adapter.setItems(Arrays.asList(new DefaultIconEditTextItem(new VectorDrawable(getResources(), R.raw.profile), "login", ""), new DefaultIconEditTextItem(new VectorDrawable(getResources(), R.raw.email), "email", ""), new DefaultIconPasswordItem(new VectorDrawable(getResources(), R.raw.lock), "password", ""), new DefaultIconPasswordItem(null, "retype password", ""), new DefaultIconDropDownItem<>(new VectorDrawable(getResources(), R.raw.gender), "sex", new String[] { "Male", "Female" }, "Male")));
}
use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class DrawerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(R.string.app_name);
drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
drawerMenu = (LinearLayout) findViewById(R.id.drawerMenu);
RecyclerView drawerList = (RecyclerView) findViewById(R.id.drawerList);
drawerList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
FruitAdapter adapter = new FruitAdapter(fruits, null);
drawerList.setAdapter(adapter);
adapter.setOnItemClickedListener(position -> {
setTitle(fruits.get(position));
drawerLayout.closeDrawer(drawerMenu);
});
}
Aggregations