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
This commit is contained in:
ibaker 2020-05-11 17:19:03 +01:00 committed by Oliver Woodman
parent 8528129e8d
commit 0fb4ba788f

View File

@ -127,7 +127,7 @@ import java.util.List;
StringBuilder html = new StringBuilder(); StringBuilder html = new StringBuilder();
html.append( html.append(
Util.formatInvariant( Util.formatInvariant(
"<html><body><div style=\"" "<html><body><div style='"
+ "-webkit-user-select:none;" + "-webkit-user-select:none;"
+ "position:fixed;" + "position:fixed;"
+ "top:0;" + "top:0;"
@ -136,7 +136,7 @@ import java.util.List;
+ "right:0;" + "right:0;"
+ "color:%s;" + "color:%s;"
+ "font-size:%s;" + "font-size:%s;"
+ "\">", + "'>",
HtmlUtils.toCssRgba(style.foregroundColor), HtmlUtils.toCssRgba(style.foregroundColor),
convertTextSizeToCss(defaultTextSizeType, defaultTextSize))); convertTextSizeToCss(defaultTextSizeType, defaultTextSize)));
@ -222,7 +222,7 @@ import java.util.List;
html.append( html.append(
Util.formatInvariant( Util.formatInvariant(
"<div style=\"" "<div style='"
+ "position:absolute;" + "position:absolute;"
+ "%s:%.2f%%;" + "%s:%.2f%%;"
+ "%s:%.2f%%;" + "%s:%.2f%%;"
@ -232,7 +232,7 @@ import java.util.List;
+ "font-size:%s;" + "font-size:%s;"
+ "background-color:%s;" + "background-color:%s;"
+ "transform:translate(%s%%,%s%%);" + "transform:translate(%s%%,%s%%);"
+ "\">", + "'>",
positionProperty, positionProperty,
positionPercent, positionPercent,
lineProperty, lineProperty,
@ -245,7 +245,7 @@ import java.util.List;
windowCssColor, windowCssColor,
horizontalTranslatePercent, horizontalTranslatePercent,
verticalTranslatePercent)) verticalTranslatePercent))
.append(Util.formatInvariant("<span style=\"background-color:%s;\">", backgroundColorCss)) .append(Util.formatInvariant("<span style='background-color:%s;'>", backgroundColorCss))
.append( .append(
SpannedToHtmlConverter.convert( SpannedToHtmlConverter.convert(
cue.text, getContext().getResources().getDisplayMetrics().density)) cue.text, getContext().getResources().getDisplayMetrics().density))