@Override public boolean onOptionsItemSelected(MenuItem item) { for (DrawerToggle toggles : mListToggles) { toggles.onOptionsItemSelected(item); } return false; }
/** * Synchronize the state of the drawer indicator/affordance with the linked DrawerLayout. * * <p>This should be called from your <code>Activity</code>'s {@link * Activity#onPostCreate(android.os.Bundle) onPostCreate} method to synchronize after the * DrawerLayout's instance state has been restored, and any other time when the state may have * diverged in such a way that the ActionBarDrawerToggle was not notified. (For example, if you * stop forwarding appropriate drawer events for a period of time.) */ public void syncState() { if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mSlider.setPosition(1); } else { mSlider.setPosition(0); } if (mDrawerIndicatorEnabled) { setActionBarUpIndicator( (Drawable) mSlider, mDrawerLayout.isDrawerOpen(GravityCompat.START) ? mCloseDrawerContentDescRes : mOpenDrawerContentDescRes); } }
/** * {@link DrawerLayout.DrawerListener} callback method. If you do not use your * ActionBarDrawerToggle instance directly as your DrawerLayout's listener, you should call * through to this method from your own listener object. * * @param drawerView Drawer view that is now closed */ @Override public void onDrawerClosed(View drawerView) { mSlider.setPosition(0); if (mDrawerIndicatorEnabled) { setActionBarDescription(mOpenDrawerContentDescRes); } }
@Override public void release() { for (DrawerToggle toggle : mListToggles) { toggle.release(); } }
@Override public void syncState() { for (DrawerToggle toggle : mListToggles) { toggle.syncState(); } }
@Override public void onDrawerStateChanged(int newState) { for (DrawerToggle toggle : mListToggles) { toggle.onDrawerStateChanged(newState); } }
@Override public void onDrawerSlide(View drawerView, float slideOffset) { for (DrawerToggle toggle : mListToggles) { toggle.onDrawerSlide(drawerView, slideOffset); } }
@Override public void onDrawerOpened(View drawerView) { for (DrawerToggle toggle : mListToggles) { toggle.onDrawerOpened(drawerView); } }
@Override public void onDrawerClosed(View drawerView) { for (DrawerToggle toggles : mListToggles) { toggles.onDrawerClosed(drawerView); } }
@Override public void onConfigurationChanged(Configuration newConfig) { for (DrawerToggle toggle : mListToggles) { toggle.onConfigurationChanged(newConfig); } }
public DrawerToggle removePartnerToggleAtIndex(int index) { DrawerToggle toggle = mListToggles.remove(index); if (toggle != null) toggle.release(); return mListToggles.remove(index); }
public boolean removePartnerToggle(DrawerToggle toggle) { if (toggle != null) toggle.release(); return mListToggles.remove(toggle); }
/** * {@link DrawerLayout.DrawerListener} callback method. If you do not use your * ActionBarDrawerToggle instance directly as your DrawerLayout's listener, you should call * through to this method from your own listener object. * * @param drawerView The child view that was moved * @param slideOffset The new offset of this drawer within its range, from 0-1 */ @Override public void onDrawerSlide(View drawerView, float slideOffset) { mSlider.setPosition(Math.min(1f, Math.max(0, slideOffset))); }