-
Notifications
You must be signed in to change notification settings - Fork 188
API Reference
This page collects the everyday surface of the 3.0 public API: the control methods on FxControl,
the FxListener callbacks, and the FloatingX registry. For configuration options (anchor /
gestures / adsorption / animation …) see Configuration.
What install / create return, and the only entry point for driving a window afterwards:
control.show(); control.hide(); control.cancel() // cancel() is idempotent; after it show/hide/moveTo/moveBy throw IllegalStateException
control.moveTo(100f, 200f); control.moveTo(100f, 200f, animate = true)
control.moveBy(-20f, 0f); control.moveBy(-20f, 0f, animate = true)
control.update { anchor(FxGravity.BOTTOM_END); gesture { drag = FxDrag.DISABLED } } // patch the config
control.setContent(FxContent.layout(R.layout.fx_card)) // swap the content wholesale
control.updateContent { it.setText(R.id.tvTitle, "Hi") } // edit views inside the content (works before show)
control.addListener(listener); control.removeListener(listener)
control.addFeature(feature); control.removeFeature(feature)
control.tag; control.state; control.isShowing
control.position // screen coords of the content's top-left, identical semantics for all hosts
control.anchor; control.config; control.host; control.contentView; control.holder
control.attachedActivity // floatingx-app extension: which Activity it is currently attached toFxState: INSTALLED (created, container not attached) → ATTACHED (attached but invisible) →
SHOWN (visible), with the terminal state CANCELLED.
control.update {} uses the same DSL as install, keeping every option you don't set — see
Configuration; control.attachedActivity only means something for app-level windows, see
App Host.
Listeners belong to the control, so addListener / removeListener may be called at any time:
onAttach / onDetach / onShow / onHide / onCancel
onClick(control, view) / onLongClick(control, view)
onDragStart(control) / onDrag(control, x, y) / onDragEnd(control, x, y) // x/y relative to the container
onPositionChanged(control, anchor) // after an anchor commit; tells you which edge it sits onGlobal windows are registered by tag; local windows (Scope Host) are not registered:
FloatingX.install(tag) { … } // install and register; installing over a tag cancels the old one
FloatingX.create(tag) { … } // create without registering, lifetime belongs to the caller (local windows)
FloatingX.control(tag) // throws when missing
FloatingX.controlOrNull(tag)
FloatingX.controls() // snapshot of every global window
FloatingX.isInstalled(tag)
FloatingX.uninstall(tag) / FloatingX.uninstallAll()tag defaults to FloatingX.DEFAULT_TAG. For local windows the tag is only used for logging and
as the position-persistence key (leave it empty and nothing is persisted).
Back to Home · See also: Configuration App Host Scope Host FAQ