From fb5ebeacb695ac4adef33df08267274bd7a75da8 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Fri, 28 Aug 2015 14:35:22 +0200 Subject: [PATCH] Light colors for the graphs. Closes #99 --- .../charts/AbstractChartFragment.java | 29 +++++++++++++++---- .../gadgetbridge/model/ActivityKind.java | 1 + app/src/main/res/values-v21/styles.xml | 14 +++++++++ app/src/main/res/values/colors.xml | 10 +++++++ 4 files changed, 49 insertions(+), 5 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 245192244..3ba71387b 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 @@ -81,7 +81,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment { protected static final class ActivityConfig { public final int type; public final String label; - public final Integer color; + public Integer color; public ActivityConfig(int kind, String label, Integer color) { this.type = kind; @@ -94,10 +94,13 @@ public abstract class AbstractChartFragment extends AbstractGBFragment { protected ActivityConfig akLightSleep = new ActivityConfig(ActivityKind.TYPE_LIGHT_SLEEP, "Light Sleep", Color.rgb(182, 191, 255)); protected ActivityConfig akDeepSleep = new ActivityConfig(ActivityKind.TYPE_DEEP_SLEEP, "Deep Sleep", Color.rgb(76, 90, 255)); - protected static final int BACKGROUND_COLOR = Color.rgb(24, 22, 24); - protected static final int DESCRIPTION_COLOR = Color.WHITE; - protected static final int CHART_TEXT_COLOR = Color.WHITE; - protected static final int LEGEND_TEXT_COLOR = Color.WHITE; + protected int BACKGROUND_COLOR; + protected int DESCRIPTION_COLOR; + protected int CHART_TEXT_COLOR; + protected int LEGEND_TEXT_COLOR; + protected int AK_ACTIVITY_COLOR; + protected int AK_DEEP_SLEEP_COLOR; + protected int AK_LIGHT_SLEEP_COLOR; protected AbstractChartFragment(String... intentFilterActions) { mIntentFilterActions = new HashSet<>(); @@ -113,6 +116,8 @@ public abstract class AbstractChartFragment extends AbstractGBFragment { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + initColors(); + IntentFilter filter = new IntentFilter(); for (String action : mIntentFilterActions) { filter.addAction(action); @@ -120,6 +125,20 @@ public abstract class AbstractChartFragment extends AbstractGBFragment { LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mReceiver, filter); } + protected void initColors() { + BACKGROUND_COLOR = getResources().getColor(R.color.background_material_light); + DESCRIPTION_COLOR = getResources().getColor(R.color.primarytext); + CHART_TEXT_COLOR = getResources().getColor(R.color.secondarytext); + LEGEND_TEXT_COLOR = getResources().getColor(R.color.primarytext); + AK_ACTIVITY_COLOR = getResources().getColor(R.color.chart_activity_light); + AK_DEEP_SLEEP_COLOR = getResources().getColor(R.color.chart_light_sleep_light); + AK_LIGHT_SLEEP_COLOR = getResources().getColor(R.color.chart_deep_sleep_light); + + akActivity.color = AK_ACTIVITY_COLOR; + akLightSleep.color = AK_LIGHT_SLEEP_COLOR; + akDeepSleep.color = AK_DEEP_SLEEP_COLOR; + } + private void setStartDate(Date date) { getHost().setStartDate(date); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityKind.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityKind.java index 17fa1d228..3314b4f76 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityKind.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityKind.java @@ -9,6 +9,7 @@ public class ActivityKind { public static final int TYPE_ACTIVITY = 1; public static final int TYPE_LIGHT_SLEEP = 2; public static final int TYPE_DEEP_SLEEP = 4; + public static final int TYPE_SLEEP = TYPE_LIGHT_SLEEP | TYPE_DEEP_SLEEP; public static final int TYPE_ALL = TYPE_ACTIVITY | TYPE_SLEEP; diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index 61c6b4ca7..dfd096b58 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -5,11 +5,25 @@ @color/primarydark_light @color/accent @color/primary_text_default_material_light + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d81fa9db4..340861c2f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -10,4 +10,14 @@ #ff000000 #ff808080 #1f000000 + + #0071b7 + #4c5aff + + #46acea + #b6bfff + + #60bd6d + #59b22c + \ No newline at end of file