Package tripleplay.ui

Class LongPressButton

All Implemented Interfaces:
Clickable<Button>

public class LongPressButton extends Button
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.
  • Field Details

    • LONG_PRESS_INTERVAL

      public static Style<Integer> 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

      public LongPressButton(String text)
      Creates a button with the supplied text.
    • LongPressButton

      public LongPressButton(Icon icon)
      Creates a button with the supplied icon.
    • LongPressButton

      public LongPressButton(String text, Icon icon)
      Creates a button with the supplied text and icon.
  • Method Details

    • longPressed

      public react.SignalView<Button> longPressed()
      A signal that is emitted when this button is long pressed. See LONG_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

      public LongPressButton onLongPress(react.SignalView.Listener<? super Button> onLongPress)
      A convenience method for registering a long press handler. Assumes you don't need the result of SignalView.connect(react.SignalView.Listener<? super T>), because it throws it away.