Files
mg4/app/src/main/java/com/evsuite/abrp/OverviewStyle.java
T
nilsandClaude Opus 5.5 adc2c86303 App 2.43.0: Overview styles Día de Muertos and Halloween
Día de Muertos is an ofrenda: papel picado for the battery, a calavera
with the speed in a ring of marigolds for the power, candles for the
range, a path of petals for the last two minutes of power. Halloween is
a graveyard hill: a jack-o'-lantern with the speed in its grin, embers
for the power, a potion flask for the battery, a tombstone and bats for
the range. Each has its own palette; Tally counts what a value lights.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
2026-10-31 09:24:56 +01:00

84 lines
3.1 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),
MUERTOS(false, false),
HALLOWEEN(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);
}
}