java.lang.Object
   ↳ com.droidux.pack.action.widget.QuickActionList

Class Overview

A custom view/widget that shows a list of action items. This widget has similar functionalities to the DropDownMenu, but it has a lot more features and better performance, such as the option to show the callout arrows horizontally/vertically and semi-transparent background. We recommend to use this widget as a replacement for the DropDownMenu.

Summary

Constants
int ANIM_AUTO Automatically determine the appropriate animation based on the popup window location.
int ANIM_FADE Fade animation.
int ANIM_GROW_FROM_CENTER Grow from center.
int ANIM_GROW_FROM_LEFT Grow from left.
int ANIM_GROW_FROM_RIGHT Grow from right.
int ANIM_NONE No animation.
Public Constructors
QuickActionList(Context context)
Public Methods
ActionInterfaces.Layout.ActionLayoutInterface beginLayout()
Prepare the widget to start the layout process.
void dismiss()
Dispose of the popup window.
boolean isShowing()
Indicates whether the popup window is showing on screen.
abstract void onEndLayout(ActionInterfaces.Layout.ActionLayoutInterface layout)
void resetCalloutDrawables()
Resets the callout drawables to defaults.
void setAnimationStyle(int animStyle)
Sets the animation used when the window is showing or closing.
void setCalloutDrawables(int baseId, int leftArrowId, int topArrowId, int rightArrowId, int bottomArrowId, Rect offsets, boolean unitsInDp)
Sets the drawables for the callout.
void setCalloutDrawables(int baseId, int leftArrowId, int topArrowId, int rightArrowId, int bottomArrowId, Rect offsets)
Sets the drawables for the callout.
void setCalloutTintColor(int tint)
Sets the tint color of the callout drawables.
void setDismissOnClick(boolean dismiss)
Sets whether to dismiss the window when the user click on an action item.
void setDismissOnClick(boolean dismiss, int delay)
Sets whether to dismiss the window when the user click on an action item.
void setOnDismissListener(PopupWindow.OnDismissListener listener)
Sets the listener to be notified when the window is dismissed.
void setTitle(String title)
Sets the title of the window.
void show(View parent, int targetXPos, int targetYPos, boolean horizontalArrows)
void show(View parent, int targetXPos, int targetYPos)
Display the content view in a popup window at the specified location.
void show(View anchor, ActionInterfaces.Window.PopupWindowPlacement placement)
Display the content view in a popup window anchored to the anchor view.
void show(View anchor)
Display the content view in a popup window anchored to the anchor view.
void show(View anchor, boolean horizontalArrows)
void show(View parent, int targetXPos, int targetYPos, ActionInterfaces.Window.PopupWindowPlacement placement)
Display the content view in a popup window anchored to the anchor view.
Protected Methods
abstract void createContentView()
abstract ViewGroup createRootView()
int getCalloutBaseId()
Gets the drawable of the base of the callout background.
int getCalloutBottomArrowId()
Gets the drawable of the bottom arrow of the callout background.
int getCalloutLeftArrowId()
Gets the drawable of the left arrow of the callout background.
Rect getCalloutOffsets()
Gets the offsets between the arrows and the base.
int getCalloutRightArrowId()
Gets the drawable of the right arrow of the callout background.
int getCalloutTopArrowId()
Gets the drawable of the top arrow of the callout background.
abstract int getContentLayoutId()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.droidux.pack.action.interfaces.ActionInterfaces.Window.ActionWindowInterface
From interface com.droidux.pack.action.interfaces.ActionInterfaces.Window.PopupWindowInterface

Constants

public static final int ANIM_AUTO

Since: API Level

Automatically determine the appropriate animation based on the popup window location.

Constant Value: 4 (0x00000004)

public static final int ANIM_FADE

Since: API Level

Fade animation.

Constant Value: 5 (0x00000005)

public static final int ANIM_GROW_FROM_CENTER

Since: API Level

Grow from center.

Constant Value: 3 (0x00000003)

public static final int ANIM_GROW_FROM_LEFT

Since: API Level

Grow from left.

Constant Value: 1 (0x00000001)

public static final int ANIM_GROW_FROM_RIGHT

Since: API Level

Grow from right.

Constant Value: 2 (0x00000002)

public static final int ANIM_NONE

Since: API Level

No animation.

Constant Value: 0 (0x00000000)

Public Constructors

public QuickActionList (Context context)

Since: API Level 2.5

Public Methods

public ActionInterfaces.Layout.ActionLayoutInterface beginLayout ()

Since: API Level

Prepare the widget to start the layout process. Call the endLayout() to complete the process.

public void dismiss ()

Since: API Level

Dispose of the popup window. If the popup window has not been shown, calling this method will have no effect.

public boolean isShowing ()

Since: API Level

Indicates whether the popup window is showing on screen.

Returns
  • true if the popup is showing, false otherwise

public abstract void onEndLayout (ActionInterfaces.Layout.ActionLayoutInterface layout)

Since: API Level

public void resetCalloutDrawables ()

Since: API Level

Resets the callout drawables to defaults.

public void setAnimationStyle (int animStyle)

Since: API Level

Sets the animation used when the window is showing or closing.

Parameters
animStyle The constants representing the animation, e.g. ANIM_AUTO, ANIM_FADE, etc.

public void setCalloutDrawables (int baseId, int leftArrowId, int topArrowId, int rightArrowId, int bottomArrowId, Rect offsets, boolean unitsInDp)

Since: API Level

Sets the drawables for the callout. The callout consist of a base (should be a nine-patch drawable) and 4 arrows (left, top, right, bottom). To form the callout the base drawable will be merged with one of the arrows, depending on which direction the arrow should point to. In order to merge the base and the arrow correctly, you have to provide the offset/distance between the border of the base drawable to the base of the arrow drawable.

Parameters
baseId The resource id for the base drawable.
leftArrowId The resource id for the left arrow drawable.
topArrowId The resource id for the top arrow drawable.
rightArrowId The resource id for the right arrow drawable.
bottomArrowId The resource id for the bottom arrow drawable.
offsets The offset/distance between the border of the base/rect drawable to the baseline of the arrow drawable.
unitsInDp If true the given offsets are assumed to be in dip unit. Otherwise, the unit is in pixels.

public void setCalloutDrawables (int baseId, int leftArrowId, int topArrowId, int rightArrowId, int bottomArrowId, Rect offsets)

Since: API Level

Sets the drawables for the callout. The callout consist of a base (should be a nine-patch drawable) and 4 arrows (left, top, right, bottom). To form the callout the base drawable will be merged with one of the arrows, depending on which direction the arrow should point to. In order to merge the base and the arrow correctly, you have to provide the offset/distance between the border of the base drawable to the base of the arrow drawable.

Parameters
baseId The resource id for the base drawable.
leftArrowId The resource id for the left arrow drawable.
topArrowId The resource id for the top arrow drawable.
rightArrowId The resource id for the right arrow drawable.
bottomArrowId The resource id for the bottom arrow drawable.
offsets The offset/distance between the border of the base/rect drawable to the baseline of the arrow drawable. The offsets are in dip unit.

public void setCalloutTintColor (int tint)

Since: API Level

Sets the tint color of the callout drawables.

Parameters
tint The tint color to be applied to the callout drawables.

public void setDismissOnClick (boolean dismiss)

Since: API Level

Sets whether to dismiss the window when the user click on an action item.

Parameters
dismiss If true, dismiss the window after the click.

public void setDismissOnClick (boolean dismiss, int delay)

Since: API Level

Sets whether to dismiss the window when the user click on an action item.

Parameters
dismiss If true, dismiss the window after the click.
delay Delay time (in millisecond) before dismissing the window.

public void setOnDismissListener (PopupWindow.OnDismissListener listener)

Since: API Level

Sets the listener to be notified when the window is dismissed.

Parameters
listener The listener to be notified.

public void setTitle (String title)

Since: API Level

Sets the title of the window.

Parameters
title The title of the window. This can be null, to hide the title.

public void show (View parent, int targetXPos, int targetYPos, boolean horizontalArrows)

Since: API Level

This method is deprecated.
Use show(android.view.View, int, int, com.droidux.pack.action.interfaces.ActionInterfaces.Window.PopupWindowPlacement) instead.

Display the content view in a popup window at the specified location. The popup window can be displayed above, below, left or right of the anchor view, depending on the available space that can contain the window size, and the value of the horizontalArrows parameter.

Parameters
parent The view which the window will be anchored to.
targetXPos The X coordinate of the location where the popup should be displayed.
targetYPos The Y coordinate of the location where the popup should be displayed.
horizontalArrows If true, the arrows of the callout background will have horizontal orientation (left/right). By default, the arrows have vertical orientation (top/bottom).

public void show (View parent, int targetXPos, int targetYPos)

Since: API Level

Display the content view in a popup window at the specified location.

Parameters
parent a parent view to get the getWindowToken() token from
targetXPos the popup x location. This should be a raw value. See MotionEvent.getRawX().
targetYPos the popup y location. This should be a raw value. See MotionEvent.getRawY().

public void show (View anchor, ActionInterfaces.Window.PopupWindowPlacement placement)

Since: API Level

Display the content view in a popup window anchored to the anchor view. The popup window can be displayed above, below, left or right of the anchor view, depending on the available space that can contain the window size, and the value of the placement parameter.

Parameters
anchor The view which the window will be anchored to.
placement The preferred placement of the popup window (above, below, left or right). If the requested placement can't be satisfied, e.g. due to space constraint, it will try to automatically place the popup window where it can fit. For example, if BELOW or ABOVE can't be satisfied, it will try with VERTICAL_AUTO. And if LEFT or RIGHT can' be satisfied, it will try HORIZONTAL_AUTO.

public void show (View anchor)

Since: API Level

Display the content view in a popup window anchored to the anchor view. The popup window can be displayed above or below the anchor view depends on the available space that can contain the window size.

Parameters
anchor The view which the window will be anchored to.

public void show (View anchor, boolean horizontalArrows)

Since: API Level

This method is deprecated.
Use show(android.view.View, com.droidux.pack.action.interfaces.ActionInterfaces.Window.PopupWindowPlacement) instead.

Display the content view in a popup window anchored to the anchor view. The popup window can be displayed above, below, left or right of the anchor view, depending on the available space that can contain the window size, and the value of the horizontalArrows parameter.

Parameters
anchor The view which the window will be anchored to.
horizontalArrows If true, the arrows of the callout background will have horizontal orientation (left/right). By default, the arrows have vertical orientation (top/bottom).

public void show (View parent, int targetXPos, int targetYPos, ActionInterfaces.Window.PopupWindowPlacement placement)

Since: API Level

Display the content view in a popup window anchored to the anchor view. The popup window can be displayed above, below, left or right of the anchor view, depending on the available space that can contain the window size, and the value of the placement parameter.

Parameters
parent The view which the window will be anchored to.
targetXPos The X coordinate of the location where the popup should be displayed.
targetYPos The Y coordinate of the location where the popup should be displayed.
placement The preferred placement of the popup window (above, below, left or right). If the requested placement can't be satisfied, e.g. due to space constraint, it will try to automatically place the popup window where it can fit. For example, if BELOW or ABOVE can't be satisfied, it will try with VERTICAL_AUTO. And if LEFT or RIGHT can' be satisfied, it will try HORIZONTAL_AUTO.

Protected Methods

protected abstract void createContentView ()

Since: API Level

protected abstract ViewGroup createRootView ()

Since: API Level

protected int getCalloutBaseId ()

Since: API Level

Gets the drawable of the base of the callout background. You can override this method to return your own callout background.

Returns
  • the Id of the drawable.

protected int getCalloutBottomArrowId ()

Since: API Level

Gets the drawable of the bottom arrow of the callout background. You can override this method to return your own callout background.

Returns
  • the Id of the drawable.

protected int getCalloutLeftArrowId ()

Since: API Level

Gets the drawable of the left arrow of the callout background. You can override this method to return your own callout background.

Returns
  • the Id of the drawable.

protected Rect getCalloutOffsets ()

Since: API Level

Gets the offsets between the arrows and the base. You can override this method to return your own callout background.

Returns
  • the Id of the drawable.

protected int getCalloutRightArrowId ()

Since: API Level

Gets the drawable of the right arrow of the callout background. You can override this method to return your own callout background.

Returns
  • the Id of the drawable.

protected int getCalloutTopArrowId ()

Since: API Level

Gets the drawable of the top arrow of the callout background.

Returns
  • the Id of the drawable.

protected abstract int getContentLayoutId ()

Since: API Level