private void setupDrawer ( ) { // Setup drawer background color if set int backgroundColor = UIUtils . getColorAttr ( mActivity , R . attr . drawerBackground ) ; if ( backgroundColor > 0 ) { mDrawerPane . setBackgroundColor ( backgroundColor ) ; } // Set the drawer layout statusbar color int statusBarColor = mConfig . getStatusBarColor ( mActivity ) ; if ( statusBarColor != - 1 ) mDrawerLayout . setStatusBarBackgroundColor ( statusBarColor ) ; // Populate Header View populateHeader ( ) ; // Populate Footer View populateFooter ( ) ; // Configure the scrim inset pane view final int headerHeight = mActivity . getResources ( ) . getDimensionPixelSize ( R . dimen . navdrawer_chosen_account_height ) ; mDrawerPane . setOnInsetsCallback ( new OnInsetsCallback ( ) { @ Override public void onInsetsChanged ( Rect insets ) { if ( mHeaderView != null ) { mConfig . onInsetsChanged ( mHeaderView , insets ) ; ViewGroup . LayoutParams lp2 = mDrawerHeaderFrame . getLayoutParams ( ) ; lp2 . height = headerHeight + insets . top ; mDrawerHeaderFrame . setLayoutParams ( lp2 ) ; } else { ViewGroup . LayoutParams lp2 = mDrawerHeaderFrame . getLayoutParams ( ) ; lp2 . height = insets . top ; mDrawerHeaderFrame . setLayoutParams ( lp2 ) ; } } } ) ; // Setup the drawer toggle if ( mToolbar != null ) { mDrawerToggle = new ActionBarDrawerToggle ( mActivity , mDrawerLayout , mToolbar , R . string . navigation_drawer_open , R . string . navigation_drawer_close ) { @ Override public void onDrawerClosed ( View drawerView ) { super . onDrawerClosed ( drawerView ) ; if ( mCallbacks != null ) mCallbacks . onDrawerClosed ( drawerView ) ; } @ Override public void onDrawerOpened ( View drawerView ) { super . onDrawerOpened ( drawerView ) ; if ( mCallbacks != null ) mCallbacks . onDrawerOpened ( drawerView ) ; } @ Override public void onDrawerSlide ( View drawerView , float slideOffset ) { super . onDrawerSlide ( drawerView , mConfig . shouldAnimateIndicator ( ) ? slideOffset : 0 ) ; if ( mCallbacks != null ) mCallbacks . onDrawerSlide ( drawerView , slideOffset ) ; } } ; // Defer code dependent on restoration of previous instance state. mDrawerLayout . post ( new Runnable ( ) { @ Override public void run ( ) { mDrawerToggle . syncState ( ) ; } } ) ; mDrawerLayout . setDrawerListener ( mDrawerToggle ) ; } // Setup the drawer shadow mDrawerLayout . setDrawerShadow ( R . drawable . drawer_shadow , GravityCompat . START ) ; }
Setup the navigation drawer layout and whatnot