Class SubtitlesStyle
java.lang.Object
com.castlabs.subtitles.presentation.SubtitlesStyle
- All Implemented Interfaces:
Parcelable
This is the model class that contains all the styling information used by the
subtitles plugins to render subtitles and closed captions.
You can use the following static properties of this class to overwrite the defaults:
DEFAULT_FOREGROUND_COLOR
-- The default foreground color as ARGBDEFAULT_BACKGROUND_COLOR
-- The default background color as ARGBDEFAULT_WINDOW_COLOR
-- The default window color as ARGBDEFAULT_EDGE_COLOR
-- The default edge color as ARGBDEFAULT_EDGE_TYPE
-- The default edge typeDEFAULT_FONT_SCALE
-- The default font scaleDEFAULT_TYPEFACE
-- The default typeface
Instances of this class can be created using the SubtitlesStyle.Builder
and its
SubtitlesStyle.Builder.create(Context, boolean)
method.
When you use the Builder, you have the option to select of certain values overwrite the default
or not. This is used if subtitles support their own styling, i.e. TTML with styles. If the
overwrite flag is not set, the setting will be applied to un-styled subtitles, but styled subtitles
are still rendered accordingly. Of the overwrite
flag is set to true
, the
style will always be enforced and content based styles will not be applied, i.e. TTML styles
will be ignored.
- Since:
- 3.1.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static @interface
static @interface
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
Field Summary
Modifier and TypeFieldDescriptionfinal int
The text background color as ARGB.final int
The margin in pixels applied to the subtitles located below the horizontal middle of the video viewstatic final Parcelable.Creator<SubtitlesStyle>
static int
The default background colorstatic int
The default bottom margin in pixelsstatic boolean
The default draw beyond video area flagstatic int
The default edge blur radius in pixelsstatic int
The default edge colorstatic int
The default edge thickness in pixelsstatic int
The default edge typestatic float
The default font scalestatic int
The default foreground colorstatic final int
Default value for image scaling modestatic int
The default left margin in pixelsstatic int
The default region colorstatic int
The default right margin in pixelsstatic int
The default top margin in pixelsstatic Typeface
The default typeface.static int
The default window colorfinal boolean
If set to true the auto-flow text behaviour will be disabled regardless of the font-size and the font-scale.final boolean
Enable drawing beyond the video area therefore in case of video area and canvas area (video container) aspect mismatch, the text will go beyond the video areastatic final int
Edge type value specifying depressed bevel character edges.static final int
Edge type value specifying drop-shadowed character edges.static final int
Edge type value specifying no character edges.static final int
Edge type value specifying uniformly outlined character edges.static final int
Edge type value specifying raised bevel character edges.final int
The edge blur radius in pixels.final int
The edge color as ARGB.final int
The edge thickness in pixels.final int
The Edge Type as one ofEDGE_TYPE_NONE
,EDGE_TYPE_OUTLINE
,EDGE_TYPE_DROP_SHADOW
,EDGE_TYPE_RAISED
, orEDGE_TYPE_DEPRESSED
final float
The font size scaling factorfinal int
The font size in pixels.final int
The text foreground color as ARGB.final boolean
True if thebackgroundColor
was customized by the user and the setting should overwrite any content styles.final boolean
True if theedgeBlurRadius
was customized by the user and the setting should overwrite any content styles.final boolean
True if theedgeColor
was customized by the user and the setting should overwrite any content styles.final boolean
True if theedgeThickness
was customized by the user and the setting should overwrite any content styles.final boolean
True if theedgeType
was customized by the user and the setting should overwrite any content styles.final boolean
True if thefontSize
was customized by the user and the setting should overwrite any content styles.final boolean
True if theforegroundColor
was customized by the user and the setting should overwrite any content styles.final boolean
True if theregionColor
was customized by the user and the setting should overwrite any content styles.final boolean
True if thetypeface
was customized by the user and the setting should overwrite any content styles.final boolean
True if thewindowColor
was customized by the user and the setting should overwrite any content styles.static final int
Image scale mode specifying image will fill the container without taking aspect ratio into consideration.static final int
Image scale mode specifying image will be scaled as big as possible inside the container but keeping aspect ratio.static final int
Image scale mode specifying image will be scaled to fill width of container and its height will be scaled keeping the aspect ratio, even if it results higher than the container.static final int
Image scale mode specifying image will be scaled to fill width of container and its height will be scaled keeping the aspect ratio, even if it results higher than the container.final int
The image scaling mode for pre rendered subtitle images as one ofIMAGE_SCALE_FILL
,IMAGE_SCALE_WIDTH_BOTTOM
,IMAGE_SCALE_WIDTH_TOP
orIMAGE_SCALE_FIT
final int
The margin in pixels applied to the subtitles located to the left of the vertical middle of the video viewfinal int
The region color as ARGB.final int
The margin in pixels applied to the subtitles located to the right of the vertical middle of the video viewfinal int
The margin in pixels applied to the subtitles located above the horizontal middle of the video viewfinal Typeface
final int
The window color as ARGB.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
hashCode()
void
writeToParcel
(Parcel dest, int flags)
-
Field Details
-
IMAGE_SCALE_FILL
public static final int IMAGE_SCALE_FILLImage scale mode specifying image will fill the container without taking aspect ratio into consideration. This is the default behaviour.- See Also:
-
IMAGE_SCALE_WIDTH_BOTTOM
public static final int IMAGE_SCALE_WIDTH_BOTTOMImage scale mode specifying image will be scaled to fill width of container and its height will be scaled keeping the aspect ratio, even if it results higher than the container. Image will be aligned at the bottom of the container.- See Also:
-
IMAGE_SCALE_WIDTH_TOP
public static final int IMAGE_SCALE_WIDTH_TOPImage scale mode specifying image will be scaled to fill width of container and its height will be scaled keeping the aspect ratio, even if it results higher than the container. Image will be aligned at the top of the container.- See Also:
-
IMAGE_SCALE_FIT
public static final int IMAGE_SCALE_FITImage scale mode specifying image will be scaled as big as possible inside the container but keeping aspect ratio.- See Also:
-
EDGE_TYPE_NONE
public static final int EDGE_TYPE_NONEEdge type value specifying no character edges.- See Also:
-
EDGE_TYPE_OUTLINE
public static final int EDGE_TYPE_OUTLINEEdge type value specifying uniformly outlined character edges.- See Also:
-
EDGE_TYPE_DROP_SHADOW
public static final int EDGE_TYPE_DROP_SHADOWEdge type value specifying drop-shadowed character edges.- See Also:
-
EDGE_TYPE_RAISED
public static final int EDGE_TYPE_RAISEDEdge type value specifying raised bevel character edges.- See Also:
-
EDGE_TYPE_DEPRESSED
public static final int EDGE_TYPE_DEPRESSEDEdge type value specifying depressed bevel character edges.- See Also:
-
DEFAULT_FOREGROUND_COLOR
public static int DEFAULT_FOREGROUND_COLORThe default foreground color -
DEFAULT_BACKGROUND_COLOR
public static int DEFAULT_BACKGROUND_COLORThe default background color -
DEFAULT_WINDOW_COLOR
public static int DEFAULT_WINDOW_COLORThe default window color -
DEFAULT_EDGE_COLOR
public static int DEFAULT_EDGE_COLORThe default edge color -
DEFAULT_REGION_COLOR
public static int DEFAULT_REGION_COLORThe default region color -
DEFAULT_EDGE_THICKNESS
public static int DEFAULT_EDGE_THICKNESSThe default edge thickness in pixels -
DEFAULT_EDGE_BLUR_RADIUS
public static int DEFAULT_EDGE_BLUR_RADIUSThe default edge blur radius in pixels -
DEFAULT_EDGE_TYPE
public static int DEFAULT_EDGE_TYPEThe default edge type -
DEFAULT_FONT_SCALE
public static float DEFAULT_FONT_SCALEThe default font scale -
DEFAULT_BOTTOM_MARGIN
public static int DEFAULT_BOTTOM_MARGINThe default bottom margin in pixels -
DEFAULT_TOP_MARGIN
public static int DEFAULT_TOP_MARGINThe default top margin in pixels -
DEFAULT_LEFT_MARGIN
public static int DEFAULT_LEFT_MARGINThe default left margin in pixels -
DEFAULT_RIGHT_MARGIN
public static int DEFAULT_RIGHT_MARGINThe default right margin in pixels -
DEFAULT_DRAW_BEYOND_VIDEO_AREA
public static boolean DEFAULT_DRAW_BEYOND_VIDEO_AREAThe default draw beyond video area flag -
DEFAULT_TYPEFACE
The default typeface. NULL us not permitted. -
DEFAULT_IMAGE_SCALING_MODE
public static final int DEFAULT_IMAGE_SCALING_MODEDefault value for image scaling mode- See Also:
-
foregroundColor
public final int foregroundColorThe text foreground color as ARGB. This also contains the alpha/opacity component of the color. -
backgroundColor
public final int backgroundColorThe text background color as ARGB. This also contains the alpha/opacity component of the color. -
windowColor
public final int windowColorThe window color as ARGB. This also contains the alpha/opacity component of the color. -
edgeColor
public final int edgeColorThe edge color as ARGB. This also contains the alpha/opacity component of the color. -
regionColor
public final int regionColorThe region color as ARGB. This also contains the alpha/opacity component of the color. This color can be used to overwrite any TTML span or region background colors. -
edgeType
public final int edgeTypeThe Edge Type as one ofEDGE_TYPE_NONE
,EDGE_TYPE_OUTLINE
,EDGE_TYPE_DROP_SHADOW
,EDGE_TYPE_RAISED
, orEDGE_TYPE_DEPRESSED
-
edgeThickness
public final int edgeThicknessThe edge thickness in pixels. -
edgeBlurRadius
public final int edgeBlurRadiusThe edge blur radius in pixels. -
typeface
-
fontScale
public final float fontScaleThe font size scaling factor -
fontSize
public final int fontSizeThe font size in pixels. Note that thefontScale
will still be applied to the font size -
hasFontSize
public final boolean hasFontSizeTrue if thefontSize
was customized by the user and the setting should overwrite any content styles. -
disableAutoFlowText
public final boolean disableAutoFlowTextIf set to true the auto-flow text behaviour will be disabled regardless of the font-size and the font-scale. -
hasForegroundColor
public final boolean hasForegroundColorTrue if theforegroundColor
was customized by the user and the setting should overwrite any content styles. -
hasBackgroundColor
public final boolean hasBackgroundColorTrue if thebackgroundColor
was customized by the user and the setting should overwrite any content styles. -
hasWindowColor
public final boolean hasWindowColorTrue if thewindowColor
was customized by the user and the setting should overwrite any content styles. -
hasEdgeColor
public final boolean hasEdgeColorTrue if theedgeColor
was customized by the user and the setting should overwrite any content styles. -
hasEdgeType
public final boolean hasEdgeTypeTrue if theedgeType
was customized by the user and the setting should overwrite any content styles. -
hasEdgeThickness
public final boolean hasEdgeThicknessTrue if theedgeThickness
was customized by the user and the setting should overwrite any content styles. -
hasEdgeBlurRadius
public final boolean hasEdgeBlurRadiusTrue if theedgeBlurRadius
was customized by the user and the setting should overwrite any content styles. -
hasTypeface
public final boolean hasTypefaceTrue if thetypeface
was customized by the user and the setting should overwrite any content styles. -
hasRegionColor
public final boolean hasRegionColorTrue if theregionColor
was customized by the user and the setting should overwrite any content styles. -
bottomMargin
public final int bottomMarginThe margin in pixels applied to the subtitles located below the horizontal middle of the video view -
topMargin
public final int topMarginThe margin in pixels applied to the subtitles located above the horizontal middle of the video view -
leftMargin
public final int leftMarginThe margin in pixels applied to the subtitles located to the left of the vertical middle of the video view -
rightMargin
public final int rightMarginThe margin in pixels applied to the subtitles located to the right of the vertical middle of the video view -
imageScalingMode
public final int imageScalingModeThe image scaling mode for pre rendered subtitle images as one ofIMAGE_SCALE_FILL
,IMAGE_SCALE_WIDTH_BOTTOM
,IMAGE_SCALE_WIDTH_TOP
orIMAGE_SCALE_FIT
-
drawBeyondVideoArea
public final boolean drawBeyondVideoAreaEnable drawing beyond the video area therefore in case of video area and canvas area (video container) aspect mismatch, the text will go beyond the video area -
CREATOR
-
-
Constructor Details
-
SubtitlesStyle
-
-
Method Details
-
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcel
in interfaceParcelable
-
equals
-
hashCode
public int hashCode()
-