Package com.castlabs.android.subtitles
Class SubtitlesStyle
- java.lang.Object
-
- com.castlabs.android.subtitles.SubtitlesStyle
-
- All Implemented Interfaces:
Parcelable
public class SubtitlesStyle extends Object implements 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
SubtitlesStyle.Builderand itsSubtitlesStyle.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 theoverwriteflag is set totrue, 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
Nested Classes Modifier and Type Class Description static classSubtitlesStyle.Builderstatic interfaceSubtitlesStyle.EdgeTypestatic interfaceSubtitlesStyle.ImageScalingMode-
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description intbackgroundColorThe text background color as ARGB.intbottomMarginThe margin in pixels applied to the subtitles located below the horizontal middle of the video viewstatic Parcelable.Creator<SubtitlesStyle>CREATORstatic intDEFAULT_BACKGROUND_COLORThe default background colorstatic intDEFAULT_BOTTOM_MARGINThe default bottom margin in pixelsstatic booleanDEFAULT_DRAW_BEYOND_VIDEO_AREAThe default draw beyond video area flagstatic intDEFAULT_EDGE_BLUR_RADIUSThe default edge blur radius in pixelsstatic intDEFAULT_EDGE_COLORThe default edge colorstatic intDEFAULT_EDGE_THICKNESSThe default edge thickness in pixelsstatic intDEFAULT_EDGE_TYPEThe default edge typestatic floatDEFAULT_FONT_SCALEThe default font scalestatic intDEFAULT_FOREGROUND_COLORThe default foreground colorstatic intDEFAULT_IMAGE_SCALING_MODEDefault value for image scaling modestatic intDEFAULT_LEFT_MARGINThe default left margin in pixelsstatic intDEFAULT_REGION_COLORThe default region colorstatic intDEFAULT_RIGHT_MARGINThe default right margin in pixelsstatic intDEFAULT_TOP_MARGINThe default top margin in pixelsstatic TypefaceDEFAULT_TYPEFACEThe default typeface.static intDEFAULT_WINDOW_COLORThe default window colorbooleandrawBeyondVideoAreaEnable 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 intEDGE_TYPE_DEPRESSEDEdge type value specifying depressed bevel character edges.static intEDGE_TYPE_DROP_SHADOWEdge type value specifying drop-shadowed character edges.static intEDGE_TYPE_NONEEdge type value specifying no character edges.static intEDGE_TYPE_OUTLINEEdge type value specifying uniformly outlined character edges.static intEDGE_TYPE_RAISEDEdge type value specifying raised bevel character edges.intedgeBlurRadiusThe edge blur radius in pixels.intedgeColorThe edge color as ARGB.intedgeThicknessThe edge thickness in pixels.intedgeTypeThe Edge Type as one ofEDGE_TYPE_NONE,EDGE_TYPE_OUTLINE,EDGE_TYPE_DROP_SHADOW,EDGE_TYPE_RAISED, orEDGE_TYPE_DEPRESSEDfloatfontScaleThe font size scaling factorintfontSizeThe font size in pixels.intforegroundColorThe text foreground color as ARGB.booleanhasBackgroundColorTrue if thebackgroundColorwas customized by the user and the setting should overwrite any content styles.booleanhasEdgeBlurRadiusTrue if theedgeBlurRadiuswas customized by the user and the setting should overwrite any content styles.booleanhasEdgeColorTrue if theedgeColorwas customized by the user and the setting should overwrite any content styles.booleanhasEdgeThicknessTrue if theedgeThicknesswas customized by the user and the setting should overwrite any content styles.booleanhasEdgeTypeTrue if theedgeTypewas customized by the user and the setting should overwrite any content styles.booleanhasFontSizeTrue if thefontSizewas customized by the user and the setting should overwrite any content styles.booleanhasForegroundColorTrue if theforegroundColorwas customized by the user and the setting should overwrite any content styles.booleanhasRegionColorTrue if theregionColorwas customized by the user and the setting should overwrite any content styles.booleanhasTypefaceTrue if thetypefacewas customized by the user and the setting should overwrite any content styles.booleanhasWindowColorTrue if thewindowColorwas customized by the user and the setting should overwrite any content styles.static intIMAGE_SCALE_FILLImage scale mode specifying image will fill the container without taking aspect ratio into consideration.static intIMAGE_SCALE_FITImage scale mode specifying image will be scaled as big as possible inside the container but keeping aspect ratio.static intIMAGE_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.static intIMAGE_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.intimageScalingModeThe image scaling mode for pre rendered subtitle images as one ofIMAGE_SCALE_FILL,IMAGE_SCALE_WIDTH_BOTTOM,IMAGE_SCALE_WIDTH_TOPorIMAGE_SCALE_FITintleftMarginThe margin in pixels applied to the subtitles located to the left of the vertical middle of the video viewintregionColorThe region color as ARGB.intrightMarginThe margin in pixels applied to the subtitles located to the right of the vertical middle of the video viewinttopMarginThe margin in pixels applied to the subtitles located above the horizontal middle of the video viewTypefacetypefaceintwindowColorThe window color as ARGB.-
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdescribeContents()booleanequals(Object o)inthashCode()voidwriteToParcel(Parcel dest, int flags)
-
-
-
Field Detail
-
IMAGE_SCALE_FILL
public static final int IMAGE_SCALE_FILL
Image scale mode specifying image will fill the container without taking aspect ratio into consideration. This is the default behaviour.- See Also:
- Constant Field Values
-
IMAGE_SCALE_WIDTH_BOTTOM
public static final int IMAGE_SCALE_WIDTH_BOTTOM
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. Image will be aligned at the bottom of the container.- See Also:
- Constant Field Values
-
IMAGE_SCALE_WIDTH_TOP
public static final int IMAGE_SCALE_WIDTH_TOP
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. Image will be aligned at the top of the container.- See Also:
- Constant Field Values
-
IMAGE_SCALE_FIT
public static final int IMAGE_SCALE_FIT
Image scale mode specifying image will be scaled as big as possible inside the container but keeping aspect ratio.- See Also:
- Constant Field Values
-
EDGE_TYPE_NONE
public static final int EDGE_TYPE_NONE
Edge type value specifying no character edges.- See Also:
- Constant Field Values
-
EDGE_TYPE_OUTLINE
public static final int EDGE_TYPE_OUTLINE
Edge type value specifying uniformly outlined character edges.- See Also:
- Constant Field Values
-
EDGE_TYPE_DROP_SHADOW
public static final int EDGE_TYPE_DROP_SHADOW
Edge type value specifying drop-shadowed character edges.- See Also:
- Constant Field Values
-
EDGE_TYPE_RAISED
public static final int EDGE_TYPE_RAISED
Edge type value specifying raised bevel character edges.- See Also:
- Constant Field Values
-
EDGE_TYPE_DEPRESSED
public static final int EDGE_TYPE_DEPRESSED
Edge type value specifying depressed bevel character edges.- See Also:
- Constant Field Values
-
DEFAULT_FOREGROUND_COLOR
public static int DEFAULT_FOREGROUND_COLOR
The default foreground color
-
DEFAULT_BACKGROUND_COLOR
public static int DEFAULT_BACKGROUND_COLOR
The default background color
-
DEFAULT_WINDOW_COLOR
public static int DEFAULT_WINDOW_COLOR
The default window color
-
DEFAULT_EDGE_COLOR
public static int DEFAULT_EDGE_COLOR
The default edge color
-
DEFAULT_REGION_COLOR
public static int DEFAULT_REGION_COLOR
The default region color
-
DEFAULT_EDGE_THICKNESS
public static int DEFAULT_EDGE_THICKNESS
The default edge thickness in pixels
-
DEFAULT_EDGE_BLUR_RADIUS
public static int DEFAULT_EDGE_BLUR_RADIUS
The default edge blur radius in pixels
-
DEFAULT_EDGE_TYPE
public static int DEFAULT_EDGE_TYPE
The default edge type
-
DEFAULT_FONT_SCALE
public static float DEFAULT_FONT_SCALE
The default font scale
-
DEFAULT_BOTTOM_MARGIN
public static int DEFAULT_BOTTOM_MARGIN
The default bottom margin in pixels
-
DEFAULT_TOP_MARGIN
public static int DEFAULT_TOP_MARGIN
The default top margin in pixels
-
DEFAULT_LEFT_MARGIN
public static int DEFAULT_LEFT_MARGIN
The default left margin in pixels
-
DEFAULT_RIGHT_MARGIN
public static int DEFAULT_RIGHT_MARGIN
The default right margin in pixels
-
DEFAULT_DRAW_BEYOND_VIDEO_AREA
public static boolean DEFAULT_DRAW_BEYOND_VIDEO_AREA
The default draw beyond video area flag
-
DEFAULT_TYPEFACE
@NonNull public static Typeface DEFAULT_TYPEFACE
The default typeface. NULL us not permitted.
-
DEFAULT_IMAGE_SCALING_MODE
public static final int DEFAULT_IMAGE_SCALING_MODE
Default value for image scaling mode- See Also:
- Constant Field Values
-
foregroundColor
public final int foregroundColor
The text foreground color as ARGB. This also contains the alpha/opacity component of the color.
-
backgroundColor
public final int backgroundColor
The text background color as ARGB. This also contains the alpha/opacity component of the color.
-
windowColor
public final int windowColor
The window color as ARGB. This also contains the alpha/opacity component of the color.
-
edgeColor
public final int edgeColor
The edge color as ARGB. This also contains the alpha/opacity component of the color.
-
regionColor
public final int regionColor
The 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 edgeType
The Edge Type as one ofEDGE_TYPE_NONE,EDGE_TYPE_OUTLINE,EDGE_TYPE_DROP_SHADOW,EDGE_TYPE_RAISED, orEDGE_TYPE_DEPRESSED
-
edgeThickness
public final int edgeThickness
The edge thickness in pixels.
-
edgeBlurRadius
public final int edgeBlurRadius
The edge blur radius in pixels.
-
typeface
@NonNull public final Typeface typeface
-
fontScale
public final float fontScale
The font size scaling factor
-
fontSize
public final int fontSize
The font size in pixels. Note that thefontScalewill still be applied to the font size
-
hasFontSize
public final boolean hasFontSize
True if thefontSizewas customized by the user and the setting should overwrite any content styles.
-
hasForegroundColor
public final boolean hasForegroundColor
True if theforegroundColorwas customized by the user and the setting should overwrite any content styles.
-
hasBackgroundColor
public final boolean hasBackgroundColor
True if thebackgroundColorwas customized by the user and the setting should overwrite any content styles.
-
hasWindowColor
public final boolean hasWindowColor
True if thewindowColorwas customized by the user and the setting should overwrite any content styles.
-
hasEdgeColor
public final boolean hasEdgeColor
True if theedgeColorwas customized by the user and the setting should overwrite any content styles.
-
hasEdgeType
public final boolean hasEdgeType
True if theedgeTypewas customized by the user and the setting should overwrite any content styles.
-
hasEdgeThickness
public final boolean hasEdgeThickness
True if theedgeThicknesswas customized by the user and the setting should overwrite any content styles.
-
hasEdgeBlurRadius
public final boolean hasEdgeBlurRadius
True if theedgeBlurRadiuswas customized by the user and the setting should overwrite any content styles.
-
hasTypeface
public final boolean hasTypeface
True if thetypefacewas customized by the user and the setting should overwrite any content styles.
-
hasRegionColor
public final boolean hasRegionColor
True if theregionColorwas customized by the user and the setting should overwrite any content styles.
-
bottomMargin
public final int bottomMargin
The margin in pixels applied to the subtitles located below the horizontal middle of the video view
-
topMargin
public final int topMargin
The margin in pixels applied to the subtitles located above the horizontal middle of the video view
-
leftMargin
public final int leftMargin
The margin in pixels applied to the subtitles located to the left of the vertical middle of the video view
-
rightMargin
public final int rightMargin
The margin in pixels applied to the subtitles located to the right of the vertical middle of the video view
-
imageScalingMode
public final int imageScalingMode
The image scaling mode for pre rendered subtitle images as one ofIMAGE_SCALE_FILL,IMAGE_SCALE_WIDTH_BOTTOM,IMAGE_SCALE_WIDTH_TOPorIMAGE_SCALE_FIT
-
drawBeyondVideoArea
public final boolean drawBeyondVideoArea
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 area
-
CREATOR
public static final Parcelable.Creator<SubtitlesStyle> CREATOR
-
-
Method Detail
-
describeContents
public int describeContents()
- Specified by:
describeContentsin interfaceParcelable
-
writeToParcel
public void writeToParcel(Parcel dest, int flags)
- Specified by:
writeToParcelin interfaceParcelable
-
-