Search in sources :

Example 1 with SmoothActionBarDrawerToggle

use of org.fossasia.openevent.common.ui.SmoothActionBarDrawerToggle in project open-event-android by fossasia.

the class MainActivity method setUpNavDrawer.

private void setUpNavDrawer() {
    setUpUserProfileMenu();
    headerView = navigationView.getHeaderView(0).findViewById(R.id.headerDrawer);
    if (!isTwoPane) {
        final ActionBar ab = getSupportActionBar();
        if (ab == null)
            return;
        SmoothActionBarDrawerToggle smoothActionBarToggle = new SmoothActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {

            @Override
            public void onDrawerStateChanged(int newState) {
                super.onDrawerStateChanged(newState);
                if (toolbar.getTitle().equals(getString(R.string.menu_about))) {
                    navigationView.setCheckedItem(R.id.nav_home);
                }
            }
        };
        if (drawerLayout != null) {
            drawerLayout.addDrawerListener(smoothActionBarToggle);
        }
        ab.setDisplayHomeAsUpEnabled(true);
        smoothActionBarToggle.syncState();
    } else if (toolbar.getTitle().equals(getString(R.string.menu_about))) {
        navigationView.setCheckedItem(R.id.nav_home);
    }
}
Also used : SmoothActionBarDrawerToggle(org.fossasia.openevent.common.ui.SmoothActionBarDrawerToggle) ActionBar(android.support.v7.app.ActionBar)

Aggregations

ActionBar (android.support.v7.app.ActionBar)1 SmoothActionBarDrawerToggle (org.fossasia.openevent.common.ui.SmoothActionBarDrawerToggle)1