Commit 04342f2b by Oliver Woodman

Don't use toLowerCase :).

It can do weird things if the device has an unusual default Locale.
Util.toLowerInvariant uses the US Locale, which does the right thing
in this case.
parent eeb73a86
...@@ -21,6 +21,7 @@ import com.google.android.exoplayer.text.Subtitle; ...@@ -21,6 +21,7 @@ import com.google.android.exoplayer.text.Subtitle;
import com.google.android.exoplayer.text.SubtitleParser; import com.google.android.exoplayer.text.SubtitleParser;
import com.google.android.exoplayer.util.MimeTypes; import com.google.android.exoplayer.util.MimeTypes;
import com.google.android.exoplayer.util.ParserUtil; import com.google.android.exoplayer.util.ParserUtil;
import com.google.android.exoplayer.util.Util;
import android.graphics.Color; import android.graphics.Color;
import android.text.Layout; import android.text.Layout;
...@@ -224,14 +225,14 @@ public final class TtmlParser implements SubtitleParser { ...@@ -224,14 +225,14 @@ public final class TtmlParser implements SubtitleParser {
break; break;
case TtmlNode.ATTR_TTS_FONT_WEIGHT: case TtmlNode.ATTR_TTS_FONT_WEIGHT:
style = createIfNull(style).setBold( style = createIfNull(style).setBold(
TtmlNode.BOLD.equals(attributeValue.toLowerCase())); TtmlNode.BOLD.equalsIgnoreCase(attributeValue));
break; break;
case TtmlNode.ATTR_TTS_FONT_STYLE: case TtmlNode.ATTR_TTS_FONT_STYLE:
style = createIfNull(style).setItalic( style = createIfNull(style).setItalic(
TtmlNode.ITALIC.equals(attributeValue.toLowerCase())); TtmlNode.ITALIC.equalsIgnoreCase(attributeValue));
break; break;
case TtmlNode.ATTR_TTS_TEXT_ALIGN: case TtmlNode.ATTR_TTS_TEXT_ALIGN:
switch (attributeValue.toLowerCase()) { switch (Util.toLowerInvariant(attributeValue)) {
case TtmlNode.LEFT: case TtmlNode.LEFT:
style = createIfNull(style).setTextAlign(Layout.Alignment.ALIGN_NORMAL); style = createIfNull(style).setTextAlign(Layout.Alignment.ALIGN_NORMAL);
break; break;
...@@ -250,7 +251,7 @@ public final class TtmlParser implements SubtitleParser { ...@@ -250,7 +251,7 @@ public final class TtmlParser implements SubtitleParser {
} }
break; break;
case TtmlNode.ATTR_TTS_TEXT_DECORATION: case TtmlNode.ATTR_TTS_TEXT_DECORATION:
switch (attributeValue.toLowerCase()) { switch (Util.toLowerInvariant(attributeValue)) {
case TtmlNode.LINETHROUGH: case TtmlNode.LINETHROUGH:
style = createIfNull(style).setLinethrough(true); style = createIfNull(style).setLinethrough(true);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment