App 2.43.4: the Halloween pumpkin's light follows the music

The bass from Android's audio analyser drives the glow and brightens the
carving on the beat, only while the style is on screen. Yellow and green and
the embers keep their meaning; without a signal, as with the radio, the light
stays as it was. Levels only. Tried on the emulator. Not tried on the car.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
2026-11-01 10:07:01 +01:00
co-authored by Claude Opus 5.5
parent ea9763e1de
commit fd38c37ebe
9 changed files with 252 additions and 15 deletions
@@ -77,6 +77,7 @@ public class MainActivity extends AppCompatActivity {
private boolean inFront;
/** The pane of each Overview style, by its {@link OverviewStyle} ordinal. */
private View[] stylePanes;
private MusicTap musicTap;
private View consumptionPane;
private View chargingPane;
/** Display, battery, charging price and Wi-Fi. */
@@ -195,6 +196,7 @@ public class MainActivity extends AppCompatActivity {
@Override public void onPageSelected(int position) {
markCurrentPage(position);
applyOverviewFullScreen(position);
updateMusicTap();
}
});
findViewById(R.id.edge_tab).setOnClickListener(v -> leaveOverviewFullScreen());
@@ -353,9 +355,12 @@ public class MainActivity extends AppCompatActivity {
mapRoads = new MapRoads(this);
gridMapView = new GridView(this, mapRoads);
visorView = new VisorView(this);
HalloweenView halloweenView = new HalloweenView(this);
musicTap = new MusicTap(this);
halloweenView.setMusic(musicTap);
java.util.Collections.addAll(canvasStyles, new MinimalView(this), terminalView,
new NixieView(this), new ChronographView(this), gridView, gridMapView, new TimeCircuitsView(this),
new QuestView(this), visorView, new EmpireView(this), new MuertosView(this), new HalloweenView(this));
new QuestView(this), visorView, new EmpireView(this), new MuertosView(this), halloweenView);
View[] canvasPanes = new View[canvasStyles.size()];
for (int i = 0; i < canvasPanes.length; i++) canvasPanes[i] = drawnPane(canvasStyles.get(i));
// Grid with map: its map layer goes under it, in the same pane.
@@ -506,6 +511,7 @@ public class MainActivity extends AppCompatActivity {
uiHandler.post(overviewRefresh);
inFront = true;
updateMapLocation();
updateMusicTap();
}
@Override
@@ -555,6 +561,7 @@ public class MainActivity extends AppCompatActivity {
uiHandler.removeCallbacks(overviewRefresh);
inFront = false;
updateMapLocation();
updateMusicTap();
}
@Override
@@ -1751,6 +1758,14 @@ public class MainActivity extends AppCompatActivity {
// The accent choices depend on the style ("Original colours" for Retro and Terminal).
if (settingsPane != null) bindAccentColor();
updateMapLocation();
updateMusicTap();
}
/** The pumpkin listens only while it can be seen: the app in front, on the Overview, in Halloween. */
private void updateMusicTap() {
ViewPager2 pager = findViewById(R.id.content);
musicTap.setRunning(inFront && overviewStyle() == OverviewStyle.HALLOWEEN
&& pager != null && pager.getCurrentItem() == 0);
}
/**