Cue
class Cue
Contains information about a specific cue, including textual content and formatting data.
Summary
Nested types |
|---|
@DocumentedThe type of anchor, which may be unset. |
@UnstableApiA builder for |
@DocumentedThe type of line, which may be unset. |
@DocumentedThe type of default text size for this cue, which may be unset. |
@DocumentedThe type of vertical layout for this cue, which may be unset (i.e. horizontal). |
Constants |
|
|---|---|
const Int |
ANCHOR_TYPE_END = 2Anchors the right (for horizontal positions) or bottom (for vertical positions) edge of the cue box. |
const Int |
Anchors the middle of the cue box. |
const Int |
Anchors the left (for horizontal positions) or top (for vertical positions) edge of the cue box. |
const Float |
DIMEN_UNSET = -3.4028235E38fAn unset position, width or size. |
const Cue! |
This property is deprecated. There's no general need for a cue with an empty text string. |
const Int |
|
const Int |
LINE_TYPE_NUMBER = 1 |
const Int |
Text size is measured in number of pixels. |
const Int |
Text size is measured as a fraction of the viewport size minus the view padding. |
const Int |
Text size is measured as a fraction of the viewport size, ignoring the view padding |
const Int |
TYPE_UNSET = -2147483648An unset anchor, line, text size or vertical type value. |
const Int |
VERTICAL_TYPE_LR = 2Vertical left-to-right (e.g. for Mongolian). |
const Int |
VERTICAL_TYPE_RL = 1Vertical right-to-left (e.g. for Japanese). |
Public functions |
|
|---|---|
Cue.Builder! |
Returns a new |
Boolean |
|
java-static Cue! |
@UnstableApiRestores a cue from a |
Int |
hashCode() |
Bundle! |
Returns a |
Bundle! |
This function is deprecated. Use |
Bundle! |
Returns a |
Public properties |
|
|---|---|
Bitmap? |
The cue image, or null if this is a text cue. |
Float |
The bitmap height as a fraction of the of the viewport size, or |
Float |
The position of the cue box within the viewport in the direction orthogonal to the writing direction (determined by |
Int |
The cue box anchor positioned by |
Int |
The type of the |
Layout.Alignment? |
The alignment of multiple lines of text relative to the longest line, or null if the alignment is undefined. |
Float |
The fractional position of the |
Int |
The cue box anchor positioned by |
Float |
The shear angle in degrees to be applied to this Cue, expressed in graphics coordinates. |
Float |
The size of the cue box in the writing direction specified as a fraction of the viewport size in that direction, or |
CharSequence? |
The cue text, or null if this is an image cue. |
Layout.Alignment? |
The alignment of the cue text within the cue box, or null if the alignment is undefined. |
Float |
The default text size for this cue's text, or |
Int |
The default text size type for this cue's text, or |
Int |
The vertical formatting of this Cue, or |
Int |
The fill color of the window. |
Boolean |
Specifies whether or not the |
Int |
The Z index for cue, the larger index will render above the smaller index. |
Constants
ANCHOR_TYPE_END
const val ANCHOR_TYPE_END = 2: Int
Anchors the right (for horizontal positions) or bottom (for vertical positions) edge of the cue box.
ANCHOR_TYPE_START
const val ANCHOR_TYPE_START = 0: Int
Anchors the left (for horizontal positions) or top (for vertical positions) edge of the cue box.
TEXT_SIZE_TYPE_ABSOLUTE
const val TEXT_SIZE_TYPE_ABSOLUTE = 2: Int
Text size is measured in number of pixels.
TEXT_SIZE_TYPE_FRACTIONAL
const val TEXT_SIZE_TYPE_FRACTIONAL = 0: Int
Text size is measured as a fraction of the viewport size minus the view padding.
TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING
const val TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING = 1: Int
Text size is measured as a fraction of the viewport size, ignoring the view padding
TYPE_UNSET
const val TYPE_UNSET = -2147483648: Int
An unset anchor, line, text size or vertical type value.
Public functions
buildUpon
@UnstableApi
fun buildUpon(): Cue.Builder!
Returns a new Cue.Builder initialized with the same values as this Cue.
fromBundle
@UnstableApi
java-static fun fromBundle(bundle: Bundle!): Cue!
Restores a cue from a Bundle.
toBinderBasedBundle
@UnstableApi
fun toBinderBasedBundle(): Bundle!
Returns a Bundle that may contain Binder references, meaning it cannot be safely serialized to bytes.
The Bundle returned from this method can be safely sent between processes and parsed by older versions of the media3 library.
Use toSerializableBundle to get a Bundle that can be safely serialized.
toSerializableBundle
@UnstableApi
fun toSerializableBundle(): Bundle!
Returns a Bundle that can be serialized to bytes.
Prefer the more efficient toBinderBasedBundle if the result doesn't need to be serialized.
The Bundle returned from this method must not be passed to other processes that might be using a different version of the media3 library.
Public properties
bitmapHeight
val bitmapHeight: Float
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.
line
val line: Float
The position of the cue box within the viewport in the direction orthogonal to the writing direction (determined by verticalType), or DIMEN_UNSET. When set, the interpretation of the value depends on the value of lineType.
The measurement direction depends on verticalType:
- For
TYPE_UNSET(i.e. horizontal), this is the vertical position relative to the top of the viewport. - For
VERTICAL_TYPE_LRthis is the horizontal position relative to the left of the viewport. - For
VERTICAL_TYPE_RLthis is the horizontal position relative to the right of the viewport.
lineAnchor
@Cue.AnchorType
val lineAnchor: Int
The cue box anchor positioned by line when lineType is LINE_TYPE_FRACTION.
One of:
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.
lineType
@Cue.LineType
val lineType: Int
The type of the line value.
LINE_TYPE_FRACTIONindicates thatlineis a fractional position within the viewport (measured to the part of the cue box determined bylineAnchor).LINE_TYPE_NUMBERindicates thatlineis a viewport line number. The viewport is divided into lines (each equal in size to the first line of the cue box). The cue box is positioned to align with the viewport lines as follows:lineAnchor) is ignored.- When
lineis greater than or equal to 0 the first line in the cue box is aligned with a viewport line, with 0 meaning the first line of the viewport. - When
lineis negative the last line in the cue box is aligned with a viewport line, with -1 meaning the last line of the viewport. - For horizontal text the start and end of the viewport are the top and bottom respectively.
multiRowAlignment
val multiRowAlignment: Layout.Alignment?
The alignment of multiple lines of text relative to the longest line, or null if the alignment is undefined.
position
val position: Float
The fractional position of the positionAnchor of the cue box within the viewport in the direction orthogonal to line, or DIMEN_UNSET.
The measurement direction depends on verticalType.
- For
TYPE_UNSET(i.e. horizontal), 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. - For
VERTICAL_TYPE_LRandVERTICAL_TYPE_RL(i.e. vertical), this is the vertical position relative to the top of the viewport.
positionAnchor
@Cue.AnchorType
val positionAnchor: Int
The cue box anchor positioned by 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.
shearDegrees
val shearDegrees: Float
The shear angle in degrees to be applied to this Cue, expressed in graphics coordinates. This results in a skew transform for the block along the inline progression axis.
size
val size: Float
The size of the cue box in the writing direction specified as a fraction of the viewport size in that direction, or DIMEN_UNSET.
text
val text: CharSequence?
The cue text, or null if this is an image cue. Note the CharSequence may be decorated with styling spans.
textAlignment
val textAlignment: Layout.Alignment?
The alignment of the cue text within the cue box, or null if the alignment is undefined.
textSize
val textSize: Float
The default text size for this cue's text, or DIMEN_UNSET if this cue has no default text size.
textSizeType
@Cue.TextSizeType
val textSizeType: Int
The default text size type for this cue's text, or TYPE_UNSET if this cue has no default text size.
verticalType
@Cue.VerticalType
val verticalType: Int
The vertical formatting of this Cue, or TYPE_UNSET if the cue has no vertical setting (and so should be horizontal).
windowColorSet
val windowColorSet: Boolean
Specifies whether or not the windowColor property is set.
zIndex
@UnstableApi
val zIndex: Int
The Z index for cue, the larger index will render above the smaller index. May be negative.