Search in sources :

Example 1 with ListItem

use of com.materiallib.devpaul.materiallibrary.list.ListItem 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 ListItem

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

the class BaseListActivity method init.

@Override
public void init() {
    List<ListItem> items = new ArrayList<>();
    for (int i = 0; i < 50; i++) {
        items.add(new ListItem("Item " + i));
    }
    MyAdapter adapter = new MyAdapter(BaseListActivity.this, items);
    getListView().setAdapter(adapter);
}
Also used : ArrayList(java.util.ArrayList) ListItem(com.materiallib.devpaul.materiallibrary.list.ListItem) MyAdapter(com.materiallib.devpaul.materiallibrary.list.MyAdapter)

Example 3 with ListItem

use of com.materiallib.devpaul.materiallibrary.list.ListItem 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 4 with ListItem

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

the class FabListActivity method init.

@Override
public void init() {
    List<ListItem> items = new ArrayList<>();
    for (int i = 0; i < 50; i++) {
        items.add(new ListItem("Item " + i));
    }
    MyAdapter adapter = new MyAdapter(this, items);
    getListView().setAdapter(adapter);
    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(FabListActivity.this, "Item " + position + " clicked", Toast.LENGTH_SHORT).show();
        }
    });
}
Also used : ArrayList(java.util.ArrayList) AdapterView(android.widget.AdapterView) ListItem(com.materiallib.devpaul.materiallibrary.list.ListItem) MyAdapter(com.materiallib.devpaul.materiallibrary.list.MyAdapter) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 5 with ListItem

use of com.materiallib.devpaul.materiallibrary.list.ListItem 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)

Aggregations

ListItem (com.materiallib.devpaul.materiallibrary.list.ListItem)7 ArrayList (java.util.ArrayList)7 SimpleRecyclerViewAdapter (com.materiallib.devpaul.materiallibrary.list.SimpleRecyclerViewAdapter)4 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 MyAdapter (com.materiallib.devpaul.materiallibrary.list.MyAdapter)3 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 Intent (android.content.Intent)1