public class

QuickPopover

extends Object
implements ActionInterfaces.Window.PopupWindowInterface
java.lang.Object
   ↳ com.droidux.pack.action.widget.QuickPopover

Class Overview

A custom view/widget that can be used to display arbitrary view. The popover window is a floating container that appears on top of the current activity. The content view will be displayed within a "callout" window with arrow pointing to the specified location/anchor.

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
QuickPopover(Context context)
QuickPopover(Context context, View content)
Public Methods
void dismiss()
Dispose of the popup window.
View getContentView()
Gets the content of the popover window
boolean isShowing()
Indicates whether the popup window is showing on screen.
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 setContentView(View content)
Sets the content view that will be displayed inside the popover window.
void setOnDismissListener(PopupWindow.OnDismissListener listener)
void show(View parent, int targetXPos, int targetYPos, boolean horizontalArrows)
void show(View anchor, ActionInterfaces.Window.PopupWindowPlacement placement)
Display the content view in a popup window anchored to the anchor view.
void show(View parent, int targetXPos, int targetYPos)
Display the content view in a popup window at the specified location.
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.
[Expand]
Inherited Methods
From class java.lang.Object
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 QuickPopover (Context context)

Since: API Level 2.5

public QuickPopover (Context context, View content)

Since: API Level 2.5

Public Methods

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 View getContentView ()

Since: API Level 2.5

Gets the content of the popover window

Returns
  • The content view of the popover window.

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 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 setContentView (View content)

Since: API Level 2.5

Sets the content view that will be displayed inside the popover window.

Parameters
content The view to be displayed inside the window.

public void setOnDismissListener (PopupWindow.OnDismissListener listener)

Since: API Level

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 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 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)

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.