Search in sources :

Example 6 with ListItem

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

the class MainActivity method init.

@Override
public void init() {
    List<ListItem> items = new ArrayList<>();
    for (int i = 0; i < titles.length; i++) {
        ListItem item = new ListItem();
        item.setText(titles[i]);
        items.add(item);
    }
    MyAdapter adapter = new MyAdapter(MainActivity.this, items);
    getListView().setAdapter(adapter);
    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch(position) {
                case 0:
                    // menus
                    Intent menuActivityIntent = new Intent(MainActivity.this, MenuActivity.class);
                    startActivity(menuActivityIntent);
                    break;
                case 1:
                    // buttons
                    Intent buttonActivity = new Intent(MainActivity.this, ButtonActivity.class);
                    startActivity(buttonActivity);
                    break;
                case 2:
                    // base toolbar activity
                    Intent baseToolbar = new Intent(MainActivity.this, BaseToolbarExample.class);
                    startActivity(baseToolbar);
                    break;
                case 3:
                    // base toolbar list activity
                    Intent baseList = new Intent(MainActivity.this, BaseListActivity.class);
                    startActivity(baseList);
                    break;
                case 4:
                    // base fab list activity
                    Intent intent = new Intent(MainActivity.this, FabListActivity.class);
                    startActivity(intent);
                    break;
                case 5:
                    Intent baseQuick = new Intent(MainActivity.this, QuickReturnActivity.class);
                    startActivity(baseQuick);
                    break;
                case 6:
                    Intent baseCollapse = new Intent(MainActivity.this, CollapsingToolbarRecycler.class);
                    startActivity(baseCollapse);
                    break;
                case 7:
                    Intent baseCollapseWithFab = new Intent(MainActivity.this, CollapsingToolbarFab.class);
                    startActivity(baseCollapseWithFab);
                    break;
                case 8:
                    Intent baseRecylerFab = new Intent(MainActivity.this, ToolbarRecyclerActivity.class);
                    startActivity(baseRecylerFab);
            }
        }
    });
}
Also used : ArrayList(java.util.ArrayList) Intent(android.content.Intent) MyAdapter(com.materiallib.devpaul.materiallibrary.list.MyAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) AdapterView(android.widget.AdapterView) ListItem(com.materiallib.devpaul.materiallibrary.list.ListItem)

Example 7 with ListItem

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