Respect app theme

This commit is contained in:
ByteHamster 2020-02-21 19:16:00 +01:00
parent b3ea96e7b3
commit 9d31cdc32f
3 changed files with 14 additions and 7 deletions

View File

@ -1,14 +1,15 @@
package de.danoeh.antennapod.view; package de.danoeh.antennapod.view;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Path; import android.graphics.Path;
import android.graphics.RectF; import android.graphics.RectF;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import de.danoeh.antennapod.R;
public class PlaybackSpeedIndicatorView extends View { public class PlaybackSpeedIndicatorView extends View {
private static final float DEG_2_RAD = (float) (Math.PI / 180); private static final float DEG_2_RAD = (float) (Math.PI / 180);
@ -39,13 +40,17 @@ public class PlaybackSpeedIndicatorView extends View {
} }
private void setup() { private void setup() {
int[] colorAttrs = new int[] {R.attr.action_icon_color };
TypedArray a = getContext().obtainStyledAttributes(colorAttrs);
arcPaint.setColor(a.getColor(0, 0xffffffff));
indicatorPaint.setColor(a.getColor(0, 0xffffffff));
a.recycle();
arcPaint.setAntiAlias(true); arcPaint.setAntiAlias(true);
arcPaint.setColor(Color.GRAY);
arcPaint.setStyle(Paint.Style.STROKE); arcPaint.setStyle(Paint.Style.STROKE);
arcPaint.setStrokeCap(Paint.Cap.ROUND); arcPaint.setStrokeCap(Paint.Cap.ROUND);
indicatorPaint.setAntiAlias(true); indicatorPaint.setAntiAlias(true);
indicatorPaint.setColor(Color.GRAY);
indicatorPaint.setStyle(Paint.Style.FILL); indicatorPaint.setStyle(Paint.Style.FILL);
trianglePath.setFillType(Path.FillType.EVEN_ODD); trianglePath.setFillType(Path.FillType.EVEN_ODD);
@ -67,15 +72,15 @@ public class PlaybackSpeedIndicatorView extends View {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec); super.onMeasure(widthMeasureSpec, heightMeasureSpec);
paddingArc = getMeasuredHeight() / 5f; paddingArc = getMeasuredHeight() / 4.5f;
paddingIndicator = getMeasuredHeight() / 10f; paddingIndicator = getMeasuredHeight() / 6f;
} }
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
super.onDraw(canvas); super.onDraw(canvas);
float radiusInnerCircle = getWidth() / 8f; float radiusInnerCircle = getWidth() / 10f;
canvas.drawCircle(getWidth() / 2f, getHeight() / 2f, radiusInnerCircle, indicatorPaint); canvas.drawCircle(getWidth() / 2f, getHeight() / 2f, radiusInnerCircle, indicatorPaint);
trianglePath.rewind(); trianglePath.rewind();

View File

@ -61,6 +61,7 @@
<attr name="nav_drawer_background" format="color"/> <attr name="nav_drawer_background" format="color"/>
<attr name="drawer_activated_color" format="color"/> <attr name="drawer_activated_color" format="color"/>
<attr name="batch_edit_fab_icon" format="reference"/> <attr name="batch_edit_fab_icon" format="reference"/>
<attr name="action_icon_color" format="color"/>
<declare-styleable name="SquareImageView"> <declare-styleable name="SquareImageView">
<attr name="useMinimum" format="boolean" /> <attr name="useMinimum" format="boolean" />

View File

@ -70,8 +70,8 @@
<item name="ic_volume_adaption">@drawable/ic_volume_adaption_grey</item> <item name="ic_volume_adaption">@drawable/ic_volume_adaption_grey</item>
<item name="master_switch_background">@color/master_switch_background_light</item> <item name="master_switch_background">@color/master_switch_background_light</item>
<item name="currently_playing_background">@color/highlight_light</item> <item name="currently_playing_background">@color/highlight_light</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="action_icon_color">#FF757575</item>
</style> </style>
<style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark">
@ -146,6 +146,7 @@
<item name="master_switch_background">@color/master_switch_background_dark</item> <item name="master_switch_background">@color/master_switch_background_dark</item>
<item name="currently_playing_background">@color/highlight_dark</item> <item name="currently_playing_background">@color/highlight_dark</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="action_icon_color">@color/white</item>
</style> </style>
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack"> <style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">