use of android.support.v7.widget.RecyclerView.Adapter in project material-dialogs by afollestad.
the class MaterialDialog method invalidateList.
/**
* Sets the dialog RecyclerView's adapter/layout manager, and it's item click listener.
*/
final void invalidateList() {
if (recyclerView == null) {
return;
} else if ((builder.items == null || builder.items.size() == 0) && builder.adapter == null) {
return;
}
if (builder.layoutManager == null) {
builder.layoutManager = new LinearLayoutManager(getContext());
}
recyclerView.setLayoutManager(builder.layoutManager);
recyclerView.setAdapter(builder.adapter);
if (listType != null) {
((DefaultRvAdapter) builder.adapter).setCallback(this);
}
}
use of android.support.v7.widget.RecyclerView.Adapter in project lottie-android by airbnb.
the class ListFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list, container, false);
ButterKnife.bind(this, view);
recyclerView.setAdapter(adapter);
return view;
}
use of android.support.v7.widget.RecyclerView.Adapter 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 android.support.v7.widget.RecyclerView.Adapter 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 android.support.v7.widget.RecyclerView.Adapter 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