public class Cue
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Cue.AnchorType
The type of anchor, which may be unset.
|
static interface |
Cue.LineType
The type of line, which may be unset.
|
static interface |
Cue.TextSizeType
The type of default text size for this cue, which may be unset.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ANCHOR_TYPE_END
Anchors the right (for horizontal positions) or bottom (for vertical positions) edge of the cue
box.
|
static int |
ANCHOR_TYPE_MIDDLE
Anchors the middle of the cue box.
|
static int |
ANCHOR_TYPE_START
Anchors the left (for horizontal positions) or top (for vertical positions) edge of the cue
box.
|
android.graphics.Bitmap |
bitmap
The cue image, or null if this is a text cue.
|
float |
bitmapHeight
The bitmap height as a fraction of the of the viewport size, or
DIMEN_UNSET if the
bitmap should be displayed at its natural height given the bitmap dimensions and the specified
size. |
static float |
DIMEN_UNSET
An unset position or width.
|
float |
line
The position of the
lineAnchor of the cue box within the viewport in the direction
orthogonal to the writing direction, or DIMEN_UNSET. |
static int |
LINE_TYPE_FRACTION
|
static int |
LINE_TYPE_NUMBER
|
int |
lineAnchor
The cue box anchor positioned by
line. |
int |
lineType
The type of the
line value. |
float |
position
The fractional position of the
positionAnchor of the cue box within the viewport in
the direction orthogonal to line, or DIMEN_UNSET. |
int |
positionAnchor
The cue box anchor positioned by
position. |
float |
size
The size of the cue box in the writing direction specified as a fraction of the viewport size
in that direction, or
DIMEN_UNSET. |
java.lang.CharSequence |
text
The cue text, or null if this is an image cue.
|
static int |
TEXT_SIZE_TYPE_ABSOLUTE
Text size is measured in number of pixels.
|
static int |
TEXT_SIZE_TYPE_FRACTIONAL
Text size is measured as a fraction of the viewport size minus the view padding.
|
static int |
TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING
Text size is measured as a fraction of the viewport size, ignoring the view padding
|
android.text.Layout.Alignment |
textAlignment
The alignment of the cue text within the cue box, or null if the alignment is undefined.
|
float |
textSize
The default text size for this cue's text, or
DIMEN_UNSET if this cue has no default
text size. |
int |
textSizeType
The default text size type for this cue's text, or
TYPE_UNSET if this cue has no
default text size. |
static int |
TYPE_UNSET
An unset anchor or line type value.
|
int |
windowColor
The fill color of the window.
|
boolean |
windowColorSet
Specifies whether or not the
windowColor property is set. |
| Constructor and Description |
|---|
Cue(android.graphics.Bitmap bitmap,
float horizontalPosition,
int horizontalPositionAnchor,
float verticalPosition,
int verticalPositionAnchor,
float width,
float height)
Creates an image cue.
|
Cue(java.lang.CharSequence text)
Creates a text cue whose
textAlignment is null, whose type parameters are set to
TYPE_UNSET and whose dimension parameters are set to DIMEN_UNSET. |
Cue(java.lang.CharSequence text,
android.text.Layout.Alignment textAlignment,
float line,
int lineType,
int lineAnchor,
float position,
int positionAnchor,
float size)
Creates a text cue.
|
Cue(java.lang.CharSequence text,
android.text.Layout.Alignment textAlignment,
float line,
int lineType,
int lineAnchor,
float position,
int positionAnchor,
float size,
boolean windowColorSet,
int windowColor)
Creates a text cue.
|
Cue(java.lang.CharSequence text,
android.text.Layout.Alignment textAlignment,
float line,
int lineType,
int lineAnchor,
float position,
int positionAnchor,
float size,
int textSizeType,
float textSize)
Creates a text cue.
|
public static final float DIMEN_UNSET
public static final int TYPE_UNSET
public static final int ANCHOR_TYPE_START
public static final int ANCHOR_TYPE_MIDDLE
public static final int ANCHOR_TYPE_END
public static final int LINE_TYPE_FRACTION
public static final int LINE_TYPE_NUMBER
public static final int TEXT_SIZE_TYPE_FRACTIONAL
public static final int TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING
public static final int TEXT_SIZE_TYPE_ABSOLUTE
public final java.lang.CharSequence text
CharSequence may be decorated
with styling spans.public final android.text.Layout.Alignment textAlignment
public final android.graphics.Bitmap bitmap
public final float line
lineAnchor of the cue box within the viewport in the direction
orthogonal to the writing direction, or DIMEN_UNSET. When set, the interpretation of
the value depends on the value of lineType.
For horizontal text and lineType equal to LINE_TYPE_FRACTION, this is the
fractional vertical position relative to the top of the viewport.
@Cue.LineType public final int lineType
line value.
LINE_TYPE_FRACTION indicates that line is a fractional position within the
viewport.
LINE_TYPE_NUMBER indicates that line is a line number, where the size of
each line is taken to be the size of the first line of the cue. When line is greater
than or equal to 0 lines count from the start of the viewport, with 0 indicating zero offset
from the start edge. When line is negative lines count from the end of the viewport,
with -1 indicating zero offset from the end edge. For horizontal text the line spacing is the
height of the first line of the cue, and the start and end of the viewport are the top and
bottom respectively.
Note that it's particularly important to consider the effect of lineAnchor when
using LINE_TYPE_NUMBER. (line == 0 && lineAnchor == ANCHOR_TYPE_START)
positions a (potentially multi-line) cue at the very top of the viewport. (line == -1 &&
lineAnchor == ANCHOR_TYPE_END) positions a (potentially multi-line) cue at the very bottom of
the viewport. (line == 0 && lineAnchor == ANCHOR_TYPE_END) and (line == -1 &&
lineAnchor == ANCHOR_TYPE_START) position cues entirely outside of the viewport. (line
== 1 && lineAnchor == ANCHOR_TYPE_END) positions a cue so that only the last line is visible
at the top of the viewport. (line == -2 && lineAnchor == ANCHOR_TYPE_START) position a
cue so that only its first line is visible at the bottom of the viewport.
@Cue.AnchorType public final int lineAnchor
line. One of ANCHOR_TYPE_START, ANCHOR_TYPE_MIDDLE, ANCHOR_TYPE_END and TYPE_UNSET.
For the normal case of horizontal text, ANCHOR_TYPE_START, ANCHOR_TYPE_MIDDLE and ANCHOR_TYPE_END correspond to the top, middle and bottom of
the cue box respectively.
public final float position
positionAnchor of the cue box within the viewport in
the direction orthogonal to line, or DIMEN_UNSET.
For horizontal text, this is the horizontal position relative to the left of the viewport. Note that positioning is relative to the left of the viewport even in the case of right-to-left text.
@Cue.AnchorType public final int positionAnchor
position. One of ANCHOR_TYPE_START, ANCHOR_TYPE_MIDDLE, ANCHOR_TYPE_END and TYPE_UNSET.
For the normal case of horizontal text, ANCHOR_TYPE_START, ANCHOR_TYPE_MIDDLE and ANCHOR_TYPE_END correspond to the left, middle and right of
the cue box respectively.
public final float size
DIMEN_UNSET.public final float bitmapHeight
DIMEN_UNSET if the
bitmap should be displayed at its natural height given the bitmap dimensions and the specified
size.public final boolean windowColorSet
windowColor property is set.public final int windowColor
@Cue.TextSizeType public final int textSizeType
TYPE_UNSET if this cue has no
default text size.public final float textSize
DIMEN_UNSET if this cue has no default
text size.public Cue(android.graphics.Bitmap bitmap,
float horizontalPosition,
@Cue.AnchorType
int horizontalPositionAnchor,
float verticalPosition,
@Cue.AnchorType
int verticalPositionAnchor,
float width,
float height)
bitmap - See bitmap.horizontalPosition - The position of the horizontal anchor within the viewport, expressed
as a fraction of the viewport width.horizontalPositionAnchor - The horizontal anchor. One of ANCHOR_TYPE_START,
ANCHOR_TYPE_MIDDLE, ANCHOR_TYPE_END and TYPE_UNSET.verticalPosition - The position of the vertical anchor within the viewport, expressed as a
fraction of the viewport height.verticalPositionAnchor - The vertical anchor. One of ANCHOR_TYPE_START, ANCHOR_TYPE_MIDDLE, ANCHOR_TYPE_END and TYPE_UNSET.width - The width of the cue as a fraction of the viewport width.height - The height of the cue as a fraction of the viewport height, or DIMEN_UNSET if the bitmap should be displayed at its natural height for the specified
width.public Cue(java.lang.CharSequence text)
textAlignment is null, whose type parameters are set to
TYPE_UNSET and whose dimension parameters are set to DIMEN_UNSET.text - See text.public Cue(java.lang.CharSequence text,
android.text.Layout.Alignment textAlignment,
float line,
@Cue.LineType
int lineType,
@Cue.AnchorType
int lineAnchor,
float position,
@Cue.AnchorType
int positionAnchor,
float size)
text - See text.textAlignment - See textAlignment.line - See line.lineType - See lineType.lineAnchor - See lineAnchor.position - See position.positionAnchor - See positionAnchor.size - See size.public Cue(java.lang.CharSequence text,
android.text.Layout.Alignment textAlignment,
float line,
@Cue.LineType
int lineType,
@Cue.AnchorType
int lineAnchor,
float position,
@Cue.AnchorType
int positionAnchor,
float size,
@Cue.TextSizeType
int textSizeType,
float textSize)
text - See text.textAlignment - See textAlignment.line - See line.lineType - See lineType.lineAnchor - See lineAnchor.position - See position.positionAnchor - See positionAnchor.size - See size.textSizeType - See textSizeType.textSize - See textSize.public Cue(java.lang.CharSequence text,
android.text.Layout.Alignment textAlignment,
float line,
@Cue.LineType
int lineType,
@Cue.AnchorType
int lineAnchor,
float position,
@Cue.AnchorType
int positionAnchor,
float size,
boolean windowColorSet,
int windowColor)
text - See text.textAlignment - See textAlignment.line - See line.lineType - See lineType.lineAnchor - See lineAnchor.position - See position.positionAnchor - See positionAnchor.size - See size.windowColorSet - See windowColorSet.windowColor - See windowColor.