Class SubtitlesStyle.Builder
java.lang.Object
com.castlabs.subtitles.presentation.SubtitlesStyle.Builder
- Enclosing class:
- SubtitlesStyle
-
Method Summary
Modifier and TypeMethodDescriptionbackgroundColor
(int backgroundColor, boolean overwrite) Set the background color as ARGB.backgroundColorRGB
(int backgroundColor, boolean overwrite) Set the background color as RGB.backgroundOpacity
(float opacity) Set the opacity of the background color.bottomMargin
(int bottomMarginPx) Set the bottom margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPluginstatic SubtitlesStyle.Builder
Create a new instance of this builder.static SubtitlesStyle.Builder
create
(SubtitlesStyle subtitlesStyle) Create a new instance of this builder based on the provided subtitle style.disableAutoFlowText
(boolean disableAutoFlowText) If set to true the auto-flow text behaviour will be disabled regardless of the font-size and the font-scale.drawBeyondVideoArea
(boolean drawBeyondVideoArea) Enable or disable the drawing beyond video area, default isfalse
Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPluginedgeBlurRadius
(int edgeBlurRadius, boolean overwrite) Set the edge blur radius in pixels.edgeColor
(int edgeColor, boolean overwrite) Set the edge color as ARGB.edgeColorRGB
(int edgeColor, boolean overwrite) Set the edge color as RGB.edgeThickness
(int edgeThickness, boolean overwrite) Set the edge thickness in pixels.edgeType
(int edgeType, boolean overwrite) fontScale
(float fontScale) Set the font scale.fontSize
(int fontSize, boolean overwrite) Set the font size in pixelsforegroundColor
(int foregroundColor, boolean overwrite) Set the foreground color as ARGB.foregroundColorRGB
(int foregroundColor, boolean overwrite) Set the foreground color as RGBforegroundOpacity
(float opacity) Set the opacity of the foreground color.get()
Create and return the new style from this builder.imageScalingMode
(int imageScalingMode) Set the Image scaling mode for pre rendered subtitle imagesleftMargin
(int leftMarginPx) Set the left margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPluginregionColor
(int regionColor, boolean overwrite) Set the region color as ARGB.regionOpacity
(float opacity) Set the opacity of the region color.rightMargin
(int rightMarginPx) Set the right margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPlugintopMargin
(int topMarginPx) Set the top margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPluginSet the typeface.windowColor
(int windowColor, boolean overwrite) Set the window color as ARGB.windowColorRGB
(int windowColor, boolean overwrite) Set the window color as RGB.windowOpacity
(float opacity) Set the opacity of the window color.
-
Method Details
-
foregroundColor
Set the foreground color as ARGB. Note that this overwrite the current opacity setting.- Parameters:
foregroundColor
- The color as ARGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasForegroundColor
will be set totrue
- Returns:
- The builder
-
foregroundColorRGB
Set the foreground color as RGB- Parameters:
foregroundColor
- The color as RGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasForegroundColor
will be set totrue
- Returns:
- The builder
-
backgroundColor
Set the background color as ARGB. Note that this overwrite the current opacity setting.- Parameters:
backgroundColor
- The color as ARGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasBackgroundColor
will be set totrue
- Returns:
- The builder
-
backgroundColorRGB
Set the background color as RGB.- Parameters:
backgroundColor
- The color as RGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasBackgroundColor
will be set totrue
- Returns:
- The builder
-
windowColor
Set the window color as ARGB. Note that this overwrite the current opacity setting.- Parameters:
windowColor
- The color as ARGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasWindowColor
will be set totrue
- Returns:
- The builder
-
windowColorRGB
Set the window color as RGB.- Parameters:
windowColor
- The color as RGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasWindowColor
will be set totrue
- Returns:
- The builder
-
edgeColor
Set the edge color as ARGB. Note that this overwrite the current opacity setting.- Parameters:
edgeColor
- The color as ARGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasEdgeColor
will be set totrue
- Returns:
- The builder
-
edgeThickness
Set the edge thickness in pixels.- Parameters:
edgeThickness
- The edge thickness in pixelsoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasEdgeThickness
will be set totrue
- Returns:
- The builder
-
edgeBlurRadius
Set the edge blur radius in pixels.- Parameters:
edgeBlurRadius
- The edge blur radius in pixelsoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasEdgeBlurRadius
will be set totrue
- Returns:
- The builder
-
regionColor
Set the region color as ARGB. Note that this overwrite the current opacity setting.- Parameters:
regionColor
- The color as ARGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasRegionColor
will be set totrue
- Returns:
- The builder
-
regionOpacity
Set the opacity of the region color. The values needs to be 0 <= value <= 1.0.- Parameters:
opacity
- The opacity as 0 <= value <= 1.0- Returns:
- The builder
-
bottomMargin
Set the bottom margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPlugin- Parameters:
bottomMarginPx
- The bottom margin in pixels- Returns:
- The builder
-
topMargin
Set the top margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPlugin- Parameters:
topMarginPx
- The top margin in pixels- Returns:
- The builder
-
leftMargin
Set the left margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPlugin- Parameters:
leftMarginPx
- The left margin in pixels- Returns:
- The builder
-
rightMargin
Set the right margin in pixels, default is zero Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPlugin- Parameters:
rightMarginPx
- The right margin in pixels- Returns:
- The builder
-
drawBeyondVideoArea
Enable or disable the drawing beyond video area, default isfalse
Note: not supported by com.castlabs.android.player.ExoSubtitlesRendererPlugin- Parameters:
drawBeyondVideoArea
- The draw beyond video area flag- Returns:
- The builder
-
edgeColorRGB
Set the edge color as RGB.- Parameters:
edgeColor
- The color as RGBoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasEdgeColor
will be set totrue
- Returns:
- The builder
-
edgeType
Set the edge type to one ofSubtitlesStyle.EDGE_TYPE_NONE
,SubtitlesStyle.EDGE_TYPE_OUTLINE
,SubtitlesStyle.EDGE_TYPE_DROP_SHADOW
,SubtitlesStyle.EDGE_TYPE_RAISED
, orSubtitlesStyle.EDGE_TYPE_DEPRESSED
.- Parameters:
edgeType
- The edge typeoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasEdgeType
will be set totrue
- Returns:
- The builder
-
fontScale
Set the font scale. The value has to be > 0, otherwise the builder will fall back to the default font scale.- Parameters:
fontScale
- The font scale- Returns:
- The builder
-
fontSize
Set the font size in pixels- Parameters:
fontSize
- The fontSizeoverwrite
- If true, this is considers a user customization and theSubtitlesStyle.hasFontSize
will be set totrue
- Returns:
- The builder
-
typeface
Set the typeface.SubtitlesStyle.hasTypeface
will be set to true if the given typeface is not equal to the default type face. If null is passed, the typeface will be set to the default typeface.- Parameters:
typeface
- The typeface- Returns:
- The builder
-
disableAutoFlowText
If set to true the auto-flow text behaviour will be disabled regardless of the font-size and the font-scale.- Parameters:
disableAutoFlowText
- The value- Returns:
- The builder
-
foregroundOpacity
Set the opacity of the foreground color. The values needs to be 0 <= value <= 1.0.- Parameters:
opacity
- The opacity as 0 <= value <= 1.0- Returns:
- The builder
-
backgroundOpacity
Set the opacity of the background color. The values needs to be 0 <= value <= 1.0.- Parameters:
opacity
- The opacity as 0 <= value <= 1.0- Returns:
- The builder
-
windowOpacity
Set the opacity of the window color. The values needs to be 0 <= value <= 1.0.- Parameters:
opacity
- The opacity as 0 <= value <= 1.0- Returns:
- The builder
-
imageScalingMode
Set the Image scaling mode for pre rendered subtitle images- Parameters:
imageScalingMode
- the image scaling mode- Returns:
- The Builder
-
get
Create and return the new style from this builder.- Returns:
- The new style created by this builder
-
create
Create a new instance of this builder. IfuseSystemSettings
istrue
, the builder will be initialized based on the system configuration. Note that this only applies for Android API version >= 19.Please note that systems settings from API version >= 21 can be queried to check if a setting was overwritten by the user. For API versions 19 and 20, this is not possible, and the builder assumes that the system settings always overwrite the style.
- Parameters:
context
- The current contextuseSystemSettings
- If true, the builder will be initialized with the system settings- Returns:
- The builder
-
create
Create a new instance of this builder based on the provided subtitle style.- Parameters:
subtitlesStyle
- The subtitle style to create the builder from- Returns:
- The builder
-