TextTrackStyle

public final class TextTrackStyle extends AbstractSafeParcelable

A class that specifies how a text track's text will be displayed on-screen. The text is displayed inside a rectangular "window". The appearance of both the text and the window are configurable.

With the exception of the font scale, which has a predefined default value, any attribute that is not explicitly set will remain "unspecified", and the Cast Receiver will select an appropriate value.

Constant Summary

int COLOR_UNSPECIFIED A color value that indicates an unspecified (unset) color.
float DEFAULT_FONT_SCALE The default font scale.
int EDGE_TYPE_DEPRESSED An edge type indicating a depressed edge.
int EDGE_TYPE_DROP_SHADOW An edge type indicating a drop shadow edge.
int EDGE_TYPE_NONE An edge type indicating no edge.
int EDGE_TYPE_OUTLINE An edge type indicating an outline edge.
int EDGE_TYPE_RAISED An edge type indicating a raised edge.
int EDGE_TYPE_UNSPECIFIED An edge type indicating an unspecified edge type.
int FONT_FAMILY_CASUAL A font family indicating Casual.
int FONT_FAMILY_CURSIVE A font family indicating Cursive.
int FONT_FAMILY_MONOSPACED_SANS_SERIF A font family indicating Monospaced Sans Serif.
int FONT_FAMILY_MONOSPACED_SERIF A font family indicating Monospaced Serif.
int FONT_FAMILY_SANS_SERIF A font family indicating Sans Serif.
int FONT_FAMILY_SERIF A font family indicating Serif.
int FONT_FAMILY_SMALL_CAPITALS A font family indicating Small Capitals.
int FONT_FAMILY_UNSPECIFIED A font family indicating an unspecified font family.
int FONT_STYLE_BOLD A font style indicating a bold style.
int FONT_STYLE_BOLD_ITALIC A font style indicating a bold and italic style.
int FONT_STYLE_ITALIC A font style indicating an italic style.
int FONT_STYLE_NORMAL A font style indicating a normal style.
int FONT_STYLE_UNSPECIFIED A font style indicating an unspecified style.
int WINDOW_TYPE_NONE A window type indicating no window type.
int WINDOW_TYPE_NORMAL A window type indicating a normal window.
int WINDOW_TYPE_ROUNDED A window type indicating a window with rounded corners.
int WINDOW_TYPE_UNSPECIFIED A window type indicating an unspecified window type.

Inherited Constant Summary

Public Constructor Summary

TextTrackStyle()
Constructs a new TextTrackStyle.

Public Method Summary

boolean
equals(Object other)
static TextTrackStyle
fromSystemSettings(Context context)
Constructs a new TextTrackStyle based on the system's current closed caption style settings.
int
getBackgroundColor()
Gets the text's background color.
JSONObject
getCustomData()
Gets the custom data object.
int
getEdgeColor()
Gets the window's edge color.
int
getEdgeType()
Gets the caption window's edge type.
String
getFontFamily()
Gets the text's font family.
int
getFontGenericFamily()
Gets the text's generic font family.
float
getFontScale()
Gets the font scale factor.
int
getFontStyle()
Gets the text font style.
int
getForegroundColor()
Gets the text's foreground color.
int
getWindowColor()
Gets the window's color.
int
getWindowCornerRadius()
Gets the window corner radius.
int
getWindowType()
Gets the caption window type.
int
void
setBackgroundColor(int backgroundColor)
Sets the text's background color.
void
setCustomData(JSONObject customData)
Sets the custom data object.
void
setEdgeColor(int edgeColor)
Sets the window's edge color.
void
setEdgeType(int edgeType)
Sets the caption window's edge type.
void
setFontFamily(String fontFamily)
Sets the text's font family.
void
setFontGenericFamily(int fontGenericFamily)
Sets the text's generic font family.
void
setFontScale(float fontScale)
Sets the font scale factor.
void
setFontStyle(int fontStyle)
Sets the text font style.
void
setForegroundColor(int foregroundColor)
Sets the text's foreground color.
void
setWindowColor(int windowColor)
Sets the window's color.
void
setWindowCornerRadius(int windowCornerRadius)
If the window type is WINDOW_TYPE_ROUNDED, sets the radius for the window's corners.
void
setWindowType(int windowType)
Sets the window type.
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

Constants

public static final int COLOR_UNSPECIFIED

A color value that indicates an unspecified (unset) color.

Constant Value: 0

public static final float DEFAULT_FONT_SCALE

The default font scale.

Constant Value: 1.0

public static final int EDGE_TYPE_DEPRESSED

An edge type indicating a depressed edge.

Constant Value: 4

public static final int EDGE_TYPE_DROP_SHADOW

An edge type indicating a drop shadow edge.

Constant Value: 2

public static final int EDGE_TYPE_NONE

An edge type indicating no edge.

Constant Value: 0

public static final int EDGE_TYPE_OUTLINE

An edge type indicating an outline edge.

Constant Value: 1

public static final int EDGE_TYPE_RAISED

An edge type indicating a raised edge.

Constant Value: 3

public static final int EDGE_TYPE_UNSPECIFIED

An edge type indicating an unspecified edge type.

Constant Value: -1

public static final int FONT_FAMILY_CASUAL

A font family indicating Casual.

Constant Value: 4

public static final int FONT_FAMILY_CURSIVE

A font family indicating Cursive.

Constant Value: 5

public static final int FONT_FAMILY_MONOSPACED_SANS_SERIF

A font family indicating Monospaced Sans Serif.

Constant Value: 1

public static final int FONT_FAMILY_MONOSPACED_SERIF

A font family indicating Monospaced Serif.

Constant Value: 3

public static final int FONT_FAMILY_SANS_SERIF

A font family indicating Sans Serif.

Constant Value: 0

public static final int FONT_FAMILY_SERIF

A font family indicating Serif.

Constant Value: 2

public static final int FONT_FAMILY_SMALL_CAPITALS

A font family indicating Small Capitals.

Constant Value: 6

public static final int FONT_FAMILY_UNSPECIFIED

A font family indicating an unspecified font family.

Constant Value: -1

public static final int FONT_STYLE_BOLD

A font style indicating a bold style.

Constant Value: 1

public static final int FONT_STYLE_BOLD_ITALIC

A font style indicating a bold and italic style.

Constant Value: 3

public static final int FONT_STYLE_ITALIC

A font style indicating an italic style.

Constant Value: 2

public static final int FONT_STYLE_NORMAL

A font style indicating a normal style.

Constant Value: 0

public static final int FONT_STYLE_UNSPECIFIED

A font style indicating an unspecified style.

Constant Value: -1

public static final int WINDOW_TYPE_NONE

A window type indicating no window type.

Constant Value: 0

public static final int WINDOW_TYPE_NORMAL

A window type indicating a normal window.

Constant Value: 1

public static final int WINDOW_TYPE_ROUNDED

A window type indicating a window with rounded corners.

Constant Value: 2

public static final int WINDOW_TYPE_UNSPECIFIED

A window type indicating an unspecified window type.

Constant Value: -1

Public Constructors

public TextTrackStyle ()

Constructs a new TextTrackStyle.

Public Methods

public boolean equals (Object other)

public static TextTrackStyle fromSystemSettings (Context context)

Constructs a new TextTrackStyle based on the system's current closed caption style settings. On platform levels below 19, this returns an object with "unspecified" values for all fields.

Parameters
context The calling context.
Returns
  • The new TextTrackStyle.

public int getBackgroundColor ()

Gets the text's background color.

public JSONObject getCustomData ()

Gets the custom data object.

public int getEdgeColor ()

Gets the window's edge color.

public int getEdgeType ()

Gets the caption window's edge type.

public String getFontFamily ()

Gets the text's font family.

public int getFontGenericFamily ()

Gets the text's generic font family.

public float getFontScale ()

Gets the font scale factor.

public int getFontStyle ()

Gets the text font style.

public int getForegroundColor ()

Gets the text's foreground color.

public int getWindowColor ()

Gets the window's color.

public int getWindowCornerRadius ()

Gets the window corner radius.

public int getWindowType ()

Gets the caption window type.

public int hashCode ()

public void setBackgroundColor (int backgroundColor)

Sets the text's background color.

Parameters
backgroundColor The color, as an ARGB value.

public void setCustomData (JSONObject customData)

Sets the custom data object.

public void setEdgeColor (int edgeColor)

Sets the window's edge color.

Parameters
edgeColor The color, as an ARGB value.

public void setEdgeType (int edgeType)

Sets the caption window's edge type.

Parameters
edgeType The edge type; one of the EDGE_TYPE_ constants defined above.

public void setFontFamily (String fontFamily)

Sets the text's font family.

Parameters
fontFamily The text font family.

public void setFontGenericFamily (int fontGenericFamily)

Sets the text's generic font family. This will be used if the font family specified with setFontFamily(String) (if any) is unavailable.

Parameters
fontGenericFamily The generic family; one of the FONT_FAMILY_ constants defined above.

public void setFontScale (float fontScale)

Sets the font scale factor. The default is DEFAULT_FONT_SCALE.

public void setFontStyle (int fontStyle)

Sets the text font style.

Parameters
fontStyle The font style; one of the FONT_STYLE_ constants defined above.

public void setForegroundColor (int foregroundColor)

Sets the text's foreground color.

Parameters
foregroundColor The color, as an ARGB value.

public void setWindowColor (int windowColor)

Sets the window's color.

Parameters
windowColor The color, as an ARGB value.

public void setWindowCornerRadius (int windowCornerRadius)

If the window type is WINDOW_TYPE_ROUNDED, sets the radius for the window's corners.

Parameters
windowCornerRadius The radius, in pixels. Must be a positive value.

public void setWindowType (int windowType)

Sets the window type.

Parameters
windowType The window type; one of the WINDOW_TYPE_ constants defined above.

public void writeToParcel (Parcel out, int flags)