App 2.23.1: Retro style also in the accent colour
"Retro (accent colour)" draws the display in the chosen paint colour and the labels in its light shade; regeneration stays green, a low battery turns amber. Listed under Retro. Emulator only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
@@ -1442,7 +1442,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
private Double dashTripKm;
|
||||
|
||||
/** The stored values of the Overview styles, in the order of the drop-down. */
|
||||
private static final String[] OVERVIEW_STYLES = { "TILES", "GAUGES", "COCKPIT", "RETRO", "FUTURISTIC" };
|
||||
private static final String[] OVERVIEW_STYLES = { "TILES", "GAUGES", "COCKPIT", "RETRO", "RETRO_ACCENT", "FUTURISTIC" };
|
||||
|
||||
/** The chosen style's index in {@link #OVERVIEW_STYLES}; anything unknown is Tiles. */
|
||||
private int overviewStyle() {
|
||||
@@ -1457,15 +1457,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
vehiclePane.setVisibility(style == 0 ? View.VISIBLE : View.GONE);
|
||||
gaugesPane.setVisibility(style == 1 ? View.VISIBLE : View.GONE);
|
||||
cockpitPane.setVisibility(style == 2 ? View.VISIBLE : View.GONE);
|
||||
retroPane.setVisibility(style == 3 ? View.VISIBLE : View.GONE);
|
||||
futuristicPane.setVisibility(style == 4 ? View.VISIBLE : View.GONE);
|
||||
// Retro in either palette: one pane, the view told which.
|
||||
retroPane.setVisibility(style == 3 || style == 4 ? View.VISIBLE : View.GONE);
|
||||
((RetroView) retroPane.findViewById(R.id.retro_view)).setAccentPalette(style == 4);
|
||||
futuristicPane.setVisibility(style == 5 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
/** Tiles, Gauges, Cockpit, Retro or Futuristic; all are fed on every reading. */
|
||||
/** Tiles, Gauges, Cockpit, Retro (classic or accent colour) or Futuristic; all are fed on every reading. */
|
||||
private void bindOverviewStyle() {
|
||||
String[] labels = { getString(R.string.overview_style_tiles), getString(R.string.overview_style_gauges),
|
||||
getString(R.string.overview_style_cockpit), getString(R.string.overview_style_retro),
|
||||
getString(R.string.overview_style_futuristic) };
|
||||
getString(R.string.overview_style_retro_accent), getString(R.string.overview_style_futuristic) };
|
||||
bindChoices(settingsPane.findViewById(R.id.overview_style_choices), labels, overviewStyle(),
|
||||
position -> {
|
||||
prefs.edit().putString(PREF_OVERVIEW_STYLE, OVERVIEW_STYLES[position]).apply();
|
||||
|
||||
@@ -20,6 +20,11 @@ import java.util.Locale;
|
||||
* Left: charge as a bar, the percentage and range. Right: 5-minute usage, the average since
|
||||
* start and the distance. Bottom: climate, clock, odometer. Unread values show dashes and light
|
||||
* no bar segments. The whole pane is one Canvas, redrawn only when a reading arrives.
|
||||
*
|
||||
* Two palettes: the classic one (turquoise display, amber labels), or the chosen accent colour
|
||||
* for the display and its light shade for the labels ({@link #setAccentPalette}). Regeneration
|
||||
* stays green in both; a low battery is red in the classic palette and amber in the accent one,
|
||||
* so it never looks like the accent itself.
|
||||
*/
|
||||
public final class RetroView extends View {
|
||||
|
||||
@@ -33,24 +38,36 @@ public final class RetroView extends View {
|
||||
private final Paint bezel = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Path path = new Path();
|
||||
private final RectF rect = new RectF();
|
||||
private final int lit, regen, amber, warn;
|
||||
private final int classicLit, classicLabel, classicWarn, accentLit, accentLabel, regen;
|
||||
private int lit, amber, warn;
|
||||
private ClusterValues v = new ClusterValues();
|
||||
|
||||
public RetroView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
lit = context.getColor(R.color.retro_lit);
|
||||
classicLit = context.getColor(R.color.retro_lit);
|
||||
classicLabel = context.getColor(R.color.retro_label);
|
||||
classicWarn = context.getColor(R.color.retro_warn);
|
||||
accentLit = AccentColor.resolve(context, R.attr.evAccent);
|
||||
accentLabel = AccentColor.resolve(context, R.attr.evAccentLight);
|
||||
regen = context.getColor(R.color.retro_regen);
|
||||
amber = context.getColor(R.color.retro_label);
|
||||
warn = context.getColor(R.color.retro_warn);
|
||||
ghost.setColor(AccentColor.withAlpha(lit, 0x14));
|
||||
glow.setStyle(Paint.Style.STROKE);
|
||||
glow.setStrokeJoin(Paint.Join.ROUND);
|
||||
label.setColor(amber);
|
||||
label.setTypeface(Typeface.create(Typeface.MONOSPACE, Typeface.BOLD));
|
||||
label.setLetterSpacing(0.12f);
|
||||
panel.setColor(context.getColor(R.color.retro_panel));
|
||||
bezel.setStyle(Paint.Style.STROKE);
|
||||
bezel.setColor(context.getColor(R.color.retro_bezel));
|
||||
setAccentPalette(false);
|
||||
}
|
||||
|
||||
/** The chosen accent colour instead of the classic turquoise and amber. */
|
||||
void setAccentPalette(boolean accent) {
|
||||
lit = accent ? accentLit : classicLit;
|
||||
amber = accent ? accentLabel : classicLabel;
|
||||
warn = accent ? classicLabel : classicWarn;
|
||||
ghost.setColor(AccentColor.withAlpha(lit, 0x14));
|
||||
label.setColor(amber);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void setValues(ClusterValues values) {
|
||||
|
||||
Reference in New Issue
Block a user