use of com.khmelenko.lab.varis.fragment.LicensesDialogFragment in project Varis-Android by dkhmelenko.
the class MainActivity method setupDrawerLayout.
/**
* Sets up navigation drawer layout
*/
private void setupDrawerLayout() {
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerLayout.addDrawerListener(mDrawerToggle);
final NavigationView view = (NavigationView) findViewById(R.id.navigation_view);
view.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch(menuItem.getItemId()) {
case R.id.drawer_login:
Intent loginIntent = new Intent(MainActivity.this, AuthActivity.class);
startActivityForResult(loginIntent, AUTH_ACTIVITY_CODE);
break;
case R.id.drawer_logout:
getPresenter().userLogout();
finish();
startActivity(getIntent());
break;
case R.id.drawer_licenses:
LicensesDialogFragment dialog = LicensesDialogFragment.newInstance();
dialog.show(getSupportFragmentManager(), "LicensesDialog");
break;
case R.id.drawer_about:
Intent aboutIntent = new Intent(MainActivity.this, AboutActivity.class);
startActivity(aboutIntent);
break;
}
menuItem.setChecked(false);
mDrawerLayout.closeDrawers();
return true;
}
});
}
Aggregations