A new Overview style: the Grid over the roads round the car from
OpenStreetMap, drawn in the floor's perspective, heading up, the bigger
roads glowing brighter, the car as a chevron.
Server: POST /v1/map/roads {z:14,x,y} fetches a tile's drivable roads
from Overpass (OVERPASS_URL; one request at a time, at least a second
apart), simplifies them to tile-local points in four classes, caches
them for 30 days and never logs the tile.
App: MapRoads keeps the 3x3 tiles round the car from its own cache or
the server; GPS only while the style is shown; bearing from the GPS or
from successive positions. Without GPS, server or roads the plain floor
says why. OSM attribution on screen and in LICENSE.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
37 lines
1.6 KiB
Java
37 lines
1.6 KiB
Java
package com.evsuite.abrp;
|
|
|
|
/**
|
|
* The app's colours while an Overview style shows its own palette: the theme overlay
|
|
* (res/values/style_palettes.xml) that MainActivity lays over the accent colour, so the
|
|
* navigation and the rest of the app match the style — Retro's turquoise, Terminal's green
|
|
* phosphor, and so on. Styles drawn in the accent colour have none.
|
|
*/
|
|
final class StylePalette {
|
|
|
|
private StylePalette() {}
|
|
|
|
/** The overlay for a style's own palette, or 0 for a style that has none. */
|
|
static int overlay(OverviewStyle style) {
|
|
switch (style) {
|
|
case RETRO: return R.style.ThemeOverlay_EV_Style_Retro;
|
|
case TERMINAL: return R.style.ThemeOverlay_EV_Style_Terminal;
|
|
case SCIFI: return R.style.ThemeOverlay_EV_Style_SciFi;
|
|
case CARTOON: return R.style.ThemeOverlay_EV_Style_Cartoon;
|
|
case NIXIE: return R.style.ThemeOverlay_EV_Style_Nixie;
|
|
case GRID:
|
|
case GRID_MAP: return R.style.ThemeOverlay_EV_Style_Grid;
|
|
case TIME_CIRCUITS: return R.style.ThemeOverlay_EV_Style_TimeCircuits;
|
|
case QUEST: return R.style.ThemeOverlay_EV_Style_Quest;
|
|
case VISOR: return R.style.ThemeOverlay_EV_Style_Visor;
|
|
case EMPIRE: return R.style.ThemeOverlay_EV_Style_Empire;
|
|
default: return 0;
|
|
}
|
|
}
|
|
|
|
/** The overlay the app wears: the style's own when it shows its palette, else the accent's. */
|
|
static int appOverlay(OverviewStyle style, boolean originalChosen, AccentColor accent) {
|
|
int own = overlay(style);
|
|
return own != 0 && style.showsOwnPalette(originalChosen) ? own : accent.overlay;
|
|
}
|
|
}
|