use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class GuidelinesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
Samples.initToolbar(this, getString(R.string.guidelinesActivity_title));
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
ViewModel[] items = new ViewModel[] { new ViewModel(ButtonsUsageActivity.class, getString(R.string.buttonsUsageActivity_title)), new ViewModel(ToolbarsUsageActivity.class, getString(R.string.toolbarsUsageActivity_title)) };
recyclerView.setLayoutManager(getResources().getBoolean(R.bool.tablet) ? new GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false) : new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(new MainListAdapter(items));
}
use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Samples.initToolbar(this, getString(R.string.app_name));
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
ViewModel[] items = new ViewModel[] { new ViewModel(AnimationsActivity.class, getString(R.string.animationsActivity_title)), new ViewModel(AppsLibrariesActivity.class, getString(R.string.appsLibrariesActivity_title)), new ViewModel(ColorsActivity.class, getString(R.string.colorsActivity_title)), new ViewModel(ComponentsActivity.class, getString(R.string.componentsActivity_title)), new ViewModel(DemosActivity.class, getString(R.string.demosActivity_title)), new ViewModel(FeaturesActivity.class, getString(R.string.featuresActivity_title)), new ViewModel(GuidelinesActivity.class, getString(R.string.guidelinesActivity_title)), new ViewModel(WidgetsActivity.class, getString(R.string.widgetsActivity_title)) };
recyclerView.setLayoutManager(getResources().getBoolean(R.bool.tablet) ? new GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false) : new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(new MainListAdapter(items));
}
use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class ScrollFlagsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scrollflags);
RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
recycler.setLayoutManager(new LinearLayoutManager(this));
/*RowListAdapter<AvatarTextListItemActivity.SampleItem> adapter = new RowListAdapter<>(AvatarTextListItemActivity.SampleItem.class, AvatarTextRow::new);
recycler.setAdapter(adapter);
adapter.setItems(Stream.generate(AvatarTextListItemActivity.SampleItem::new).limit(10).collect(Collectors.toList()));
*/
}
use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class QuickReturnActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quickreturn);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(new FruitAdapter(fruits, null));
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
recyclerView.addOnScrollListener(new android.support.v7.widget.RecyclerView.OnScrollListener() {
int yscroll = 0;
@Override
public void onScrolled(android.support.v7.widget.RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (fab.getVisibility() == View.VISIBLE && fab.getAnimator() == null && yscroll > 50 * Carbon.getDip(getApplicationContext())) {
yscroll = 0;
fab.setVisibility(View.GONE);
toolbar.setVisibility(View.GONE);
}
if (fab.getVisibility() != View.VISIBLE && fab.getAnimator() == null && yscroll < -50 * Carbon.getDip(getApplicationContext())) {
yscroll = 0;
fab.setVisibility(View.VISIBLE);
toolbar.setVisibility(View.VISIBLE);
}
if (Math.signum(dy) != Math.signum(yscroll))
yscroll = 0;
yscroll += dy;
}
});
}
use of carbon.widget.RecyclerView in project Carbon by ZieIony.
the class DemosActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
Samples.initToolbar(this, getString(R.string.demosActivity_title));
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
ViewModel[] items = new ViewModel[] { new ViewModel(PowerMenuActivity.class, getString(R.string.powerMenuActivity_title)), new ViewModel(ShareToolbarActivity.class, getString(R.string.shareToolbarActivity_title), true), new ViewModel(AutoCompleteDemo.class, getString(R.string.autoCompleteActivity_title), false), new ViewModel(QuickReturnActivity.class, getString(R.string.quickReturenActivity_title), false) };
recyclerView.setLayoutManager(getResources().getBoolean(R.bool.tablet) ? new GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false) : new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(new MainListAdapter(items));
}
Aggregations