1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-14 14:09:28 +01:00

Dark theme: set some text colors for the speed zone tab

This commit is contained in:
cpfeiffer 2017-05-18 23:26:04 +02:00
parent db935c650d
commit 1d79c9d93d
2 changed files with 14 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import com.github.mikephil.charting.charts.Chart;
import com.github.mikephil.charting.charts.HorizontalBarChart; import com.github.mikephil.charting.charts.HorizontalBarChart;
import com.github.mikephil.charting.components.LegendEntry; import com.github.mikephil.charting.components.LegendEntry;
import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry; import com.github.mikephil.charting.data.BarEntry;
@ -43,6 +44,8 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
import static android.R.attr.x;
public class StatsChartFragment extends AbstractChartFragment { public class StatsChartFragment extends AbstractChartFragment {
protected static final Logger LOG = LoggerFactory.getLogger(StatsChartFragment.class); protected static final Logger LOG = LoggerFactory.getLogger(StatsChartFragment.class);
@ -53,15 +56,16 @@ public class StatsChartFragment extends AbstractChartFragment {
protected ChartsData refreshInBackground(ChartsHost chartsHost, DBHandler db, GBDevice device) { protected ChartsData refreshInBackground(ChartsHost chartsHost, DBHandler db, GBDevice device) {
List<? extends ActivitySample> samples = getSamples(db, device); List<? extends ActivitySample> samples = getSamples(db, device);
MySpeedZonesData mySpeedZonesData = refreshSleepAmounts(samples); MySpeedZonesData mySpeedZonesData = refreshStats(samples);
return new MyChartsData(mySpeedZonesData); return new MyChartsData(mySpeedZonesData);
} }
private MySpeedZonesData refreshSleepAmounts(List<? extends ActivitySample> samples) { private MySpeedZonesData refreshStats(List<? extends ActivitySample> samples) {
ActivityAnalysis analysis = new ActivityAnalysis(); ActivityAnalysis analysis = new ActivityAnalysis();
analysis.calculateActivityAmounts(samples); analysis.calculateActivityAmounts(samples);
BarData data = new BarData(); BarData data = new BarData();
data.setValueTextColor(CHART_TEXT_COLOR);
List<BarEntry> entries = new ArrayList<>(); List<BarEntry> entries = new ArrayList<>();
XAxisValueFormatter customXAxis = new XAxisValueFormatter(); XAxisValueFormatter customXAxis = new XAxisValueFormatter();
@ -73,6 +77,7 @@ public class StatsChartFragment extends AbstractChartFragment {
} }
BarDataSet set = new BarDataSet(entries, ""); BarDataSet set = new BarDataSet(entries, "");
set.setValueTextColor(CHART_TEXT_COLOR);
set.setColors(getColorFor(ActivityKind.TYPE_ACTIVITY)); set.setColors(getColorFor(ActivityKind.TYPE_ACTIVITY));
//set.setDrawValues(false); //set.setDrawValues(false);
//data.setBarWidth(0.1f); //data.setBarWidth(0.1f);
@ -121,6 +126,12 @@ public class StatsChartFragment extends AbstractChartFragment {
mStatsChart.getLegend().setEnabled(false); mStatsChart.getLegend().setEnabled(false);
mStatsChart.setTouchEnabled(false); mStatsChart.setTouchEnabled(false);
mStatsChart.getDescription().setText(""); mStatsChart.getDescription().setText("");
XAxis x = mStatsChart.getXAxis();
x.setTextColor(CHART_TEXT_COLOR);
YAxis yr = mStatsChart.getAxisRight();
yr.setTextColor(CHART_TEXT_COLOR);
} }
@Override @Override

View File

@ -258,7 +258,7 @@
<string name="pref_screen_notification_profile_generic_navigation">Navigation</string> <string name="pref_screen_notification_profile_generic_navigation">Navigation</string>
<string name="pref_screen_notification_profile_generic_social">Social Network</string> <string name="pref_screen_notification_profile_generic_social">Social Network</string>
<string name="stats_title">Speed zones</string> <string name="stats_title">Speed Zones</string>
<string name="stats_x_axis_label">Total minutes</string> <string name="stats_x_axis_label">Total minutes</string>
<string name="stats_y_axis_label">Steps per minute</string> <string name="stats_y_axis_label">Steps per minute</string>