Search in sources :

Example 1 with DefaultListAdapter

use of com.felipecsl.asymmetricgridview.app.widget.DefaultListAdapter in project AsymmetricGridView by felipecsl.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    listView = (AsymmetricGridView) findViewById(R.id.listView);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
    actionBar.setDisplayHomeAsUpEnabled(true);
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    if (navigationView != null) {
        setupDrawerContent(navigationView);
    }
    if (USE_CURSOR_ADAPTER) {
        if (savedInstanceState == null) {
            adapter = new DefaultCursorAdapter(this, demoUtils.moarItems(50));
        } else {
            adapter = new DefaultCursorAdapter(this);
        }
    } else {
        if (savedInstanceState == null) {
            adapter = new DefaultListAdapter(this, demoUtils.moarItems(50));
        } else {
            adapter = new DefaultListAdapter(this);
        }
    }
    listView.setRequestedColumnCount(3);
    listView.setRequestedHorizontalSpacing(Utils.dpToPx(this, 3));
    listView.setAdapter(getNewAdapter());
    listView.setDebugging(true);
    listView.setOnItemClickListener(this);
}
Also used : NavigationView(android.support.design.widget.NavigationView) DefaultListAdapter(com.felipecsl.asymmetricgridview.app.widget.DefaultListAdapter) DefaultCursorAdapter(com.felipecsl.asymmetricgridview.app.widget.DefaultCursorAdapter) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

NavigationView (android.support.design.widget.NavigationView)1 ActionBar (android.support.v7.app.ActionBar)1 Toolbar (android.support.v7.widget.Toolbar)1 DefaultCursorAdapter (com.felipecsl.asymmetricgridview.app.widget.DefaultCursorAdapter)1 DefaultListAdapter (com.felipecsl.asymmetricgridview.app.widget.DefaultListAdapter)1