Class WebvttCssStyle
- java.lang.Object
-
- com.google.android.exoplayer2.text.webvtt.WebvttCssStyle
-
public final class WebvttCssStyle extends Object
Style object of a Css style block in a Webvtt file.- See Also:
- W3C specification - Apply CSS properties
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceWebvttCssStyle.FontSizeUnitFont size unit enum.static interfaceWebvttCssStyle.StyleFlagsStyle flag enum.
-
Field Summary
Fields Modifier and Type Field Description static intFONT_SIZE_UNIT_EMstatic intFONT_SIZE_UNIT_PERCENTstatic intFONT_SIZE_UNIT_PIXELstatic intSTYLE_BOLDstatic intSTYLE_BOLD_ITALICstatic intSTYLE_ITALICstatic intSTYLE_NORMALstatic intUNSPECIFIED
-
Constructor Summary
Constructors Constructor Description WebvttCssStyle()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBackgroundColor()booleangetCombineUpright()intgetFontColor()StringgetFontFamily()floatgetFontSize()@com.google.android.exoplayer2.text.webvtt.WebvttCssStyle.FontSizeUnit intgetFontSizeUnit()@com.google.android.exoplayer2.text.span.TextAnnotation.Position intgetRubyPosition()intgetSpecificityScore(String id, String tag, Set<String> classes, String voice)Returns a value in a score system compliant with the CSS Specificity rules.@com.google.android.exoplayer2.text.webvtt.WebvttCssStyle.StyleFlags intgetStyle()Returns the style orUNSPECIFIEDwhen no style information is given.booleanhasBackgroundColor()booleanhasFontColor()booleanisLinethrough()booleanisUnderline()WebvttCssStylesetBackgroundColor(int backgroundColor)WebvttCssStylesetBold(boolean bold)WebvttCssStylesetCombineUpright(boolean enabled)WebvttCssStylesetFontColor(int color)WebvttCssStylesetFontFamily(String fontFamily)WebvttCssStylesetFontSize(float fontSize)WebvttCssStylesetFontSizeUnit(@com.google.android.exoplayer2.text.webvtt.WebvttCssStyle.FontSizeUnit int unit)WebvttCssStylesetItalic(boolean italic)WebvttCssStylesetLinethrough(boolean linethrough)WebvttCssStylesetRubyPosition(@com.google.android.exoplayer2.text.span.TextAnnotation.Position int rubyPosition)voidsetTargetClasses(String[] targetClasses)voidsetTargetId(String targetId)voidsetTargetTagName(String targetTag)voidsetTargetVoice(String targetVoice)WebvttCssStylesetUnderline(boolean underline)
-
-
-
Field Detail
-
UNSPECIFIED
public static final int UNSPECIFIED
- See Also:
- Constant Field Values
-
STYLE_NORMAL
public static final int STYLE_NORMAL
- See Also:
- Constant Field Values
-
STYLE_BOLD
public static final int STYLE_BOLD
- See Also:
- Constant Field Values
-
STYLE_ITALIC
public static final int STYLE_ITALIC
- See Also:
- Constant Field Values
-
STYLE_BOLD_ITALIC
public static final int STYLE_BOLD_ITALIC
- See Also:
- Constant Field Values
-
FONT_SIZE_UNIT_PIXEL
public static final int FONT_SIZE_UNIT_PIXEL
- See Also:
- Constant Field Values
-
FONT_SIZE_UNIT_EM
public static final int FONT_SIZE_UNIT_EM
- See Also:
- Constant Field Values
-
FONT_SIZE_UNIT_PERCENT
public static final int FONT_SIZE_UNIT_PERCENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setTargetId
public void setTargetId(String targetId)
-
setTargetTagName
public void setTargetTagName(String targetTag)
-
setTargetClasses
public void setTargetClasses(String[] targetClasses)
-
setTargetVoice
public void setTargetVoice(String targetVoice)
-
getSpecificityScore
public int getSpecificityScore(@Nullable String id, @Nullable String tag, Set<String> classes, @Nullable String voice)Returns a value in a score system compliant with the CSS Specificity rules.The score works as follows:
- Id match adds 0x40000000 to the score.
- Each class and voice match adds 4 to the score.
- Tag matching adds 2 to the score.
- Universal selector matching scores 1.
- Parameters:
id- The id of the cue if present,nullotherwise.tag- Name of the tag,nullif it refers to the entire cue.classes- An array containing the classes the tag belongs to. Must not be null.voice- Annotated voice if present,nullotherwise.- Returns:
- The score of the match, zero if there is no match.
- See Also:
- CSS Cascading
-
getStyle
public @com.google.android.exoplayer2.text.webvtt.WebvttCssStyle.StyleFlags int getStyle()
Returns the style orUNSPECIFIEDwhen no style information is given.- Returns:
UNSPECIFIED,STYLE_NORMAL,STYLE_BOLD,STYLE_BOLDorSTYLE_BOLD_ITALIC.
-
isLinethrough
public boolean isLinethrough()
-
setLinethrough
public WebvttCssStyle setLinethrough(boolean linethrough)
-
isUnderline
public boolean isUnderline()
-
setUnderline
public WebvttCssStyle setUnderline(boolean underline)
-
setBold
public WebvttCssStyle setBold(boolean bold)
-
setItalic
public WebvttCssStyle setItalic(boolean italic)
-
getFontFamily
@Nullable public String getFontFamily()
-
setFontFamily
public WebvttCssStyle setFontFamily(@Nullable String fontFamily)
-
getFontColor
public int getFontColor()
-
setFontColor
public WebvttCssStyle setFontColor(int color)
-
hasFontColor
public boolean hasFontColor()
-
getBackgroundColor
public int getBackgroundColor()
-
setBackgroundColor
public WebvttCssStyle setBackgroundColor(int backgroundColor)
-
hasBackgroundColor
public boolean hasBackgroundColor()
-
setFontSize
public WebvttCssStyle setFontSize(float fontSize)
-
setFontSizeUnit
public WebvttCssStyle setFontSizeUnit(@com.google.android.exoplayer2.text.webvtt.WebvttCssStyle.FontSizeUnit int unit)
-
getFontSizeUnit
public @com.google.android.exoplayer2.text.webvtt.WebvttCssStyle.FontSizeUnit int getFontSizeUnit()
-
getFontSize
public float getFontSize()
-
setRubyPosition
public WebvttCssStyle setRubyPosition(@com.google.android.exoplayer2.text.span.TextAnnotation.Position int rubyPosition)
-
getRubyPosition
public @com.google.android.exoplayer2.text.span.TextAnnotation.Position int getRubyPosition()
-
setCombineUpright
public WebvttCssStyle setCombineUpright(boolean enabled)
-
getCombineUpright
public boolean getCombineUpright()
-
-