Class AutoScroller

java.lang.Object
com.vuzix.ultralite.utils.scroll.AutoScroller

public class AutoScroller extends Object

AutoScroller is a utility class to send a large known block of predefined text to the glasses to be smoothly scrolled. This is similar to what seen on a teleprompter or in movie credits.

This class does not implement any interfaces to the glasses. This is a convenience class to track state and perform SDK calls to implement a specific behavior. All the functionality provided by this class could be developed using only the public SDK.

This is uses TextToImageSlicer utility class to create the content that is sent to the glasses.

If the content is not known up front, or subject to change, this is the utility class will not work. Use LiveText instead.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Interface class to receive a notification when the AutoScroller worker thread completes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AutoScroller(UltraliteSDK ultraliteSdk, String textContents, int lineHeight, int numberOfLines, int lineWidth, android.text.TextPaint textPaint)
    Creates an instance of the AutoScroller.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determine if the scrolling is paused.
    void
    Call this after start() to temporarily pause the scroll.
    void
    Call this after pause() to resume
    void
    Add a callback to know when the full contents have been scrolled off the screen
    void
    setDuration(int durationMs)
    Set the duration of each line.
    void
    Start showing the text.
    void
    Stops sending the text and clears the display.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AutoScroller

      public AutoScroller(UltraliteSDK ultraliteSdk, String textContents, int lineHeight, int numberOfLines, int lineWidth, android.text.TextPaint textPaint)
      Creates an instance of the AutoScroller.
      Parameters:
      ultraliteSdk - The instance of your UltraliteSDK.
      textContents - The pre-defined text to scroll across the glasses.
      lineHeight - The number of glasses pixels each line of text will utilize. This must be large enough to fit a single line of text at the requested font size, plus any inter-line padding that is desired. Range: [30-120] pixels.
      numberOfLines - The number of lines that will be visible. Note: showing fewer lines will scroll more smoothly. Range: [ 1 - (480/lineHeight) ]
      lineWidth - The width of the text on the screen. Range: [1-640]
      textPaint - Specifies all attributes related to text drawing. Send null to use the default TextPaint.
  • Method Details

    • setDuration

      public void setDuration(int durationMs)
      Set the duration of each line. This controls the speed of the scroll. This may be called before start() or while the text is scrolling.
      Parameters:
      durationMs - Number of milliseconds each lines is shown. Default=3000.
    • setCallback

      public void setCallback(AutoScroller.AutoScrollEnded client)
      Add a callback to know when the full contents have been scrolled off the screen
      Parameters:
      client - callback method to invoke upon completion
    • start

      public void start() throws IllegalStateException

      Start showing the text. This creates a worker thread. Be sure to call stopAndClear() or wait for the AutoScrollEnded() callback after this is called to prevent data collisions.

      The caller must requestControl() and setLayout(Layout.SCROLL,...) prior to calling this.

      Throws:
      IllegalStateException - If we do not have control or are not in the scroll layout.
      See Also:
    • pause

      public void pause() throws IllegalStateException
      Call this after start() to temporarily pause the scroll.
      Throws:
      IllegalStateException - If we do not have control
      See Also:
    • resume

      public void resume() throws IllegalStateException
      Call this after pause() to resume
      Throws:
      IllegalStateException - If we do not have control
      See Also:
    • isPaused

      public boolean isPaused()
      Determine if the scrolling is paused.
      Returns:
      True if paused. False if scrolling, or not yet started.
    • stopAndClear

      public void stopAndClear()
      Stops sending the text and clears the display. Does not release control or set the Layout. It is safe to call this after losing control, but not required.