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), CHRISTMAS(false, false), CATERPILLAR(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); } }