TtPopOver

class TtPopOver

A transient view with custom content which appears above other content onscreen. It can show additional content such as context menus or content that does not easily fit into the UI. It can be opened from any component. If it is desired that the TtPopOver should be positioned relative to the component responsible for opening it, this component should be passed as the anchorView parameter the show method. The TtPopOver is displayed above all other views in the application. Only a single TtPopOver can be displayed at any given time.

Parameters

fragmentManager

The FragmentManager to be used when showing or dismissing the TtPopOverDialogFragment.

lifecycleOwner

The LifecycleOwner to be used to provide the lifecycle of the TtPopOverDialogFragment.

viewModelProvider

The ViewModelProvider to be used to provide the TtPopOverViewModel instance.

dismissWhenClickOutside

If true the TtPopOver will be dismissed when the user taps outside of the TtPopOver. If false the TtPopOver will remain on screen when the user taps outside of the TtPopOver.

entryAnimatorAttrId

The resource ID of the animation to execute when the TtPopOver is shown.

exitAnimatorAttrId

The resource ID of the animation to execute when the TtPopOver is dismissed.

shouldHidePlatformSystemUi

If true the status and navigation bars will be hidden while the TtPopOver is displayed. If false the status and navigation bars will be visible while the TtPopOver is displayed.

onPopOverDismissedListener

The action to perform when the TtPopOver is dismissed.

onPopOverTouchOutsideListener

The action to perform when the user taps outside of the TtPopOver.

automaticDismissTimeoutMs

The timeout in milliseconds after which to automatically dismiss the TtPopOver. Any user interaction with the TtPopOver will reset the timeout. If null then the TtPopOver will not be dismissed automatically.

Constructors

Link copied to clipboard
fun TtPopOver(parentFragment: Fragment, dismissWhenClickOutside: Boolean = false, @AttrRes entryAnimatorAttrId: Int? = R.attr.tt_popover_enter, @AttrRes exitAnimatorAttrId: Int? = R.attr.tt_popover_exit, shouldHidePlatformSystemUi: Boolean = false, onPopOverDismissedListener: TtPopOver.OnPopOverDismissedListener? = null, onPopOverTouchOutsideListener: TtPopOver.OnPopOverTouchOutsideListener? = null, automaticDismissTimeoutMs: Long? = parentFragment.requireContext().getIntegerByAttr(R.attr.tt_delay_duration_short_ms).toLong())

A convenience constructor to create a TtPopOver given a parent Fragment.

Link copied to clipboard
fun TtPopOver(parentActivity: FragmentActivity, dismissWhenClickOutside: Boolean = false, @AttrRes entryAnimatorAttrId: Int? = R.attr.tt_popover_enter, @AttrRes exitAnimatorAttrId: Int? = R.attr.tt_popover_exit, shouldHidePlatformSystemUi: Boolean = false, onPopOverDismissedListener: TtPopOver.OnPopOverDismissedListener? = null, onPopOverTouchOutsideListener: TtPopOver.OnPopOverTouchOutsideListener? = null, automaticDismissTimeoutMs: Long? = parentActivity.getIntegerByAttr(R.attr.tt_delay_duration_short_ms).toLong())

A convenience constructor to create a TtPopOver given a parent FragmentActivity.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

An interface for listeners that wish to be notified when a TtPopOver is dismissed.

Link copied to clipboard

An interface for listeners that wish to be notified when the user taps outside the TtPopOver.

Link copied to clipboard

The position to display the TtPopOver relative to the position of its anchor view.

Functions

Link copied to clipboard
fun dismiss()

Dismiss this TtPopOver. onPopOverDismissedListener will be invoked if assigned.

Link copied to clipboard
fun show(contentFragment: Fragment, anchorView: View, positionRelativeToAnchor: TtPopOver.PositionRelativeToAnchor, offsetXRelativeToAnchor: Int = 0, offsetYRelativeToAnchor: Int = 0)

Populates the TtPopOver with the contentFragment and displays it, using the value of positionRelativeToAnchor to determine the position relative to the anchorView. The optional offsetXRelativeToAnchor and offsetYRelativeToAnchor parameters can be used to adjust the horizontal and vertical position of the TtPopOver, for example, to prevent the TtPopOver overlapping the edge of the screen or to avoid overlapping a particular component.