public static class

ActionDrawer.Builder

extends Object
java.lang.Object
   ↳ com.droidux.pack.action.widget.ActionDrawer.Builder

Class Overview

Use this class to build and customize the action drawer. You need to provide an implementation of the ActionDrawer.Callback interface that create the drawer's view and prepare the drawer's view before it is shown.

Summary

Public Constructors
ActionDrawer.Builder(Activity activity, ActionDrawer.Callback callback)
Public Methods
ActionDrawer build()
Build the action drawer.
ActionDrawer.Builder setArrowBitmap(Bitmap arrow)
Sets the bitmap to use as the arrow to point to an anchor view.
ActionDrawer.Builder setBezelSwipeEnabled(boolean enabled)
Sets whether the bezel swipe is enabled.
ActionDrawer.Builder setBezelSwipeWidth(int width)
Sets the distance from the bezel within which the bezel swipe will be activated.
ActionDrawer.Builder setDrawerMode(ActionDrawer.DrawerMode mode)
Sets whether the action drawer should be overlaid by content (CONTENT_OVERLAY) or the whole view/window (WINDOW_OVERLAY).
ActionDrawer.Builder setDrawerOnTop(boolean onTop)
Whether to draw the drawer on top or behind the content.
ActionDrawer.Builder setDrawerPosition(ActionDrawer.DrawerPosition position)
Sets the position of the drawer, either LEFT or RIGHT
ActionDrawer.Builder setDrawerWidth(float pixelsOrRatio)
Sets the drawer's width, in pixels or in ratio.
ActionDrawer.Builder setShadowDrawable(int shadowResId)
Sets the drawable to use as the drop shadow.
ActionDrawer.Builder setShadowDrawable(Drawable shadow)
Sets the drawable to use as the drop shadow.
ActionDrawer.Builder setShadowEnabled(boolean enable)
Enable or disable drawing of the drop shadow.
ActionDrawer.Builder setShadowWidth(int pixels)
Sets the width of the drop shadow.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ActionDrawer.Builder (Activity activity, ActionDrawer.Callback callback)

Since: API Level 2.5

Public Methods

public ActionDrawer build ()

Since: API Level 2.5

Build the action drawer.

Important: If you set the drawer's mode to CONTENT_OVERLAY, you need to call the setContentView(int), or its variants, before building the action drawer.

public ActionDrawer.Builder setArrowBitmap (Bitmap arrow)

Since: API Level 2.5

Sets the bitmap to use as the arrow to point to an anchor view. See setArrowAnchor(android.view.View).

Parameters
arrow The arrow bitmap.

public ActionDrawer.Builder setBezelSwipeEnabled (boolean enabled)

Since: API Level 2.5

Sets whether the bezel swipe is enabled. Bezel swipe is a swipe gesture that starts outside the phone UI ie. on the phone's bezel. To set the width of the bezel, call setBezelSwipeWidth(int)

Parameters
enabled If true, the bezel swipe is enabled. Otherwise, it's disabled.

public ActionDrawer.Builder setBezelSwipeWidth (int width)

Since: API Level 2.5

Sets the distance from the bezel within which the bezel swipe will be activated.

Parameters
width The bezel width. Default is 24dp.

public ActionDrawer.Builder setDrawerMode (ActionDrawer.DrawerMode mode)

Since: API Level 2.5

Sets whether the action drawer should be overlaid by content (CONTENT_OVERLAY) or the whole view/window (WINDOW_OVERLAY).

Parameters
mode The action drawer mode.

public ActionDrawer.Builder setDrawerOnTop (boolean onTop)

Since: API Level 2.5

Whether to draw the drawer on top or behind the content.

Parameters
onTop If true, the drawer will be drawn on top of the content. Default is false

public ActionDrawer.Builder setDrawerPosition (ActionDrawer.DrawerPosition position)

Since: API Level 2.5

Sets the position of the drawer, either LEFT or RIGHT

Parameters
position The position of the action drawer.

public ActionDrawer.Builder setDrawerWidth (float pixelsOrRatio)

Since: API Level 2.5

Sets the drawer's width, in pixels or in ratio.

Parameters
pixelsOrRatio If > 1.0, the drawer's width will be set to the specified value. If between 0.0 - 1.0, the width will be set to (pixelsToRatio * contentView.width). Default is 0.8.

public ActionDrawer.Builder setShadowDrawable (int shadowResId)

Since: API Level 2.5

Sets the drawable to use as the drop shadow. The resource should refer to a Drawable. If the setShadowEnabled(boolean) is set to true, and the shadow drawable is set to null, a default drawable will be used.

Parameters
shadowResId The identifier of the resource

public ActionDrawer.Builder setShadowDrawable (Drawable shadow)

Since: API Level 2.5

Sets the drawable to use as the drop shadow. The resource should refer to a Drawable. If the setShadowEnabled(boolean) is set to true, and the shadow drawable is set to null, a default drawable will be used.

Parameters
shadow The Drawable to use as the drop shadow.

public ActionDrawer.Builder setShadowEnabled (boolean enable)

Since: API Level 2.5

Enable or disable drawing of the drop shadow. If drawing drop shadow is enabled, and the shadow drawable is set to null (setShadowDrawable(android.graphics.drawable.Drawable), a default drawable will be used.

Parameters
enable If true, a drop shadow will be drawn.

public ActionDrawer.Builder setShadowWidth (int pixels)

Since: API Level 2.5

Sets the width of the drop shadow.

Parameters
pixels The width in pixels.