public class

LegacyActionDrawerToggle

extends Object
implements ActionDrawer.OnDrawerStateChangeListener ActionDrawer.OnDrawingListener
java.lang.Object
   ↳ com.droidux.ui.widgets.actiondrawer.LegacyActionDrawerToggle

This class is deprecated.
Please use ActionDrawerToggle for compatibility with the "material" design (Android 5.0 Lollipop, or AppCompat v7 r21+). This class provides a handy way to tie together the functionality of ActionDrawer and the framework ActionBar to implement the recommended design for navigation drawers.

To use ActionDrawerToggle, create one in your Activity and call through to the following methods corresponding to your Activity callbacks:

Call syncState() from your Activity's onPostCreate to synchronize the indicator with the state of the linked ActionDrawer.

If the drawer's mode is set to WINDOW_OVERLAY, you must also call the onSaveInstanceState() and onRestoreInstanceState(android.os.Parcelable) in the Activity's onSaveInstanceState(android.os.Bundle) and onRestoreInstanceState(android.os.Parcelable). If the drawer's mode is set to CONTENT_OVERLAY, the drawer state will be automatically saved and restored.

ActionDrawerToggle can be used directly as a ActionDrawer.OnDrawingListener, or if you are already providing your own listener, call through to each of the listener methods from your own.

Summary

Constants
float TOGGLE_DRAWABLE_OFFSET
Public Constructors
LegacyActionDrawerToggle(Activity activity, ActionDrawer drawer, int drawerImageRes, int openDrawerContentDescRes, int closeDrawerContentDescRes)
LegacyActionDrawerToggle(Activity activity, ActionDrawer drawer, boolean animate, int drawerImageRes, int openDrawerContentDescRes, int closeDrawerContentDescRes)
Public Methods
boolean isDrawerIndicatorEnabled()
Whether the drawer indicator is enabled.
void onConfigurationChanged(Configuration newConfig)
This method should always be called by your Activity's onConfigurationChanged method.
boolean onOptionsItemSelected(MenuItem item)
This method should be called by your Activity's onOptionsItemSelected method.
void setDrawerIndicatorEnabled(boolean enable)
Enable or disable the drawer indicator.
void syncState()
Synchronize the state of the drawer indicator/affordance with the linked ActionDrawer.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.droidux.ui.widgets.actiondrawer.ActionDrawer.OnDrawerStateChangeListener
From interface com.droidux.ui.widgets.actiondrawer.ActionDrawer.OnDrawingListener

Constants

public static final float TOGGLE_DRAWABLE_OFFSET

Since: API Level 3.1

Constant Value: 0.33333334

Public Constructors

public LegacyActionDrawerToggle (Activity activity, ActionDrawer drawer, int drawerImageRes, int openDrawerContentDescRes, int closeDrawerContentDescRes)

Since: API Level 3.1

public LegacyActionDrawerToggle (Activity activity, ActionDrawer drawer, boolean animate, int drawerImageRes, int openDrawerContentDescRes, int closeDrawerContentDescRes)

Since: API Level 3.1

Public Methods

public boolean isDrawerIndicatorEnabled ()

Since: API Level 3.1

Whether the drawer indicator is enabled.

Returns
  • true if the enhanced drawer indicator is enabled, false otherwise

public void onConfigurationChanged (Configuration newConfig)

Since: API Level 3.1

This method should always be called by your Activity's onConfigurationChanged method.

Parameters
newConfig The new configuration

public boolean onOptionsItemSelected (MenuItem item)

Since: API Level 3.1

This method should be called by your Activity's onOptionsItemSelected method. If it returns true, your onOptionsItemSelected method should return true and skip further processing.

Parameters
item the MenuItem instance representing the selected menu item
Returns
  • true if the event was handled and further processing should not occur

public void setDrawerIndicatorEnabled (boolean enable)

Since: API Level 3.1

Enable or disable the drawer indicator. The indicator defaults to enabled.

When the indicator is disabled, the ActionBar will revert to displaying the home-as-up indicator provided by the Activity's theme in the android.R.attr.homeAsUpIndicator attribute instead of the animated drawer glyph.

Parameters
enable true to enable, false to disable

public void syncState ()

Since: API Level 3.1

Synchronize the state of the drawer indicator/affordance with the linked ActionDrawer.

This should be called from your Activity's onPostCreate method to synchronize after the ActionDrawer'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.)