use some colors from the theme for charts activity

This commit is contained in:
Andreas Shimokawa 2016-04-14 17:41:04 +02:00
parent a9b75a63b3
commit a9e7cdcaa7
1 changed files with 10 additions and 4 deletions

View File

@ -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);