Every menu, dialog and overlay on Jetpack Compose

The main screen, the loading overlay, the HUD line, the drawer and the three
dialogs are composables now, driven by state the activities own. The session's
SurfaceView and the on-screen pad stay Views underneath a single Compose layer,
which is what they are in any Compose app: a compositor surface and a canvas,
not menus. The XML layouts are gone; the activities extend ComponentActivity
and Back goes through its dispatcher.
This commit is contained in:
The412Banner committed 2026-09-19 16:05:54 -04:00
1 parent 18364845ad
commit aa7c71bfb6
15 files changed
+783 -741

No files matched your search

-113
View File
@@ -1,113 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Scrolls, and sizes itself from dimens that follow the window width: the first cut of this
screen put the install button under the navigation bar on a landscape phone with no way to
reach it. Everything here is small on purpose — it is a launcher, not the app.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF101418"
android:fillViewport="true"
android:fitsSystemWindows="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:paddingStart="@dimen/page_side"
android:paddingEnd="@dimen/page_side"
android:paddingTop="20dp"
android:paddingBottom="20dp">
<ImageView
android:id="@+id/logo"
android:layout_width="@dimen/logo_size"
android:layout_height="@dimen/logo_size"
android:layout_marginBottom="8dp"
android:contentDescription="@string/app_name"
android:src="@drawable/logo" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="#FFFFFFFF"
android:textSize="22sp" />
<TextView
android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/subtitle"
android:textColor="#FF8899A6"
android:textSize="12sp"
android:layout_marginBottom="18dp" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFDDDDDD"
android:textSize="15sp" />
<TextView
android:id="@+id/detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#FF8899A6"
android:textSize="12sp"
android:layout_marginTop="4dp" />
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:max="100"
android:visibility="gone" />
<Button
android:id="@+id/play"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:minHeight="40dp"
android:textSize="14sp"
android:text="@string/play" />
<Button
android:id="@+id/runtime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="40dp"
android:textSize="13sp"
android:text="@string/install_runtime" />
<Button
android:id="@+id/frame_gen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="40dp"
android:textSize="13sp"
android:text="@string/frame_gen" />
<TextView
android:id="@+id/credits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:padding="6dp"
android:text="@string/credits_line"
android:textColor="#FF667788"
android:textSize="11sp" />
</LinearLayout>
</ScrollView>
@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
The in-session drawer, opened with Back. A tap on the dimmed area or Back again closes it.
Small on purpose: the switches a player reaches for mid-game, nothing that needs the main
screen.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
android:clickable="true"
android:focusable="true">
<LinearLayout
android:id="@+id/drawer_panel"
android:layout_width="264dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:orientation="vertical"
android:background="#F2151A22"
android:clickable="true"
android:focusable="true"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="#FFFFFFFF"
android:textSize="16sp"
android:layout_marginBottom="12dp" />
<Switch
android:id="@+id/drawer_hud"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="40dp"
android:text="@string/drawer_hud"
android:textColor="#FFDDDDDD"
android:textSize="13sp" />
<Button
android:id="@+id/drawer_frame_gen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:minHeight="40dp"
android:textSize="13sp" />
<Button
android:id="@+id/drawer_osc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="40dp"
android:textSize="13sp" />
<Button
android:id="@+id/drawer_shape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="40dp"
android:textSize="13sp" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/drawer_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="40dp"
android:textSize="13sp"
android:text="@string/drawer_background" />
<Button
android:id="@+id/drawer_stop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minHeight="40dp"
android:textSize="13sp"
android:textColor="#FFFF8A80"
android:text="@string/stop_session" />
</LinearLayout>
</FrameLayout>
@@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
What the user sees until the client draws its first frame, which on a first run is minutes:
the runtime's own milestones, the client's download progress lifted out of its log, a clock
that proves time is passing, and a hint about what all of this is. Sized small and centred so
it reads the same on a phone and a tablet.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#FF000000"
android:padding="32dp">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginBottom="14dp"
android:contentDescription="@string/app_name"
android:src="@drawable/logo" />
<TextView
android:id="@+id/loading_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loading_title"
android:textColor="#FFFFFFFF"
android:textSize="17sp" />
<TextView
android:id="@+id/loading_step"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:gravity="center"
android:text="@string/session_starting"
android:textColor="#FFB8C4D0"
android:textSize="13sp" />
<ProgressBar
android:id="@+id/loading_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:indeterminate="true"
android:max="100" />
<TextView
android:id="@+id/loading_elapsed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="#FF667788"
android:textSize="11sp" />
<TextView
android:id="@+id/loading_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:gravity="center"
android:maxWidth="360dp"
android:textColor="#FF667788"
android:textSize="11sp" />
</LinearLayout>