Search in sources :

Example 1 with MyAdapter

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

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

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

Aggregations

ListItem (com.materiallib.devpaul.materiallibrary.list.ListItem)3 MyAdapter (com.materiallib.devpaul.materiallibrary.list.MyAdapter)3 ArrayList (java.util.ArrayList)3 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 Intent (android.content.Intent)1