Search in sources :

Example 1 with LicensesDialogFragment

use of com.khmelenko.lab.varis.about.LicensesDialogFragment in project Varis-Android by dkhmelenko.

the class MainActivity method setupDrawerLayout.

/**
 * Sets up navigation drawer layout
 */
private void setupDrawerLayout() {
    mDrawerLayout = findViewById(R.id.drawer_layout);
    mDrawerLayout.addDrawerListener(mDrawerToggle);
    final NavigationView view = findViewById(R.id.navigation_view);
    view.setNavigationItemSelectedListener(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;
    });
}
Also used : LicensesDialogFragment(com.khmelenko.lab.varis.about.LicensesDialogFragment) NavigationView(android.support.design.widget.NavigationView) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 NavigationView (android.support.design.widget.NavigationView)1 LicensesDialogFragment (com.khmelenko.lab.varis.about.LicensesDialogFragment)1