Aviation is removed (a stored one opens Tiles). The app's Sci-fi palette now takes the lilac of the console frame's lower elbow instead of the orange of the upper one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
75 lines
2.7 KiB
Java
75 lines
2.7 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); 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);
|
|
|
|
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() {
|
|
return "original_colours_" + 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);
|
|
}
|
|
}
|