Class DynamicPopup
java.lang.Object
com.pranavpandey.android.dynamic.support.popup.base.DynamicPopup
- All Implemented Interfaces:
DynamicProductFlavor
- Direct Known Subclasses:
DynamicSimplePopup
Base
PopupWindow
to provide the basic functionality to its descendants.
Extend this class to create popup windows according to the requirements.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
Interface to hold the view types supported by the popup. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract DynamicPopup
build()
Build this popup and make it ready to show.void
dismiss()
Try to dismiss the popup window.Get the anchor view to display the popup.protected View
Returns the footer view for the popup.protected View
Returns the header view for the popup.protected int
The offset to adjust the location of the window on the x-axis.protected int
The offset to adjust the location of the window on the y-axis.protected int
Returns the maximum width for the popup.Returns the popup window displayed by this class.Returns the popup window color.protected int
The offset to adjust the size of the window if enough space is not available.protected abstract View
getView()
This method will be called to return the content view for the popup.Returns the root view for the popup.int
Returns the view type for the popup.protected int
Returns the window animation style for the popup.protected void
onCustomisePopup
(PopupWindow popupWindow, View content, int backgroundColor) This method will be called just before showing this popup.void
Set the anchor view to display the popup.void
setPopupWindowColor
(int popupWindowColor) Set the popup window color.void
setViewRoot
(View viewRoot) Set the view root for this the popup.void
setViewType
(int viewType) Set the view type used by the popup.void
show()
Build and showPopupWindow
according to the supplied parameters.
-
Field Details
-
mAnchor
Anchor view used by this popup. -
mViewType
protected int mViewTypeView type used by this popup. -
mPopupWindowColor
Color for the popup window background.
-
-
Constructor Details
-
DynamicPopup
public DynamicPopup()
-
-
Method Details
-
getAnchor
Get the anchor view to display the popup.- Returns:
- The anchor view to display the popup.
-
setAnchor
Set the anchor view to display the popup.- Parameters:
anchor
- The anchor view to be set.
-
getHeaderView
Returns the header view for the popup.Default is
null
to hide the header.- Returns:
- The header view for the popup.
-
getView
This method will be called to return the content view for the popup.- Returns:
- The content view for the popup.
-
getPopupWindow
Returns the popup window displayed by this class.- Returns:
- The popup window displayed by this class.
-
getViewRoot
Returns the root view for the popup.- Returns:
- The view root to add scroll indicators if the content can be scrolled.
-
setViewRoot
Set the view root for this the popup.- Parameters:
viewRoot
- The view root to be set.
-
getViewType
public int getViewType()Returns the view type for the popup.- Returns:
- The view type used by the popup.
-
setViewType
public void setViewType(int viewType) Set the view type used by the popup.- Parameters:
viewType
- The view type to be set.
-
getPopupWindowColor
Returns the popup window color.- Returns:
- The popup window color used by the popup.
-
setPopupWindowColor
Set the popup window color.- Parameters:
popupWindowColor
- The popup window color to be set.
-
build
Build this popup and make it ready to show.Please call
show()
method to show the popup.- Returns:
- The popup after building it according to the supplied parameters.
-
getWindowAnimationStyle
Returns the window animation style for the popup.- Returns:
- The window animation style for the popup.
-
getMaxWidth
protected int getMaxWidth()Returns the maximum width for the popup.- Returns:
- The maximum width for the popup.
-
getSizeOffset
protected int getSizeOffset()The offset to adjust the size of the window if enough space is not available.- Returns:
- The offset to adjust the size of the window if enough space is not available.
-
getLocationOffsetX
protected int getLocationOffsetX()The offset to adjust the location of the window on the x-axis.- Returns:
- The offset to adjust the location of the window on the x-axis.
-
getLocationOffsetY
protected int getLocationOffsetY()The offset to adjust the location of the window on the y-axis.- Returns:
- The offset to adjust the location of the window on the y-axis.
-
onCustomisePopup
protected void onCustomisePopup(@NonNull PopupWindow popupWindow, @NonNull View content, @ColorInt int backgroundColor) This method will be called just before showing this popup.- Parameters:
popupWindow
- The popup window to be displayed by this popup.content
- The content to be displayed by this popup.backgroundColor
- The background color of this popup.
-
show
public void show()Build and showPopupWindow
according to the supplied parameters. -
dismiss
public void dismiss()Try to dismiss the popup window.- See Also:
-
getProductFlavor
- Specified by:
getProductFlavor
in interfaceDynamicProductFlavor
-