You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I am trying to add subtitle options into my app, however I am missing the option to set the outline width as CaptionStyleCompat does not include it. It looks like SubtitlePainter sets these to Math.round((2f * displayMetrics.densityDpi) / DisplayMetrics.DENSITY_DEFAULT); and has no options to change it in runtime.
Proposed solution
Simply add outlineWidth/shadowRadius/shadowOffset as an option in CaptionStyleCompat and use those in SubtitlePainter.
Alternatives considered
Remove final from SubtitleView and SubtitlePainter so users can override specific parts.
The text was updated successfully, but these errors were encountered:
I'm afraid we won't be adding additional properties to this class.
Remove final from SubtitleView and SubtitlePainter so users can override specific parts.
These classes are not designed for to be inherited from, so it's deliberately forbidden. See Item 19 of Effective Java 3rd Edition: "Design and document for inheritance or else prohibit it".
I think the 'right' way to support customising this property of subtitles is to add it to Cue (either as a cue-level property, or a (possibly custom) styling span inside Cue.text) and update SubtitlePainter to respect this property (in the same way it considers e.g. the foreground color from both Cue and CaptionStyleCompat). This would be done as part of #9391 (in addition to parsing it from the TTML source file).
If this was done, you could then either use TTML subtitles to get support for this property, or mutate Cue objects before they're displayed on the screen to set this property, as described in #7243 (comment).
Given this is a subset of the work required for #9391, I'm going to mark it as a duplicate.
Missing outlineWidth option
Currently I am trying to add subtitle options into my app, however I am missing the option to set the outline width as CaptionStyleCompat does not include it. It looks like SubtitlePainter sets these to
Math.round((2f * displayMetrics.densityDpi) / DisplayMetrics.DENSITY_DEFAULT);
and has no options to change it in runtime.Proposed solution
Simply add outlineWidth/shadowRadius/shadowOffset as an option in CaptionStyleCompat and use those in SubtitlePainter.
Alternatives considered
Remove final from SubtitleView and SubtitlePainter so users can override specific parts.
The text was updated successfully, but these errors were encountered: