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

View File

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

View File

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