mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Theming: charts use theme text colors.
This commit is contained in:
@@ -313,7 +313,7 @@ public class ChartView extends View {
|
||||
|
||||
axisPaint = new Paint();
|
||||
axisPaint.setStyle(Style.FILL_AND_STROKE);
|
||||
axisPaint.setColor(context.getResources().getColor(R.color.chart_axis_text));
|
||||
axisPaint.setColor(ThemeUtils.getTextColorPrimary(context));
|
||||
axisPaint.setAntiAlias(true);
|
||||
axisPaint.setTextSize(SMALL_TEXT_SIZE * scale);
|
||||
|
||||
@@ -322,7 +322,7 @@ public class ChartView extends View {
|
||||
|
||||
gridPaint = new Paint();
|
||||
gridPaint.setStyle(Style.STROKE);
|
||||
gridPaint.setColor(context.getResources().getColor(R.color.chart_grid));
|
||||
gridPaint.setColor(ThemeUtils.getTextColorSecondary(context));
|
||||
gridPaint.setAntiAlias(false);
|
||||
gridPaint.setPathEffect(new DashPathEffect(new float[]{3, 2}, 0));
|
||||
|
||||
|
||||
@@ -21,4 +21,20 @@ public class ThemeUtils {
|
||||
|
||||
return ContextCompat.getColor(context, typedValue.resourceId);
|
||||
}
|
||||
|
||||
public static int getTextColorPrimary(Context context) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = context.getTheme();
|
||||
theme.resolveAttribute(android.R.attr.textColorPrimary, typedValue, true);
|
||||
|
||||
return ContextCompat.getColor(context, typedValue.resourceId);
|
||||
}
|
||||
|
||||
public static int getTextColorSecondary(Context context) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = context.getTheme();
|
||||
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
||||
|
||||
return ContextCompat.getColor(context, typedValue.resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ limitations under the License.
|
||||
<color name="chart_power_fill">#40401465</color> <!-- transparent purple -->
|
||||
<color name="chart_speed_border">#FF0066FF</color> <!-- blue -->
|
||||
<color name="chart_speed_fill">#40C8E0FF</color> <!-- transparent blue -->
|
||||
<color name="chart_grid">@android:color/darker_gray</color>
|
||||
<color name="chart_axis_text">@android:color/black</color>
|
||||
|
||||
<color name="holo_orange_dark">#FFFF8800</color>
|
||||
<color name="holo_orange_dark_activated">#55FF8800</color>
|
||||
|
||||
Reference in New Issue
Block a user