Search in sources :

Example 1 with SimpleRecyclerViewAdapter

use of com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter in project MaterialLibrary by DeveloperPaul123.

the class CollapsingToolbarRecycler method init.

@Override
public void init() {
    List<ListItem> items = new ArrayList<>();
    for (int i = 0; i < 45; i++) {
        items.add(new ListItem("Item " + i));
    }
    getRecyclerView().setItemAnimator(new DefaultItemAnimator());
    getRecyclerView().setLayoutManager(new LinearLayoutManager(this));
    SimpleRecyclerViewAdapter adapter = new SimpleRecyclerViewAdapter(this, items);
    getRecyclerView().setAdapter(adapter);
    getCollapsingToolbarLayout().setTitle(getToolbar().getTitle());
    getCollapsingToolbarLayout().setExpandedTitleColor(getResources().getColor(android.R.color.white));
}
Also used : SimpleRecyclerViewAdapter(com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter) ArrayList(java.util.ArrayList) ListItem(com.materiallib.devpaul.materiallibrary.list.ListItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 2 with SimpleRecyclerViewAdapter

use of com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter in project MaterialLibrary by DeveloperPaul123.

the class CollapsingToolbarFab method init.

@Override
public void init() {
    // uncomment to make the fab appear on the left.
    // setFloatingActionButtonAlignLeft(true);
    List<ListItem> items = new ArrayList<>();
    for (int i = 0; i < 45; i++) {
        items.add(new ListItem("Item " + i));
    }
    getRecyclerView().setItemAnimator(new DefaultItemAnimator());
    getRecyclerView().setLayoutManager(new LinearLayoutManager(this));
    SimpleRecyclerViewAdapter adapter = new SimpleRecyclerViewAdapter(this, items);
    getRecyclerView().setAdapter(adapter);
    getCollapsingToolbarLayout().setTitle(getToolbar().getTitle());
    getCollapsingToolbarLayout().setExpandedTitleColor(getResources().getColor(android.R.color.white));
}
Also used : SimpleRecyclerViewAdapter(com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter) ArrayList(java.util.ArrayList) ListItem(com.materiallib.devpaul.materiallibrary.list.ListItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 3 with SimpleRecyclerViewAdapter

use of com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter in project MaterialLibrary by DeveloperPaul123.

the class QuickReturnActivity method init.

@Override
public void init() {
    List<ListItem> items = new ArrayList<>();
    for (int i = 0; i < 45; i++) {
        items.add(new ListItem("Item " + i));
    }
    getRecyclerView().setHasFixedSize(true);
    getRecyclerView().setItemAnimator(new DefaultItemAnimator());
    getRecyclerView().setLayoutManager(new LinearLayoutManager(this));
    SimpleRecyclerViewAdapter adapter = new SimpleRecyclerViewAdapter(this, items);
    getRecyclerView().setAdapter(adapter);
}
Also used : SimpleRecyclerViewAdapter(com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter) ArrayList(java.util.ArrayList) ListItem(com.materiallib.devpaul.materiallibrary.list.ListItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 4 with SimpleRecyclerViewAdapter

use of com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter in project MaterialLibrary by DeveloperPaul123.

the class ToolbarRecyclerActivity method init.

@Override
public void init() {
    // just make some simple list items.
    List<ListItem> items = new ArrayList<>();
    for (int i = 0; i < 45; i++) {
        items.add(new ListItem("Item " + i));
    }
    SimpleRecyclerViewAdapter adapter = new SimpleRecyclerViewAdapter(this, items);
    getRecyclerView().setAdapter(adapter);
}
Also used : SimpleRecyclerViewAdapter(com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter) ArrayList(java.util.ArrayList) ListItem(com.materiallib.devpaul.materiallibrary.list.ListItem)

Aggregations

ListItem (com.materiallib.devpaul.materiallibrary.list.ListItem)4 SimpleRecyclerViewAdapter (com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter)4 ArrayList (java.util.ArrayList)4 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3