public static class CustomPowerMenu.Builder<T,E extends MenuBaseAdapter<T>> extends AbstractMenuBuilder
CustomPowerMenu
.animationStyle, autoDismiss, backgroundAlpha, backgroundClickListener, backgroundColor, circularEffect, context, defaultPosition, divider, dividerHeight, focusable, footerView, headerView, height, initializeRule, isClipping, layoutInflater, lifecycleOwner, menuAnimation, menuRadius, menuShadow, onDismissedListener, preferenceName, selected, showBackground, width
Constructor and Description |
---|
Builder(android.content.Context context,
E adapter) |
Modifier and Type | Method and Description |
---|---|
CustomPowerMenu.Builder |
addItem(int position,
java.lang.Object item)
adds an
PowerMenuItem item to the popup menu list at position. |
CustomPowerMenu.Builder |
addItem(java.lang.Object item)
adds an
PowerMenuItem item to the popup menu list. |
CustomPowerMenu.Builder |
addItemList(java.util.List<T> itemList)
adds a list of the
PowerMenuItem item to the popup menu list. |
CustomPowerMenu |
build() |
CustomPowerMenu.Builder |
setAnimation(MenuAnimation menuAnimation)
sets the menu animation to the popup.
|
CustomPowerMenu.Builder |
setAnimationStyle(int style)
sets the customized menu animation using resource.
|
CustomPowerMenu.Builder |
setAutoDismiss(boolean autoDismiss)
sets the dismissing automatically when the menu item is clicked.
|
CustomPowerMenu.Builder |
setBackgroundAlpha(float alpha)
sets the alpha of the background popup.
|
CustomPowerMenu.Builder |
setBackgroundColor(int color)
sets the color of the background popup.
|
CustomPowerMenu.Builder |
setBackgroundColorResource(int color)
sets the color of the background popup.
|
CustomPowerMenu.Builder |
setCircularEffect(CircularEffect circularEffect)
sets the circular revealed effect using
CircularEffect . |
CustomPowerMenu.Builder |
setDivider(android.graphics.drawable.Drawable divider)
sets the divider
Drawable between the menu items. |
CustomPowerMenu.Builder |
setDividerHeight(int height)
sets the divider height between the menu items.
|
CustomPowerMenu.Builder |
setFocusable(boolean focusable)
sets the focusability of the popup menu.
|
CustomPowerMenu.Builder |
setFooterView(int footerView)
sets the footer view by layout resource.
|
CustomPowerMenu.Builder |
setFooterView(android.view.View footerView)
sets the footer view by layout view.
|
CustomPowerMenu.Builder |
setHeaderView(int headerView)
sets the header view by layout resource.
|
CustomPowerMenu.Builder |
setHeaderView(android.view.View headerView)
sets the header view by layout view.
|
CustomPowerMenu.Builder |
setHeight(int height)
sets the height size of the popup menu.
|
CustomPowerMenu.Builder |
setInitializeRule(androidx.lifecycle.Lifecycle.Event event,
int defaultPosition)
sets the initialization rule of the recovering persisted position.
|
CustomPowerMenu.Builder |
setIsClipping(boolean isClipping)
sets the clipping or not of the popup menu.
|
CustomPowerMenu.Builder |
setLifecycleOwner(androidx.lifecycle.LifecycleOwner lifecycleOwner)
sets the
LifecycleOwner for dismissing automatically when the LifecycleOwner
is destroyed. |
CustomPowerMenu.Builder |
setMenuRadius(float radius)
sets the corner radius of the popup menu.
|
CustomPowerMenu.Builder |
setMenuShadow(float shadow)
sets the shadow of the popup menu.
|
CustomPowerMenu.Builder |
setOnBackgroundClickListener(android.view.View.OnClickListener onBackgroundClickListener)
sets the
View.OnClickListener to the popup. |
CustomPowerMenu.Builder |
setOnDismissListener(OnDismissedListener onDismissListener)
sets the
OnDismissedListener to the popup. |
CustomPowerMenu.Builder |
setOnMenuItemClickListener(java.lang.Object menuItemClickListener)
sets the
OnMenuItemClickListener to the popup. |
CustomPowerMenu.Builder |
setPreferenceName(java.lang.String preferenceName)
sets the preference name of the popup menu.
|
CustomPowerMenu.Builder |
setSelected(int position)
sets the initialized selected effect menu item position.
|
CustomPowerMenu.Builder |
setShowBackground(boolean show)
sets the visibility of the background popup.
|
CustomPowerMenu.Builder |
setSize(int width,
int height)
sets the width and height size of the popup menu.
|
CustomPowerMenu.Builder |
setWidth(int width)
sets the width size of the popup menu.
|
public Builder(@NonNull android.content.Context context, @NonNull E adapter)
public CustomPowerMenu.Builder setLifecycleOwner(@NonNull androidx.lifecycle.LifecycleOwner lifecycleOwner)
LifecycleOwner
for dismissing automatically when the LifecycleOwner
is destroyed. It will prevents memory leak.lifecycleOwner
- lifecycle ownerCustomPowerMenu.Builder
.public CustomPowerMenu.Builder setShowBackground(boolean show)
show
- visibility of the background popup.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setOnMenuItemClickListener(java.lang.Object menuItemClickListener)
OnMenuItemClickListener
to the popup.menuItemClickListener
- OnMenuItemClickListener
interface.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setOnBackgroundClickListener(android.view.View.OnClickListener onBackgroundClickListener)
View.OnClickListener
to the popup.onBackgroundClickListener
- View.OnClickListener
interface.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setOnDismissListener(OnDismissedListener onDismissListener)
OnDismissedListener
to the popup.onDismissListener
- OnDismissedListener
interface.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setHeaderView(@LayoutRes int headerView)
headerView
- layout resourceCustomPowerMenu.Builder
.public CustomPowerMenu.Builder setHeaderView(android.view.View headerView)
headerView
- header view.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setFooterView(@LayoutRes int footerView)
footerView
- footer view.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setFooterView(android.view.View footerView)
footerView
- footer view.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setAnimation(@NonNull MenuAnimation menuAnimation)
menuAnimation
- animation.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setAnimationStyle(int style)
style
- animation resource.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setMenuRadius(float radius)
radius
- corner radius.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setMenuShadow(float shadow)
shadow
- popup shadow.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setWidth(int width)
width
- width size.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setHeight(int height)
height
- height size.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setSize(int width, int height)
width
- width size.height
- height size.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setDividerHeight(int height)
height
- divider height between the menu items.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setDivider(android.graphics.drawable.Drawable divider)
Drawable
between the menu items.divider
- divider Drawable
between the menu items.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setBackgroundColor(int color)
color
- color of the background popup.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setBackgroundColorResource(int color)
color
- color of the background popup by resource.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setBackgroundAlpha(float alpha)
alpha
- alpha of the background popup.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setFocusable(boolean focusable)
focusable
- focusability of the popup menu.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setSelected(int position)
position
- initialized selected effect menu item position.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setIsClipping(boolean isClipping)
isClipping
- clipping or not of the popup menu.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setAutoDismiss(boolean autoDismiss)
autoDismiss
- dismissing automatically when the menu item is clicked.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder addItem(java.lang.Object item)
PowerMenuItem
item to the popup menu list.item
- PowerMenuItem
item.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder addItem(int position, java.lang.Object item)
PowerMenuItem
item to the popup menu list at position.position
- specific position.item
- PowerMenuItem
item.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder addItemList(java.util.List<T> itemList)
PowerMenuItem
item to the popup menu list.itemList
- list of the PowerMenuItem
.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setPreferenceName(@NonNull java.lang.String preferenceName)
preferenceName
- name of the popup menu.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setInitializeRule(@NonNull androidx.lifecycle.Lifecycle.Event event, int defaultPosition)
event
- when should be recovered.defaultPosition
- default selected position.CustomPowerMenu.Builder
.public CustomPowerMenu.Builder setCircularEffect(@NonNull CircularEffect circularEffect)
CircularEffect
.circularEffect
- circular revealed effect using CircularEffect
.CustomPowerMenu.Builder
.public CustomPowerMenu build()