Search in sources :

Example 16 with ActionBarDrawerToggle

use of androidx.appcompat.app.ActionBarDrawerToggle in project FlexibleAdapter by davideas.

the class MainActivity method initializeDrawer.

private void initializeDrawer() {
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawer.addDrawerListener(toggle);
    toggle.syncState();
    mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    mNavigationView.setNavigationItemSelectedListener(this);
    // Version
    TextView appVersion = mNavigationView.getHeaderView(0).findViewById(R.id.app_version);
    appVersion.setText(getString(R.string.about_version, Utils.getVersionName(this)));
}
Also used : ActionBarDrawerToggle(androidx.appcompat.app.ActionBarDrawerToggle) TextView(android.widget.TextView)

Example 17 with ActionBarDrawerToggle

use of androidx.appcompat.app.ActionBarDrawerToggle in project LiYuJapanese by 54wall.

the class MainActivity method initDrawerLayout.

private void initDrawerLayout() {
    mDrawerLayout = findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawerLayout.addDrawerListener(toggle);
    toggle.syncState();
    Log.i(TAG, "initDrawerLayout: OK");
}
Also used : ActionBarDrawerToggle(androidx.appcompat.app.ActionBarDrawerToggle)

Example 18 with ActionBarDrawerToggle

use of androidx.appcompat.app.ActionBarDrawerToggle in project android by nextcloud.

the class DrawerActivity method setupDrawerToggle.

/**
 * initializes and sets up the drawer toggle.
 */
private void setupDrawerToggle() {
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) {

        /**
         * Called when a drawer has settled in a completely closed state.
         */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            supportInvalidateOptionsMenu();
            mDrawerToggle.setDrawerIndicatorEnabled(isDrawerIndicatorAvailable());
            if (pendingRunnable != null) {
                new Handler().post(pendingRunnable);
                pendingRunnable = null;
            }
            closeDrawer();
        }

        /**
         * Called when a drawer has settled in a completely open state.
         */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            mDrawerToggle.setDrawerIndicatorEnabled(true);
            supportInvalidateOptionsMenu();
        }
    };
    // Set the drawer toggle as the DrawerListener
    mDrawerLayout.addDrawerListener(mDrawerToggle);
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerToggle.setDrawerSlideAnimationEnabled(true);
    Drawable backArrow = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_arrow_back, null);
    mDrawerToggle.setHomeAsUpIndicator(ThemeDrawableUtils.tintDrawable(backArrow, ThemeColorUtils.appBarPrimaryFontColor(this)));
    mDrawerToggle.getDrawerArrowDrawable().setColor(ThemeColorUtils.appBarPrimaryFontColor(this));
}
Also used : ActionBarDrawerToggle(androidx.appcompat.app.ActionBarDrawerToggle) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) LayerDrawable(android.graphics.drawable.LayerDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Handler(android.os.Handler) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) NavigationView(com.google.android.material.navigation.NavigationView)

Aggregations

ActionBarDrawerToggle (androidx.appcompat.app.ActionBarDrawerToggle)18 View (android.view.View)10 Intent (android.content.Intent)8 TextView (android.widget.TextView)7 NavigationView (com.google.android.material.navigation.NavigationView)7 DrawerLayout (androidx.drawerlayout.widget.DrawerLayout)6 Toolbar (androidx.appcompat.widget.Toolbar)5 Handler (android.os.Handler)4 ImageView (android.widget.ImageView)4 Fragment (androidx.fragment.app.Fragment)4 SharedPreferences (android.content.SharedPreferences)3 Build (android.os.Build)3 Bundle (android.os.Bundle)3 ArgbEvaluator (android.animation.ArgbEvaluator)2 Context (android.content.Context)2 IntentFilter (android.content.IntentFilter)2 Configuration (android.content.res.Configuration)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 Uri (android.net.Uri)2 KeyEvent (android.view.KeyEvent)2