Files
mg4/app/src/main/java/com/evsuite/abrp/OverviewStyle.java
T
nilsandClaude Opus 5.5 65dc1ba847 App 2.39.0, server 2.7.0: Grid with map
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
2026-10-26 23:34:21 +01:00

82 lines
3.0 KiB
Java

package com.evsuite.abrp;
/**
* The Overview styles in the order of the Settings drop-down, the value each is stored as, and
* how it takes colour:
*
* - {@link #usesAccent}: drawn in the chosen accent colour, so Settings offers the accent
* colour for it. Styles with only their own fixed palette (the starship console, the cartoon,
* the flight display, the nixie tubes) ignore it and Settings greys it out.
* - {@link #hasOriginal}: has an original palette of its own as well (Retro's turquoise
* display, the terminal's green phosphor, the Grid's neon cyan, the Visor's blue); Settings then offers "Original colours" above the
* accent colours, remembered per style under {@link #originalKey()}.
*
* Pure Java, unit-tested.
*/
enum OverviewStyle {
TILES(true, false),
GAUGES(true, false),
COCKPIT(true, false),
RETRO(true, true),
FUTURISTIC(true, false),
SCIFI(false, false),
CARTOON(false, false),
MG(true, false),
MINIMAL(true, false),
TERMINAL(true, true),
NIXIE(false, false),
CHRONOGRAPH(true, false),
GRID(true, true),
GRID_MAP(true, true),
TIME_CIRCUITS(false, false),
QUEST(false, false),
VISOR(true, true),
EMPIRE(false, false);
static final String PREF_KEY = "overview_style";
final boolean usesAccent;
final boolean hasOriginal;
OverviewStyle(boolean usesAccent, boolean hasOriginal) {
this.usesAccent = usesAccent;
this.hasOriginal = hasOriginal;
}
/**
* Whether the style is shown in its own palette: always for one with no accent colour, and
* for Retro and Terminal when "Original colours" is chosen. The app then matches it
* (StylePalette).
*/
boolean showsOwnPalette(boolean originalChosen) {
return !usesAccent || (hasOriginal && originalChosen);
}
/** Where the choice between the original palette and the accent colour is kept. */
String originalKey() {
// Grid with map is the Grid over a map: one choice for both.
return "original_colours_" + (this == GRID_MAP ? GRID : this).name();
}
/**
* The stored style. Older values: "DASHBOARD" (Gauges before 2.22.3), and "RETRO_ACCENT" /
* "TERMINAL_ACCENT" (separate entries before 2.27.2, now the style in the accent colour —
* see {@link #wasAccentEntry}). Anything unknown is Tiles, including "BLUEPRINT" and
* "MASCOT", the styles removed in 2.35.0, and "AVIATION" (2.35.1).
*/
static OverviewStyle fromPref(String stored) {
if ("DASHBOARD".equals(stored)) return GAUGES;
if ("RETRO_ACCENT".equals(stored)) return RETRO;
if ("TERMINAL_ACCENT".equals(stored)) return TERMINAL;
for (OverviewStyle style : values()) {
if (style.name().equals(stored)) return style;
}
return TILES;
}
/** A stored value from when the accent-coloured variant was its own entry. */
static boolean wasAccentEntry(String stored) {
return "RETRO_ACCENT".equals(stored) || "TERMINAL_ACCENT".equals(stored);
}
}