net.simonvt.widget
Class MenuDrawerManager

java.lang.Object
  extended by net.simonvt.widget.MenuDrawerManager

public class MenuDrawerManager
extends Object


Constructor Summary
MenuDrawerManager(android.app.Activity activity, int dragMode)
          Constructor to use when creating the menu drawer.
MenuDrawerManager(android.app.Activity activity, int dragMode, int gravity)
          Constructor to use when creating the menu drawer.
 
Method Summary
 void closeMenu()
          Closes the menu.
 void closeMenu(boolean animate)
          Closes the menu.
 int getDrawerState()
          Returns the state of the drawer.
 MenuDrawer getMenuDrawer()
          Returns the MenuDrawer layout.
 android.view.View getMenuView()
          Returns the menu view.
 boolean isMenuVisible()
          Indicates whether the menu is currently visible.
 void onRestoreDrawerState(android.os.Parcelable in)
          Called to restore the MenuDrawer's state that has previously been generated with onSaveDrawerState().
 android.os.Parcelable onSaveDrawerState()
          Returns the views current state.
 void openMenu()
          Opens the menu.
 void openMenu(boolean animate)
          Opens the menu.
 void setActiveView(android.view.View v)
          Set the active view.
 void setActiveView(android.view.View v, int position)
          Set the active view.
 void setContentView(int layoutResId)
          Set the content from a layout resource.
 void setContentView(android.view.View view)
          Set the content to an explicit view.
 void setContentView(android.view.View view, android.view.ViewGroup.LayoutParams params)
          Set the content to an explicit view.
 void setMenuView(int layoutResId)
          Set the menu view from a layout resource.
 void setMenuView(android.view.View view)
          Set the menu view to an explicit view.
 void setMenuView(android.view.View view, android.view.ViewGroup.LayoutParams params)
          Set the menu view to an explicit view.
 void toggleMenu()
          Toggles the menu open and close.
 void toggleMenu(boolean animate)
          Toggles the menu open and close.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuDrawerManager

public MenuDrawerManager(android.app.Activity activity,
                         int dragMode)
Constructor to use when creating the menu drawer.

Parameters:
activity - The activity the menu drawer will be attached to.
dragMode - The drag mode of the drawer. Can be either MenuDrawer.MENU_DRAG_CONTENT or MenuDrawer.MENU_DRAG_WINDOW.

MenuDrawerManager

public MenuDrawerManager(android.app.Activity activity,
                         int dragMode,
                         int gravity)
Constructor to use when creating the menu drawer.

Parameters:
activity - The activity the menu drawer will be attached to.
dragMode - The drag mode of the drawer. Can be either MenuDrawer.MENU_DRAG_CONTENT or MenuDrawer.MENU_DRAG_WINDOW.
gravity - Where to position the menu. Can be either MenuDrawer.MENU_POSITION_LEFT or MenuDrawer.MENU_POSITION_RIGHT.
Method Detail

getMenuDrawer

public MenuDrawer getMenuDrawer()
Returns the MenuDrawer layout.

Returns:
The MenuDrawer layout.

setActiveView

public void setActiveView(android.view.View v)
Set the active view. If the mdArrowDrawable attribute is set, this View will have an arrow drawn next to it.

Parameters:
v - The active view.

setActiveView

public void setActiveView(android.view.View v,
                          int position)
Set the active view. If the mdArrowDrawable attribute is set, this View will have an arrow drawn next to it.

Parameters:
v - The active view.
position - Optional position, usually used with ListView. v.setTag(R.id.mdActiveViewPosition, position) must be called first.

toggleMenu

public void toggleMenu()
Toggles the menu open and close.


toggleMenu

public void toggleMenu(boolean animate)
Toggles the menu open and close.

Parameters:
animate - Whether open/close should be animated.

openMenu

public void openMenu()
Opens the menu.


openMenu

public void openMenu(boolean animate)
Opens the menu.

Parameters:
animate - Whether open/close should be animated.

closeMenu

public void closeMenu()
Closes the menu.


closeMenu

public void closeMenu(boolean animate)
Closes the menu.

Parameters:
animate - Whether open/close should be animated.

isMenuVisible

public boolean isMenuVisible()
Indicates whether the menu is currently visible.

Returns:
True if the menu is open, false otherwise.

getDrawerState

public int getDrawerState()
Returns the state of the drawer. Can be one of MenuDrawer.STATE_CLOSED, MenuDrawer.STATE_CLOSING, MenuDrawer.STATE_DRAGGING, MenuDrawer.STATE_OPENING or MenuDrawer.STATE_OPEN.

Returns:
The drawers state.

setMenuView

public void setMenuView(int layoutResId)
Set the menu view from a layout resource.

Parameters:
layoutResId - Resource ID to be inflated.

setMenuView

public void setMenuView(android.view.View view)
Set the menu view to an explicit view.

Parameters:
view - The menu view.

setMenuView

public void setMenuView(android.view.View view,
                        android.view.ViewGroup.LayoutParams params)
Set the menu view to an explicit view.

Parameters:
view - The menu view.
params - Layout parameters for the view.

getMenuView

public android.view.View getMenuView()
Returns the menu view.

Returns:
The menu view.

setContentView

public void setContentView(int layoutResId)
Set the content from a layout resource.

Parameters:
layoutResId - Resource ID to be inflated.

setContentView

public void setContentView(android.view.View view)
Set the content to an explicit view.

Parameters:
view - The desired content to display.

setContentView

public void setContentView(android.view.View view,
                           android.view.ViewGroup.LayoutParams params)
Set the content to an explicit view.

Parameters:
view - The desired content to display.
params - Layout parameters for the view.

onSaveDrawerState

public android.os.Parcelable onSaveDrawerState()
Returns the views current state.

Returns:
Returns a Parcelable object containing the MenuDrawer's current state.

onRestoreDrawerState

public void onRestoreDrawerState(android.os.Parcelable in)
Called to restore the MenuDrawer's state that has previously been generated with onSaveDrawerState().

Parameters:
in - The state that had previously been returned by onSaveDrawerState().


Copyright © 2012. All Rights Reserved.