private void setTextSize(@Cue.TextSizeType int textSizeType, float textSize) { if (this.textSizeType == textSizeType && this.textSize == textSize) { return; } this.textSizeType = textSizeType; this.textSize = textSize; // Invalidate to trigger drawing. invalidate(); }
/** * Sets the caption style. * * @param style A style for the view. */ public void setStyle(CaptionStyleCompat style) { if (this.style == style) { return; } this.style = style; // Invalidate to trigger drawing. invalidate(); }
/** * Sets whether font sizes embedded within the cues should be applied. Enabled by default. * Only takes effect if {@link SubtitleView#setApplyEmbeddedStyles} is set to true. * * @param applyEmbeddedFontSizes Whether font sizes embedded within the cues should be applied. */ public void setApplyEmbeddedFontSizes(boolean applyEmbeddedFontSizes) { if (this.applyEmbeddedFontSizes == applyEmbeddedFontSizes) { return; } this.applyEmbeddedFontSizes = applyEmbeddedFontSizes; // Invalidate to trigger drawing. invalidate(); }
/** * Sets the bottom padding fraction to apply when {@link Cue#line} is {@link Cue#DIMEN_UNSET}, * as a fraction of the view's remaining height after its top and bottom padding have been * subtracted. * <p> * Note that this padding is applied in addition to any standard view padding. * * @param bottomPaddingFraction The bottom padding fraction. */ public void setBottomPaddingFraction(float bottomPaddingFraction) { if (this.bottomPaddingFraction == bottomPaddingFraction) { return; } this.bottomPaddingFraction = bottomPaddingFraction; // Invalidate to trigger drawing. invalidate(); }
/** * Sets whether styling embedded within the cues should be applied. Enabled by default. * Overrides any setting made with {@link SubtitleView#setApplyEmbeddedFontSizes}. * * @param applyEmbeddedStyles Whether styling embedded within the cues should be applied. */ public void setApplyEmbeddedStyles(boolean applyEmbeddedStyles) { if (this.applyEmbeddedStyles == applyEmbeddedStyles && this.applyEmbeddedFontSizes == applyEmbeddedStyles) { return; } this.applyEmbeddedStyles = applyEmbeddedStyles; this.applyEmbeddedFontSizes = applyEmbeddedStyles; // Invalidate to trigger drawing. invalidate(); }
/** * Sets the cues to be displayed by the view. * * @param cues The cues to display, or null to clear the cues. */ public void setCues(@Nullable List<Cue> cues) { if (this.cues == cues) { return; } this.cues = cues; // Ensure we have sufficient painters. int cueCount = (cues == null) ? 0 : cues.size(); while (painters.size() < cueCount) { painters.add(new SubtitlePainter(getContext())); } // Invalidate to trigger drawing. invalidate(); }