protected void buildDrawerSelectionList ( ) { int selectedPosition = - 1 ; int position = 0 ; ArrayList < IDrawerItem > profileDrawerItems = new ArrayList <> ( ) ; if ( mProfiles != null ) { for ( IProfile profile : mProfiles ) { if ( profile == mCurrentProfile ) { if ( mCurrentHiddenInList ) { continue ; } else { selectedPosition = mDrawer . mDrawerBuilder . getItemAdapter ( ) . getGlobalPosition ( position ) ; } } if ( profile instanceof IDrawerItem ) { ( ( IDrawerItem ) profile ) . withSetSelected ( false ) ; profileDrawerItems . add ( ( IDrawerItem ) profile ) ; } position = position + 1 ; } } mDrawer . switchDrawerContent ( onDrawerItemClickListener , onDrawerItemLongClickListener , profileDrawerItems , selectedPosition ) ; }
helper method to build and set the drawer selection list