mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-13 19:27:33 +01:00
Fix chart legend text color on dark theme
This commit is contained in:
parent
ee4f3fabcf
commit
4688f7d43c
@ -1329,10 +1329,15 @@ public class GBApplication extends Application {
|
||||
}
|
||||
|
||||
public static int getTextColor(Context context) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = context.getTheme();
|
||||
theme.resolveAttribute(R.attr.textColorPrimary, typedValue, true);
|
||||
return typedValue.data;
|
||||
if (GBApplication.isDarkThemeEnabled()) {
|
||||
return context.getResources().getColor(R.color.primarytext_dark);
|
||||
} else {
|
||||
return context.getResources().getColor(R.color.primarytext_light);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getSecondaryTextColor(Context context) {
|
||||
return context.getResources().getColor(R.color.secondarytext);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,7 +125,7 @@ public class BatteryInfoChartFragment extends AbstractGBFragment {
|
||||
private void init() {
|
||||
BACKGROUND_COLOR = GBApplication.getBackgroundColor(getContext());
|
||||
LEGEND_TEXT_COLOR = DESCRIPTION_COLOR = GBApplication.getTextColor(getContext());
|
||||
CHART_TEXT_COLOR = ContextCompat.getColor(getContext(), R.color.secondarytext);
|
||||
CHART_TEXT_COLOR = GBApplication.getSecondaryTextColor(getContext());
|
||||
BATTERY_LABEL = getString(R.string.battery_level);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public abstract class AbstractActivityChartFragment<D extends ChartsData> extend
|
||||
TypedValue runningColor = new TypedValue();
|
||||
BACKGROUND_COLOR = GBApplication.getBackgroundColor(getContext());
|
||||
LEGEND_TEXT_COLOR = DESCRIPTION_COLOR = GBApplication.getTextColor(getContext());
|
||||
CHART_TEXT_COLOR = ContextCompat.getColor(getContext(), R.color.secondarytext);
|
||||
CHART_TEXT_COLOR = GBApplication.getSecondaryTextColor(getContext());
|
||||
if (prefs.getBoolean("chart_heartrate_color", false)) {
|
||||
HEARTRATE_COLOR = ContextCompat.getColor(getContext(), R.color.chart_heartrate_alternative);
|
||||
}else{
|
||||
|
@ -84,7 +84,7 @@ public class StressChartFragment extends AbstractChartFragment<StressChartFragme
|
||||
protected void init() {
|
||||
BACKGROUND_COLOR = GBApplication.getBackgroundColor(requireContext());
|
||||
LEGEND_TEXT_COLOR = DESCRIPTION_COLOR = GBApplication.getTextColor(requireContext());
|
||||
CHART_TEXT_COLOR = ContextCompat.getColor(requireContext(), R.color.secondarytext);
|
||||
CHART_TEXT_COLOR = GBApplication.getSecondaryTextColor(requireContext());
|
||||
|
||||
STRESS_AVERAGE_LABEL = requireContext().getString(R.string.charts_legend_stress_average);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user