Package tripleplay.ui
Class LongPressButton
A button that supports an action on a "long press". A long press is when the user holds the
button in the armed state for some reasonably lengthy amount of time (the default is 1000ms).
This element behaves as a
Button
for style purposes.-
Nested Class Summary
Nested classes/interfaces inherited from class tripleplay.ui.Element
Element.Take
-
Field Summary
Modifier and TypeFieldDescriptionAn interval (in milliseconds) after which pressing and holding on a button will be interpreted as a "long press" and fire a clicked event.Fields inherited from class tripleplay.ui.AbstractTextButton
icon, text
-
Constructor Summary
ConstructorDescriptionCreates a button with no text or icon.LongPressButton
(String text) Creates a button with the supplied text.LongPressButton
(String text, Icon icon) Creates a button with the supplied text and icon.LongPressButton
(Icon icon) Creates a button with the supplied icon. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Programmatically triggers a long press of this button.react.SignalView<Button>
A signal that is emitted when this button is long pressed.onLongPress
(react.SignalView.Listener<? super Button> onLongPress) A convenience method for registering a long press handler.Methods inherited from class tripleplay.ui.AbstractTextButton
bindIcon, bindText, setIcon, setText
Methods inherited from class tripleplay.ui.Element
addStyles, addStyles, bindEnabled, bindVisible, bounds, constraint, enabledSlot, hierarchyChanged, isAdded, isEnabled, isShowing, isVisible, location, parent, setConstraint, setEnabled, setStyles, setStyles, setVisible, size, styles, visibleSlot, x, y
-
Field Details
-
LONG_PRESS_INTERVAL
An interval (in milliseconds) after which pressing and holding on a button will be interpreted as a "long press" and fire a clicked event. The button is then disarmed, so that when the button is released after a long press, a normal click event is not reported. Defaults to 1000ms.
-
-
Constructor Details
-
LongPressButton
public LongPressButton()Creates a button with no text or icon. -
LongPressButton
Creates a button with the supplied text. -
LongPressButton
Creates a button with the supplied icon. -
LongPressButton
Creates a button with the supplied text and icon.
-
-
Method Details
-
longPressed
A signal that is emitted when this button is long pressed. SeeLONG_PRESS_INTERVAL
. -
longPress
public void longPress()Programmatically triggers a long press of this button. This triggers the action sound, but does not cause any change in the button's visualization. Note: this does not check the button's enabled state, so the caller must handle that if appropriate. -
onLongPress
A convenience method for registering a long press handler. Assumes you don't need the result ofSignalView.connect(react.SignalView.Listener<? super T>)
, because it throws it away.
-