Fix error
This commit is contained in:
parent
c4d19b7163
commit
33f8ead4a0
|
@ -14,6 +14,7 @@ import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
import org.jsoup.select.Elements;
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -42,22 +43,22 @@ public class Timeline {
|
||||||
private final int pageMargin;
|
private final int pageMargin;
|
||||||
|
|
||||||
public Timeline(Context context, ShownotesProvider shownotesProvider) {
|
public Timeline(Context context, ShownotesProvider shownotesProvider) {
|
||||||
if (shownotesProvider == null) throw new IllegalArgumentException("shownotesProvider = null");
|
if (shownotesProvider == null) {
|
||||||
|
throw new IllegalArgumentException("shownotesProvider = null");
|
||||||
|
}
|
||||||
this.shownotesProvider = shownotesProvider;
|
this.shownotesProvider = shownotesProvider;
|
||||||
|
|
||||||
noShownotesLabel = context.getString(R.string.no_shownotes_label);
|
noShownotesLabel = context.getString(R.string.no_shownotes_label);
|
||||||
|
|
||||||
TypedArray res = context.getTheme().obtainStyledAttributes(
|
TypedArray res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
||||||
new int[]{ android.R.attr.textColorPrimary});
|
|
||||||
@ColorInt int col = res.getColor(0, 0);
|
@ColorInt int col = res.getColor(0, 0);
|
||||||
colorPrimaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
|
colorPrimaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
|
||||||
Color.blue(col) + "," + (Color.alpha(col)/256.0) + ")";
|
Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
|
||||||
res.recycle();
|
res.recycle();
|
||||||
res = context.getTheme().obtainStyledAttributes(
|
res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorSecondary});
|
||||||
new int[]{android.R.attr.textColorSecondary});
|
|
||||||
col = res.getColor(0, 0);
|
col = res.getColor(0, 0);
|
||||||
colorSecondaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
|
colorSecondaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," +
|
||||||
Color.blue(col) + "," + (Color.alpha(col)/256.0) + ")";
|
Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
|
||||||
res.recycle();
|
res.recycle();
|
||||||
|
|
||||||
pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
|
pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
|
||||||
|
@ -120,8 +121,8 @@ public class Timeline {
|
||||||
Document document = Jsoup.parse(shownotes);
|
Document document = Jsoup.parse(shownotes);
|
||||||
|
|
||||||
// apply style
|
// apply style
|
||||||
String styleStr = String.format(WEBVIEW_STYLE, colorPrimaryString, "100%", pageMargin,
|
String styleStr = String.format(Locale.getDefault(), WEBVIEW_STYLE, colorPrimaryString, "100%",
|
||||||
pageMargin, pageMargin, pageMargin);
|
pageMargin, pageMargin, pageMargin, pageMargin);
|
||||||
document.head().appendElement("style").attr("type", "text/css").text(styleStr);
|
document.head().appendElement("style").attr("type", "text/css").text(styleStr);
|
||||||
|
|
||||||
// apply timecode links
|
// apply timecode links
|
||||||
|
@ -139,7 +140,7 @@ public class Timeline {
|
||||||
|
|
||||||
String rep;
|
String rep;
|
||||||
if (playable == null || playable.getDuration() > time) {
|
if (playable == null || playable.getDuration() > time) {
|
||||||
rep = String.format(TIMECODE_LINK, time, group);
|
rep = String.format(Locale.getDefault(), TIMECODE_LINK, time, group);
|
||||||
} else {
|
} else {
|
||||||
rep = group;
|
rep = group;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue