Class AbstractPowerMenu

    • Constructor Detail

    • Method Detail

      • setFocusable

         void setFocusable(boolean focusable)

        makes focusing only on the menu popup.

        Parameters:
        focusable - focusable or not.
      • showAsDropDown

         void showAsDropDown(View anchor)

        showing the popup menu as drop down to the anchor.

        Parameters:
        anchor - anchor view.
      • showAsDropDown

         void showAsDropDown(View anchor, int xOff, int yOff)

        showing the popup menu as drop down to the anchor with x-off and y-off.

        Parameters:
        anchor - anchor view.
        xOff - x-off,
        yOff - y-off.
      • showAsAnchorLeftTop

         void showAsAnchorLeftTop(View anchor)

        showing the popup menu as left-top aligns to the anchor.

        Parameters:
        anchor - anchor view.
      • showAsAnchorLeftTop

         void showAsAnchorLeftTop(View anchor, int xOff, int yOff)

        showing the popup menu as left-top aligns to the anchor with x-off and y-off.

        Parameters:
        anchor - anchor view.
        xOff - x-off.
        yOff - y-off.
      • showAsAnchorLeftBottom

         void showAsAnchorLeftBottom(View anchor)

        showing the popup menu as left-bottom aligns to the anchor.

        Parameters:
        anchor - anchor view.
      • showAsAnchorLeftBottom

         void showAsAnchorLeftBottom(View anchor, int xOff, int yOff)

        showing the popup menu as left-bottom aligns to the anchor.

        Parameters:
        anchor - anchor view.
        xOff - x-off.
        yOff - y-off.
      • showAsAnchorRightTop

         void showAsAnchorRightTop(View anchor)

        showing the popup menu as right-top aligns to the anchor.

        Parameters:
        anchor - anchor view.
      • showAsAnchorRightTop

         void showAsAnchorRightTop(View anchor, int xOff, int yOff)

        showing the popup menu as right-top aligns to the anchor.

        Parameters:
        anchor - anchor view.
        xOff - x-off.
        yOff - y-off.
      • showAsAnchorRightBottom

         void showAsAnchorRightBottom(View anchor)

        showing the popup menu as right-bottom aligns to the anchor.

        Parameters:
        anchor - anchor view.
      • showAsAnchorRightBottom

         void showAsAnchorRightBottom(View anchor, int xOff, int yOff)

        showing the popup menu as right-bottom aligns to the anchor.

        Parameters:
        anchor - anchor view.
        xOff - x-off.
        yOff - y-off.
      • showAsAnchorCenter

         void showAsAnchorCenter(View anchor)

        showing the popup menu as center align to the anchor.

        Parameters:
        anchor - anchor view.
      • showAsAnchorCenter

         void showAsAnchorCenter(View anchor, int xOff, int yOff)

        showing the popup menu as center align to the anchor.

        Parameters:
        anchor - anchor view.
        xOff - x-off.
        yOff - y-off.
      • showAtCenter

         void showAtCenter(View anchor)

        showing the popup menu as center aligns to the anchor.

        Parameters:
        anchor - anchor view.
      • showAtCenter

         void showAtCenter(View anchor, int xOff, int yOff)

        showing the popup menu as center aligns to the anchor with x-off and y-off.

        Parameters:
        anchor - anchor view.
        xOff - x-off.
        yOff - y-off.
      • showAtLocation

         void showAtLocation(View anchor, int xOff, int yOff)

        showing the popup menu to the specific location to the anchor.

        Parameters:
        anchor - anchor view.
        xOff - x-off.
        yOff - y-off.
      • showAtLocation

         void showAtLocation(View anchor, int gravity, int xOff, int yOff)

        showing the popup menu to the specific location to the anchor with Gravity.

        Parameters:
        anchor - anchor view.
        gravity - gravity of the menu.
        xOff - x-off.
        yOff - y-off.
      • dismiss

         void dismiss()

        dismiss the popup menu.

      • isShowing

         boolean isShowing()

        gets the popup is showing or not.

      • setWidth

         void setWidth(@Px() int width)

        sets the width of the popup menu.

        Parameters:
        width - width of the popup menu.
      • setHeight

         void setHeight(@Px() int height)

        sets the height of the popup menu.

        Parameters:
        height - height of the popup menu.
      • setPadding

         void setPadding(@Px() int padding)

        sets a padding size of the popup menu.

        Parameters:
        padding - padding size.
      • setDividerHeight

         void setDividerHeight(@Px() int height)

        sets the divider height of the popup menu.

        Parameters:
        height - divider height of the popup menu.
      • setDivider

         void setDivider(Drawable divider)

        sets the drawable of the divider.

        Parameters:
        divider - drawable of the divider.
      • setShowBackground

         void setShowBackground(boolean show)

        sets the background is showing or not.

        Parameters:
        show - background is showing or not.
      • setAnimation

         void setAnimation(@NonNull() MenuAnimation menuAnimation)

        sets animations of the popup. It will start up when the popup is showing.

        Parameters:
        menuAnimation - menu animation.
      • setAnimationStyle

         void setAnimationStyle(@StyleRes() int style)

        sets custom animations of the popup. It will start up when the popup is showing.

        Parameters:
        style - custom animation style.
      • setMenuRadius

         void setMenuRadius(@Px() float radius)

        sets the corner radius of the popup menu.

        Parameters:
        radius - corner radius.
      • setMenuShadow

         void setMenuShadow(@Px() float shadow)

        sets the shadow of the popup menu.

        Parameters:
        shadow - shadow value.
      • setIsClipping

         void setIsClipping(boolean isClipping)

        sets the clipping enable or unable.

        Parameters:
        isClipping - clipping enable or unable.
      • setSelection

         void setSelection(int position)

        sets the selected position of the popup menu. It can be used for scrolling as the position.

        Parameters:
        position - selected position.
      • setBackgroundColor

         void setBackgroundColor(@ColorInt() int color)

        sets the color of the background.

        Parameters:
        color - color value.
      • setBackgroundAlpha

         void setBackgroundAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)

        sets the alpha of the background.

        Parameters:
        alpha - alpha value.
      • setBackgroundSystemUiVisibility

         void setBackgroundSystemUiVisibility(int visibility)

        sets system UI visibility flags for backgroundView.

        Parameters:
        visibility - visibility value.
      • setHeaderView

         void setHeaderView(View view)

        sets the header view of the popup menu list.

        Parameters:
        view - View.
      • setHeaderView

         void setHeaderView(View view, Object data, boolean isSelectable)

        sets the header view of the popup menu list.

        Parameters:
        view - View.
        data - Object.
        isSelectable - is selectable or not.
      • setHeaderView

         void setHeaderView(int layout)

        sets the header view of the popup menu using layout.

        Parameters:
        layout - layout.
      • setFooterView

         void setFooterView(View view)

        sets the footer view of the popup menu list.

        Parameters:
        view - View.
      • setFooterView

         void setFooterView(View view, Object data, boolean isSelectable)

        sets the footer view of the popup menu list.

        Parameters:
        view - View.
        data - Object.
        isSelectable - is selectable or not.
      • setFooterView

         void setFooterView(int layout)

        sets the footer view of the popup menu using layout.

        Parameters:
        layout - layout.
      • invokeOnMenuListener

         void invokeOnMenuListener(int position)

        invokes onMenuListener manually.

        Parameters:
        position - the invoked position.
      • getAdapter

         T getAdapter()

        gets the adapter of the popup menu list.

      • addItem

         void addItem(E item)

        add an item.

        Parameters:
        item - item.
      • addItem

         void addItem(int position, E item)

        add an item on a specific position.

        Parameters:
        position - position of the list.
        item - an item.
      • addItemList

         void addItemList(List<E> itemList)

        add an item list.

        Parameters:
        itemList - an item list.
      • setSelectedPosition

         void setSelectedPosition(int position)

        sets the selected item position.

        Parameters:
        position - a selected item position.
      • removeItem

         void removeItem(E item)

        removes an item of the list.

        Parameters:
        item - an item.
      • removeItem

         void removeItem(int position)

        removes an item on a specific position.

        Parameters:
        position - an item position.
      • clearItems

         void clearItems()

        clears all the items of the list.

      • getPreferencePosition

         int getPreferencePosition(int defaultPosition)

        gets the saved preference position from the SharedPreferences.

        Parameters:
        defaultPosition - the default position of the preference.
      • setPreferencePosition

         void setPreferencePosition(int defaultPosition)

        sets the preference position name for persistence.

        Parameters:
        defaultPosition - the default position of the preference.
      • clearPreference

         void clearPreference()

        clears the preference name of PowerMenu.

      • setAutoDismiss

         void setAutoDismiss(boolean autoDismiss)

        sets the auto-dismissing or not.

        The popup menu will be dismissed automatically when the item would be clicked.

        Parameters:
        autoDismiss - is auto-dismissing or not.
      • setDismissIfShowAgain

         void setDismissIfShowAgain(boolean dismissIfShowAgain)

        sets the dismiss action if already popup is showing.

        Parameters:
        dismissIfShowAgain - dismiss if already popup is showing.