Class LiveText
LiveText is a utility class to send small blocks of rapidly updating text to the glasses to be displayed at the bottom of the field of view. This creates an effect similar to closed captioning on a television.
This class efficiently updates the current line of text on the screen by adding new words to the end, and then scrolls the completed lines upwards to make room for new content below.
Earlier lines of text may be edited or removed.
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 uses the TextToImageSlicer utility class to create the content that is sent to the glasses.
If the content known up front, and not subject to change, and a smooth scrolling is preferred to a line-by-line insertion, consider using AutoScroller instead.
- Since:
- 1.4.0
- See Also:
-
Constructor Summary
ConstructorDescriptionLiveText
(UltraliteSDK ultraliteSdk, int lineHeight, int lineWidth, int startingLineIndex, int numSlicesVisible, android.text.TextPaint textPaint) Creates an instance of the LiveText.LiveText
(UltraliteSDK ultraliteSdk, int lineHeight, int lineWidth, android.text.TextPaint textPaint) Deprecated. -
Method Summary
-
Constructor Details
-
LiveText
public LiveText(UltraliteSDK ultraliteSdk, int lineHeight, int lineWidth, android.text.TextPaint textPaint) Deprecated.Beginning in 1.7.0 useLiveText(UltraliteSDK, int, int, int, int, TextPaint)
to also set the text position vertically.Creates an instance of the LiveText.- Parameters:
ultraliteSdk
- The instance of your UltraliteSDK.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. This divides the screen into between 4 and 16 lines of text.lineWidth
- The width of the text on the screen. Range: [30-640].textPaint
- Specifies all attributes related to text drawing. Send null to use the default TextPaint.- Since:
- 1.4.0
-
LiveText
public LiveText(UltraliteSDK ultraliteSdk, int lineHeight, int lineWidth, int startingLineIndex, int numSlicesVisible, android.text.TextPaint textPaint) Creates an instance of the LiveText.- Parameters:
ultraliteSdk
- The instance of your UltraliteSDK.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. This divides the screen into between 4 and 16 lines of text. Recommended starting value: 48 (10 lines of text maximum).lineWidth
- The width of the text on the screen. Range: [30-640]. Recommended starting value: 640.startingLineIndex
- The text row index to which to start text. Zero starts text at the lowest possible starting point. Range: [ 0 - ((480/lineHeight)-1)] Recommended starting value: 0.numSlicesVisible
- The maximum number of text lines that will be fully visible before scrolling off the top. Having fewer slices shown increases the animation quality. Min=1. Max=((480/lineHeight)-startingLineIndex). Recommended starting value: 3.textPaint
- Specifies all attributes related to text drawing. Send null to use the default TextPaint.- Since:
- 1.7.0
-
-
Method Details
-
sendText
Start showing the specified text.
The caller must requestControl() and setLayout(Layout.SCROLL,...) prior to calling this.
- Parameters:
stringToDisplay
- Most recent string of all text that should be on the glasses now- Throws:
IllegalStateException
- If we do not have control or are not in the scroll layout.- Since:
- 1.4.0
-
clear
public void clear()Clear the glasses display of previously shown text
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.- Since:
- 1.4.0
-
LiveText(UltraliteSDK, int, int, int, int, TextPaint)
to also set the text position vertically.