summaryrefslogtreecommitdiff
path: root/core/src/main/java
diff options
context:
space:
mode:
authorH. Lehmann <ByteHamster@users.noreply.github.com>2020-04-11 22:48:31 +0200
committerGitHub <noreply@github.com>2020-04-11 22:48:31 +0200
commit772d8728d1a72aac7d723fa22d74d4e827ccc6a1 (patch)
tree2b4e388fc41cde5d7758330b47e4bd020666174f /core/src/main/java
parent747edb8a38da383fc9ac195af3d02f7a3c83a4f9 (diff)
parentcc946f44d739abbdf2160b2588c0bcc510a1823f (diff)
downloadAntennaPod-772d8728d1a72aac7d723fa22d74d4e827ccc6a1.zip
Merge pull request #4036 from ByteHamster/colors
Make colors more consistent
Diffstat (limited to 'core/src/main/java')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java
index b59a95cd9..40849a262 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java
@@ -53,12 +53,8 @@ public class Timeline {
this.shownotesProvider = shownotesProvider;
noShownotesLabel = context.getString(R.string.no_shownotes_label);
-
- TypedArray res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
- @ColorInt int col = res.getColor(0, 0);
- final String colorPrimary = "rgba(" + Color.red(col) + "," + Color.green(col) + ","
- + Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
- res.recycle();
+ final String colorPrimary = colorToHtml(context, android.R.attr.textColorPrimary);
+ final String colorAccent = colorToHtml(context, R.attr.colorAccent);
final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
context.getResources().getDisplayMetrics());
String styleString = "";
@@ -68,7 +64,17 @@ public class Timeline {
} catch (IOException e) {
e.printStackTrace();
}
- webviewStyle = String.format(Locale.getDefault(), styleString, colorPrimary, margin, margin, margin, margin);
+ webviewStyle = String.format(Locale.US, styleString, colorPrimary, colorAccent,
+ margin, margin, margin, margin);
+ }
+
+ private String colorToHtml(Context context, int colorAttr) {
+ TypedArray res = context.getTheme().obtainStyledAttributes(new int[]{colorAttr});
+ @ColorInt int col = res.getColor(0, 0);
+ final String color = "rgba(" + Color.red(col) + "," + Color.green(col) + ","
+ + Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")";
+ res.recycle();
+ return color;
}
/**