Class Cue.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.text.Cue.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cue
build()
Build the cue.Cue.Builder
clearWindowColor()
SetsCue.windowColorSet
to false.Bitmap
getBitmap()
Gets the cue image.float
getBitmapHeight()
Gets the bitmap height as a fraction of the viewport size.float
getLine()
Gets the position of thelineAnchor
of the cue box within the viewport in the direction orthogonal to the writing direction.int
getLineAnchor()
Gets the cue box anchor positioned byline
.int
getLineType()
Gets the type of the value ofgetLine()
.float
getPosition()
Gets the fractional position of thepositionAnchor
of the cue box within the viewport in the direction orthogonal toline
.int
getPositionAnchor()
Gets the cue box anchor positioned byposition
.float
getSize()
Gets the size of the cue box in the writing direction specified as a fraction of the viewport size in that direction.CharSequence
getText()
Gets the cue text.Layout.Alignment
getTextAlignment()
Gets the alignment of the cue text within the cue box, or null if the alignment is undefined.float
getTextSize()
Gets the default text size for this cue's text.int
getTextSizeType()
Gets the default text size type for this cue's text.int
getVerticalType()
Gets the vertical formatting for this Cue.int
getWindowColor()
Gets the fill color of the window.boolean
isWindowColorSet()
Returns true if the fill color of the window is set.Cue.Builder
setBitmap(Bitmap bitmap)
Sets the cue image.Cue.Builder
setBitmapHeight(float bitmapHeight)
Sets the bitmap height as a fraction of the viewport size.Cue.Builder
setLine(float line, int lineType)
Sets the position of the cue box within the viewport in the direction orthogonal to the writing direction.Cue.Builder
setLineAnchor(int lineAnchor)
Sets the cue box anchor positioned byline
.Cue.Builder
setPosition(float position)
Sets the fractional position of thepositionAnchor
of the cue box within the viewport in the direction orthogonal toline
.Cue.Builder
setPositionAnchor(int positionAnchor)
Sets the cue box anchor positioned byposition
.Cue.Builder
setSize(float size)
Sets the size of the cue box in the writing direction specified as a fraction of the viewport size in that direction.Cue.Builder
setText(CharSequence text)
Sets the cue text.Cue.Builder
setTextAlignment(Layout.Alignment textAlignment)
Sets the alignment of the cue text within the cue box.Cue.Builder
setTextSize(float textSize, int textSizeType)
Sets the default text size and type for this cue's text.Cue.Builder
setVerticalType(int verticalType)
Sets the vertical formatting for this Cue.Cue.Builder
setWindowColor(int windowColor)
Sets the fill color of the window.
-
-
-
Method Detail
-
setText
public Cue.Builder setText(CharSequence text)
Sets the cue text.Note that
text
may be decorated with styling spans.- See Also:
Cue.text
-
getText
@Nullable public CharSequence getText()
Gets the cue text.- See Also:
Cue.text
-
setBitmap
public Cue.Builder setBitmap(Bitmap bitmap)
Sets the cue image.- See Also:
Cue.bitmap
-
getBitmap
@Nullable public Bitmap getBitmap()
Gets the cue image.- See Also:
Cue.bitmap
-
setTextAlignment
public Cue.Builder setTextAlignment(@Nullable Layout.Alignment textAlignment)
Sets the alignment of the cue text within the cue box.Passing null means the alignment is undefined.
- See Also:
Cue.textAlignment
-
getTextAlignment
@Nullable public Layout.Alignment getTextAlignment()
Gets the alignment of the cue text within the cue box, or null if the alignment is undefined.- See Also:
Cue.textAlignment
-
setLine
public Cue.Builder setLine(float line, @LineType int lineType)
Sets the position of the cue box within the viewport in the direction orthogonal to the writing direction.- See Also:
Cue.line
,Cue.lineType
-
getLine
public float getLine()
Gets the position of thelineAnchor
of the cue box within the viewport in the direction orthogonal to the writing direction.- See Also:
Cue.line
-
getLineType
@LineType public int getLineType()
Gets the type of the value ofgetLine()
.- See Also:
Cue.lineType
-
setLineAnchor
public Cue.Builder setLineAnchor(@AnchorType int lineAnchor)
Sets the cue box anchor positioned byline
.- See Also:
Cue.lineAnchor
-
getLineAnchor
@AnchorType public int getLineAnchor()
Gets the cue box anchor positioned byline
.- See Also:
Cue.lineAnchor
-
setPosition
public Cue.Builder setPosition(float position)
Sets the fractional position of thepositionAnchor
of the cue box within the viewport in the direction orthogonal toline
.- See Also:
Cue.position
-
getPosition
public float getPosition()
Gets the fractional position of thepositionAnchor
of the cue box within the viewport in the direction orthogonal toline
.- See Also:
Cue.position
-
setPositionAnchor
public Cue.Builder setPositionAnchor(@AnchorType int positionAnchor)
Sets the cue box anchor positioned byposition
.- See Also:
Cue.positionAnchor
-
getPositionAnchor
@AnchorType public int getPositionAnchor()
Gets the cue box anchor positioned byposition
.- See Also:
Cue.positionAnchor
-
setTextSize
public Cue.Builder setTextSize(float textSize, @TextSizeType int textSizeType)
Sets the default text size and type for this cue's text.- See Also:
Cue.textSize
,Cue.textSizeType
-
getTextSizeType
@TextSizeType public int getTextSizeType()
Gets the default text size type for this cue's text.- See Also:
Cue.textSizeType
-
getTextSize
public float getTextSize()
Gets the default text size for this cue's text.- See Also:
Cue.textSize
-
setSize
public Cue.Builder setSize(float size)
Sets the size of the cue box in the writing direction specified as a fraction of the viewport size in that direction.- See Also:
Cue.size
-
getSize
public float getSize()
Gets the size of the cue box in the writing direction specified as a fraction of the viewport size in that direction.- See Also:
Cue.size
-
setBitmapHeight
public Cue.Builder setBitmapHeight(float bitmapHeight)
Sets the bitmap height as a fraction of the viewport size.- See Also:
Cue.bitmapHeight
-
getBitmapHeight
public float getBitmapHeight()
Gets the bitmap height as a fraction of the viewport size.- See Also:
Cue.bitmapHeight
-
setWindowColor
public Cue.Builder setWindowColor(int windowColor)
Sets the fill color of the window.Also sets
Cue.windowColorSet
to true.- See Also:
Cue.windowColor
,Cue.windowColorSet
-
clearWindowColor
public Cue.Builder clearWindowColor()
SetsCue.windowColorSet
to false.
-
isWindowColorSet
public boolean isWindowColorSet()
Returns true if the fill color of the window is set.- See Also:
Cue.windowColorSet
-
getWindowColor
public int getWindowColor()
Gets the fill color of the window.- See Also:
Cue.windowColor
-
setVerticalType
public Cue.Builder setVerticalType(@VerticalType int verticalType)
Sets the vertical formatting for this Cue.- See Also:
Cue.verticalType
-
getVerticalType
@VerticalType public int getVerticalType()
Gets the vertical formatting for this Cue.- See Also:
Cue.verticalType
-
build
public Cue build()
Build the cue.
-
-