648 Commits

Author SHA1 Message Date
insun
b8e9f19b37 Add document for show_subtitle_button attribute
This also removes unused deprecated methods.

PiperOrigin-RevId: 320141729
2020-07-08 13:56:12 +01:00
insun
4fc45b92c0 Increase char limits for some string translations
And also replaced "Click" with "Tap" for CC button descriptions.

PiperOrigin-RevId: 319455553
2020-07-03 09:03:24 +01:00
Oliver Woodman
ab348c045c Merge pull request #7568 from juankysoriano:subtitles-font-size-bug
PiperOrigin-RevId: 319223173
2020-07-03 09:02:13 +01:00
tonihei
f8217140d7 Add missing null check.
The system services may return a null value if the service is
not available. Guard against this by falling back to default values.

PiperOrigin-RevId: 319187882
2020-07-03 09:01:37 +01:00
insun
22802506cd Minor changes regarding animation_enabled in StyledPlayerControlView.
- Removed unnecessary private method
- Revised document for animation_enabled attribute
- Added setAnimationEnabled/isAnimationEnabled in StyledPlayerControlView

PiperOrigin-RevId: 319054648
2020-07-03 09:01:03 +01:00
insun
a3bbcf3395 Add StyledPlayerView and StyledPlayerControlView into ui/
Moved ui2/ code and resources into ui/

PiperOrigin-RevId: 318984707
2020-07-03 09:00:10 +01:00
Juanky Soriano
5c096acc29 Use default text size if captioning manager is disabled
This fixes an issue where, even if captioning manager is disabled, the latest used captioning manager preference
related to text size is being applied.

In order to replicate:
1. Go to Captioning Preferences under device Settings and enable it
2. Change the text size to "very large"
3. Observe the selected text size is used for subtitles, for example in Youtube
4. Go to Captioning Preferences under device Settings and disable it
5. Observe the text size used for subtitles does not come back to normal, stays on "very large"
2020-07-01 00:15:31 -05:00
insun
d5f029315c Cleanup deprecated SimpleExoPlayerView and PlaybackControlView
PiperOrigin-RevId: 318152038
2020-06-26 11:14:13 +01:00
ibaker
54eccd3893 Change WebViewSubtitleOutput to use em not % for line offsets
The existing code moves a multi-line cue box by multiples of the height
of the whole cue box (incorrect), rather than multiples of the first
line of text (correct). These two are equivalent for single-line cues,
which is why I didn't initially spot the problem.

PiperOrigin-RevId: 318036793
2020-06-26 11:13:41 +01:00
ibaker
06c17f5152 Redefine numeric Cue.line in terms of viewport lines, ignore lineAnchor
Numerical lines conceptually map to a grid of lines in the viewport,
with the Cue text lines being aligned to one of the viewport lines.

It doesn't make sense to position a single-line cue differently based
on lineAnchor when it's expected to 'snap' to a particular line on the
viewport grid. So we redefine the position to be in terms of the cue
lines rather than the bounds of the cue box.

It's also not possible to always handle ANCHOR_TYPE_MIDDLE when
lineType=NUMBER (as it relies on the number of lines in the cue being
odd), so it's easier to ignore lineAnchor completely.
PiperOrigin-RevId: 318034664
2020-06-26 11:13:33 +01:00
samrobinson
836babd5d6 Replace usages of Charset.forName with Guava Charsets.
PiperOrigin-RevId: 317672619
2020-06-23 11:07:43 +01:00
olly
5aa8a7a507 Prevent shutter closing for within-window seeks to unprepared periods
Issue: #5507
PiperOrigin-RevId: 315512207
2020-06-11 10:10:18 +01:00
olly
c759b5b1a9 Add option to hide Prev/Rwnd/Ffwd/Next buttons
Issue: #7410
PiperOrigin-RevId: 315480798
2020-06-09 16:05:44 +01:00
tonihei
f099f570e6 Update TrackSelectionDialogBuilder to use androidx compat Dialog.
This ensure style themes are correctly applied.

issue:#7357
PiperOrigin-RevId: 313145345
2020-05-27 18:59:51 +01:00
ibaker
710374f83a Override WebViewSubtitleOutput.onLayout()
Some of the CSS font sizes are derived from the current view height, if
this calculation is done before the view has been measured then a zero
view height results in a zero px font size and no visible text.

This can happen when the view type is changed (and so the
WebViewSubtitleOutput has been recently added to the SubtitleView
ViewGroup).

PiperOrigin-RevId: 311552052
2020-05-14 22:24:58 +01:00
ibaker
ba5871dd0e Add support for CaptionStyle.edgeStyle to WebViewSubtitleOutput
This is the last piece to bring feature parity between
WebViewSubtitleOutput and CanvasSubtitleOutput.

PiperOrigin-RevId: 311325749
2020-05-14 22:23:46 +01:00
ibaker
1c3c7c58ab Rename SubtitleTextView to CanvasSubtitleOutput
It displays images too, and in fact it's used exclusively to display
images in SubtitleWebView. It also doesn't use a TextView - so all round
a slightly confusing name.

Also rename SubtitleWebView to WebViewSubtitleOutput to match the same
pattern.

PiperOrigin-RevId: 311312758
2020-05-14 22:23:28 +01:00
ibaker
0fb4ba788f Switch SubtitleWebView to use single-quotes in generated HTML
The current state is inconsistent with SpannedToHtmlConverter, it seems
they might as well agree on quoting strategy.

PiperOrigin-RevId: 310926683
2020-05-14 22:20:27 +01:00
ibaker
99ebeaed17 Change the SubtitleView.Output interface
This allows properties to propagate when switching view types
(e.g. bottomPaddingFraction).

It also allows the style-stripping code to be pushed up to SubtitleView
and therefore shared.

PiperOrigin-RevId: 310353534
2020-05-14 22:18:37 +01:00
ibaker
c4c826fbfe Add StrikethroughSpan support to SpannedToHtmlConverter
PiperOrigin-RevId: 310332708
2020-05-14 22:18:18 +01:00
tonihei
95ffc365ca Remove auto-notification of current cues when adding listener.
Users of addTextOutput should instead query the current cues if they
need them. This is more consistent with how other listeners are handled.

PiperOrigin-RevId: 310112241
2020-05-06 20:56:37 +01:00
ibaker
5117138481 Fix RelativeSizeSpan handling in SpannedToHtmlConverter
A silly mistake of confusing a fractional float with a percentage.

PiperOrigin-RevId: 309946004
2020-05-05 18:39:07 +01:00
Oliver Woodman
af6baaed90 Merge pull request #7304 from AChep:patch-1
PiperOrigin-RevId: 309395364
2020-05-01 19:50:46 +01:00
ibaker
e11ae734ed Add RelativeSizeSpan support to SpannedHtmlConverter
PiperOrigin-RevId: 309391401
2020-05-01 19:50:26 +01:00
ibaker
eb7c14704f Add AbsoluteSizeSpan to SpannedHtmlConverter
PiperOrigin-RevId: 309390205
2020-05-01 19:50:08 +01:00
ibaker
fa0178d043 Add TypefaceSpan support to SpannedToHtmlConverter
PiperOrigin-RevId: 309390050
2020-05-01 19:50:00 +01:00
ibaker
10db7a9c45 Ensure we destroy WebViews when we detach them from SubtitleView
PiperOrigin-RevId: 309389731
2020-05-01 19:49:51 +01:00
ibaker
79c003f5a8 Add bitmap support to SubtitleWebView using SubtitleTextView
PiperOrigin-RevId: 309389571
2020-05-01 19:49:42 +01:00
ibaker
222231dd8e Update SubtitleWebView to use center alignment by default
This mimics the behaviour of SubtitleTextView for cues that don't have
alignment set.

PiperOrigin-RevId: 309389392
2020-05-01 19:49:33 +01:00
ibaker
ab57c8010f Add bottomPaddingFraction support to SubtitleWebView
PiperOrigin-RevId: 309245320
2020-05-01 19:49:07 +01:00
ibaker
caeeae2c9e Use system foreground & background color in SubtitleWebView
PiperOrigin-RevId: 309244671
2020-05-01 19:48:58 +01:00
ibaker
4371617ec9 Add HTML support for BackgroundColorSpan
PiperOrigin-RevId: 309244135
2020-05-01 19:48:50 +01:00
ibaker
8c64d188cc Add support for Cue and default text sizes in SubtitleWebView
PiperOrigin-RevId: 309243467
2020-05-01 19:48:41 +01:00
andrewlewis
3b315b8134 Add TrackSelectionView getTag null check
PiperOrigin-RevId: 308988419
2020-05-01 19:46:48 +01:00
ibaker
284b843da0 Add fall-back behaviour for vertical cues if rendering isn't supported
PiperOrigin-RevId: 308854072
2020-05-01 19:45:55 +01:00
insun
4580b52454 Clean up old xml files which are not referenced anymore.
PiperOrigin-RevId: 308841370
2020-05-01 19:45:20 +01:00
Artem Chepurnoy
dfde3df2c2
Remove unused locationOnScreen variable 2020-04-30 17:36:04 +03:00
Artem Chepurnoy
088938c9ab Fix DefaultTimeBar ignores touch transformations #7303 2020-04-29 14:55:59 +03:00
ibaker
6a36574af3 Use anti-aliasing and bitmap filtering for bitmap subtitles
issue:#6950
PiperOrigin-RevId: 307411067
2020-04-27 10:18:31 +01:00
ibaker
7214ad2d6f Use FrameLayout instead of ViewGroup for Subtitle(Web)View
This is a more specific ViewGroup subclass that handles some of the
layout logic automatically. It's designed to work best with a single
child view, as used here.

PiperOrigin-RevId: 306654947
2020-04-15 17:42:19 +01:00
ibaker
a6358dc7be Escape the rubyText when generating HTML
This should have been done before, I just missed it.

PiperOrigin-RevId: 304612519
2020-04-06 13:27:58 +01:00
ibaker
6438e1cdbc Add support for tate-chu-yoko to SpannedToHtmlConverter
PiperOrigin-RevId: 304386857
2020-04-06 13:27:27 +01:00
ibaker
205adb7f8d Rewrite the vertical text support in SubtitleWebView
The attempt in <unknown commit> was hacky and incomplete.

PiperOrigin-RevId: 304356038
2020-04-06 13:27:06 +01:00
ibaker
7323b5351a Add support for multi-line strings to SpannedToHtmlConverter
PiperOrigin-RevId: 304355717
2020-04-06 13:26:50 +01:00
ibaker
262f19aa63 Add vertical text support to SubtitleWebView
PiperOrigin-RevId: 304186326
2020-04-01 22:38:54 +01:00
ibaker
76358d983f Base64 encode the subtitle HTML before passing to WebView.loadData
Without this, URL-encoding is assumed, which means ampersand-codes are
not carried through to the underlying web page correctly.

PiperOrigin-RevId: 304163733
2020-04-01 22:38:27 +01:00
ibaker
5392a2f4bc Add non-ascii characters to SpannedToHtmlConverterTest
These are handled by converting to ampersand codes - add a test to show
that's explicit & deliberate.

PiperOrigin-RevId: 304163712
2020-04-01 22:38:19 +01:00
ibaker
802d71a5cb Add cue positioning to SubtitleWebView
PiperOrigin-RevId: 303998690
2020-04-01 22:37:33 +01:00
jaewan
a2896c6cba Allow developers to specify CharSequence for Notification strings
CharSequence is used by Notification builders and allows to set Spannable text.
It's the base interface of the String class, so apps wouldn't be break after
the update.

PiperOrigin-RevId: 303731890
2020-03-30 17:17:27 +01:00
ibaker
92494ce44b Document that overlapping spans aren't rendered to HTML correctly
Add some mitigation about why this is probably on OK limitation.

PiperOrigin-RevId: 302907940
2020-03-27 23:30:28 +00:00