diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarLauncher.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarLauncher.kt
index aceca43..195c6ce 100644
--- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarLauncher.kt
+++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarLauncher.kt
@@ -401,6 +401,26 @@ private fun AppsWallpaper() {
Box(Modifier.fillMaxSize().background(background.copy(alpha = 0.3f)))
}
}
+ CarWallpaper.Mode.DEMO -> {
+ // Every scene by day, then by night, two seconds each, named in the corner.
+ val steps = remember { listOf(true, false).flatMap { day -> SkyScene.entries.map { it to day } } }
+ var step by remember { mutableStateOf(0) }
+ LaunchedEffect(Unit) {
+ while (true) {
+ kotlinx.coroutines.delay(2_000)
+ step = (step + 1) % steps.size
+ }
+ }
+ val (scene, day) = steps[step]
+ WeatherScene(scene, day, dark, Modifier.fillMaxSize())
+ Text(
+ "${scene.name.lowercase().replace('_', ' ')} · ${if (day) "day" else "night"} · ${if (dark) "dark" else "light"} mode",
+ Modifier.fillMaxSize().padding(8.dp),
+ color = Color.White,
+ style = MaterialTheme.typography.labelLarge,
+ textAlign = TextAlign.End,
+ )
+ }
CarWallpaper.Mode.WEATHER -> {
val weather by Weather.state.collectAsState()
LaunchedEffect(Unit) { Weather.refresh(context) }
diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarWallpaper.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarWallpaper.kt
index 6b5980e..6f8f008 100644
--- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarWallpaper.kt
+++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarWallpaper.kt
@@ -19,7 +19,8 @@ import kotlinx.coroutines.flow.StateFlow
*/
object CarWallpaper {
- enum class Mode { OFF, PHOTO, WEATHER }
+ /** [DEMO] steps through every weather scene, for checking them; debug builds only. */
+ enum class Mode { OFF, PHOTO, WEATHER, DEMO }
private const val KEY_MODE = "car_wallpaper"
private const val LIGHT = "wallpaper-light.jpg"
diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt
index a04702f..6323b78 100644
--- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt
+++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt
@@ -652,7 +652,10 @@ private fun WallpaperRows() {
app.seb3thehacker.gearslip.car.CarWallpaper.Mode.OFF to stringResource(R.string.choice_wallpaper_off),
app.seb3thehacker.gearslip.car.CarWallpaper.Mode.PHOTO to stringResource(R.string.choice_wallpaper_photo),
app.seb3thehacker.gearslip.car.CarWallpaper.Mode.WEATHER to stringResource(R.string.choice_wallpaper_weather),
- ),
+ ) + if (app.seb3thehacker.gearslip.BuildConfig.DEBUG) {
+ // Not translated: debug builds only, for checking every scene.
+ listOf(app.seb3thehacker.gearslip.car.CarWallpaper.Mode.DEMO to "Weather demo")
+ } else emptyList(),
mode,
{ app.seb3thehacker.gearslip.car.CarWallpaper.setMode(context, it) },
note = stringResource(R.string.car_wallpaper_note),
diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt
index 7b20cc6..3549d1f 100644
--- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt
+++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt
@@ -153,6 +153,7 @@ fun SettingsScreen(
footer = stringResource(R.string.settings_support_footer),
) { DonateRows() }
if (ready(2)) ConnectionSection()
+ if (ready(2)) ShizukuSection()
if (SHOW_RECOMMENDED_APPS && ready(6)) AppsSection(onOpenRecommendedApps)
if (ready(7)) SettingsSection(
stringResource(R.string.settings_usage_notes),
diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/ShizukuGrantButton.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/ShizukuGrantButton.kt
index c74092e..4c7d06b 100644
--- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/ShizukuGrantButton.kt
+++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/ShizukuGrantButton.kt
@@ -3,6 +3,7 @@ package app.seb3thehacker.gearslip.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
@@ -35,7 +36,8 @@ fun ShizukuGrantButton(modifier: Modifier = Modifier) {
if (state == ShizukuSetup.State.MISSING) return
Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
when {
- granted -> Text(stringResource(R.string.shizuku_done), style = MaterialTheme.typography.bodyMedium)
+ // Phone apps on the car screen need Shizuku's permission even when adb did the grants.
+ granted && state == ShizukuSetup.State.READY -> Text(stringResource(R.string.shizuku_done), style = MaterialTheme.typography.bodyMedium)
state == ShizukuSetup.State.STOPPED -> Text(stringResource(R.string.shizuku_stopped), style = MaterialTheme.typography.bodyMedium)
else -> OutlinedButton(onClick = ShizukuSetup::setUp, enabled = !working, modifier = Modifier.fillMaxWidth()) {
Text(stringResource(if (working) R.string.shizuku_working else R.string.shizuku_set_up))
@@ -43,3 +45,18 @@ fun ShizukuGrantButton(modifier: Modifier = Modifier) {
}
}
}
+
+/**
+ * Settings' own place for Shizuku, whatever the audio choice: the setup guide and Help only show
+ * the adb steps when music goes through Gearslip, but phone apps on the car screen need Shizuku
+ * too. Shown only when Shizuku is installed.
+ */
+@Composable
+fun ShizukuSection() {
+ val state by ShizukuSetup.state.collectAsState()
+ LaunchedEffect(Unit) { ShizukuSetup.refresh() }
+ if (state == ShizukuSetup.State.MISSING) return
+ SettingsSection(stringResource(R.string.settings_shizuku), footer = stringResource(R.string.settings_shizuku_footer)) {
+ ShizukuGrantButton(Modifier.padding(horizontal = 16.dp, vertical = 12.dp))
+ }
+}
diff --git a/gearslip/src/main/res/values/strings.xml b/gearslip/src/main/res/values/strings.xml
index 27aea7d..2558ff2 100644
--- a/gearslip/src/main/res/values/strings.xml
+++ b/gearslip/src/main/res/values/strings.xml
@@ -748,6 +748,8 @@
Tap to change it.
Remove
This app couldn\'t open on the car screen. Check that Shizuku is running, then try again.
+ Shizuku
+ Shizuku gives Gearslip the powers of adb without a computer. With it, Android stops asking to share the screen every drive, and any phone app can open on the car screen.
Set up with Shizuku
Setting up…
Set up through Shizuku. Nothing more to do here.