From a9e7cdcaa7c62731aeab8728abb9ed3b791a5adc Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 14 Apr 2016 17:41:04 +0200 Subject: [PATCH] use some colors from the theme for charts activity --- .../activities/charts/AbstractChartFragment.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java index 9378d2a6c..41c611143 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractChartFragment.java @@ -4,11 +4,13 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.res.Resources; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.FragmentActivity; import android.support.v4.content.LocalBroadcastManager; +import android.util.TypedValue; import android.view.View; import com.github.mikephil.charting.charts.BarLineChartBase; @@ -149,10 +151,14 @@ public abstract class AbstractChartFragment extends AbstractGBFragment { } protected void init() { - BACKGROUND_COLOR = getResources().getColor(R.color.background_material_light); - DESCRIPTION_COLOR = getResources().getColor(R.color.primarytext_light); + TypedValue typedValue = new TypedValue(); + Resources.Theme theme = getContext().getTheme(); + theme.resolveAttribute(android.R.attr.background, typedValue, true); + BACKGROUND_COLOR = typedValue.data; + theme.resolveAttribute(android.R.attr.textColor, typedValue, true); + LEGEND_TEXT_COLOR = DESCRIPTION_COLOR = typedValue.data; + CHART_TEXT_COLOR = getResources().getColor(R.color.secondarytext); - LEGEND_TEXT_COLOR = getResources().getColor(R.color.primarytext_light); HEARTRATE_COLOR = getResources().getColor(R.color.chart_heartrate); HEARTRATE_FILL_COLOR = getResources().getColor(R.color.chart_heartrate_fill); AK_ACTIVITY_COLOR = getResources().getColor(R.color.chart_activity_light); @@ -704,7 +710,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment { return (int) ((date.getTime() / 1000)); } - public static class DefaultChartsData extends ChartsData{ + public static class DefaultChartsData extends ChartsData { private final CombinedData combinedData; public DefaultChartsData(CombinedData combinedData) {