Class 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:

    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
    • 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.
      • 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 the fontScale will still be applied to the font size
      • hasFontSize

        public final boolean hasFontSize
        True if the fontSize was customized by the user and the setting should overwrite any content styles.
      • hasForegroundColor

        public final boolean hasForegroundColor
        True if the foregroundColor was customized by the user and the setting should overwrite any content styles.
      • hasBackgroundColor

        public final boolean hasBackgroundColor
        True if the backgroundColor was customized by the user and the setting should overwrite any content styles.
      • hasWindowColor

        public final boolean hasWindowColor
        True if the windowColor was customized by the user and the setting should overwrite any content styles.
      • hasEdgeColor

        public final boolean hasEdgeColor
        True if the edgeColor was customized by the user and the setting should overwrite any content styles.
      • hasEdgeType

        public final boolean hasEdgeType
        True if the edgeType was customized by the user and the setting should overwrite any content styles.
      • hasEdgeThickness

        public final boolean hasEdgeThickness
        True if the edgeThickness was customized by the user and the setting should overwrite any content styles.
      • hasEdgeBlurRadius

        public final boolean hasEdgeBlurRadius
        True if the edgeBlurRadius was customized by the user and the setting should overwrite any content styles.
      • hasTypeface

        public final boolean hasTypeface
        True if the typeface was customized by the user and the setting should overwrite any content styles.
      • hasRegionColor

        public final boolean hasRegionColor
        True if the regionColor was 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
      • 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