gh-pages / com.nextfaze.devfun.overlay / OverlayManager / createOverlay
createOverlay
abstract fun createOverlay(@LayoutRes layoutId: Int, name: String, prefsName: String, reason: OverlayReason, onClick: ClickListener? = null, onLongClick: ClickListener? = null, onVisibilityChange: VisibilityListener? = null, onAttachChange: AttachListener? = null, visibilityPredicate: VisibilityPredicate? = null, visibilityScope: VisibilityScope = VisibilityScope.FOREGROUND_ONLY, dock: Dock = Dock.TOP_LEFT, delta: Float = 0f, snapToEdge: Boolean = true, left: Float = 0f, top: Float = 0f, enabled: Boolean = true): OverlayWindow (source)
Creates an overlay window.
Add the overlay to the screen using OverlayWindow.addToWindow.
When you are done with the overlay by sure to destroy it with destroyOverlay.
Parameters
layoutId - A layout resource ID to inflate.
name - A user-friendly name.
prefsName - The name of the preferences file the window will use - must be unique!
reason - A function that generates the reason description. Will only be called when we need to request overlays permission.
onClick - Callback when the overlay is clicked.
onLongClick - Callback when the overlay is long-clicked.
onVisibilityChange - Callback when the overlay’s visibility is changed.
onAttachChange - Callback when overlay is added/removed to the window.
visibilityPredicate - Predicate that determines if/when the overlay should be visible (e.g. DevMenu uses context is FragmentActivity).
visibilityScope - The VisibilityScope defaults to FOREGROUND_ONLY. i.e. When the app is visible and resumed to the user.
dock - The edge of the screen to dock to (see snapToEdge).
delta - The percentage down/across the screen (e.g. An dock of RIGHT and delta of 0.7 (DevMenu cog) puts it at 70% down the right-hand side of the screen).
snapToEdge - true to enable edge docking, false to allow it to sit/drag anywhere on the screen.
left - Used when snapToEdge is true - the left position (percentage of screen).
top - Used when snapToEdge is true - the top position (percentage of screen).
See Also