diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/GearslipActivity.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/GearslipActivity.kt index dc70f21..a397a1f 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/GearslipActivity.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/GearslipActivity.kt @@ -320,6 +320,8 @@ class GearslipActivity : ComponentActivity(), Projection { } private fun handleIntent(intent: Intent?) { + // Debug builds only: opens the audio choice for a look, without turning down a real prompt. + if (BuildConfig.DEBUG && intent?.getBooleanExtra("show_audio_choice", false) == true) offerBluetooth.value = true if (intent?.action == app.seb3thehacker.gearslip.wireless.WirelessAuto.ACTION_CAR_NEARBY) { connectToNearbyCar(intent.getStringExtra(app.seb3thehacker.gearslip.wireless.WirelessAuto.EXTRA_ADDRESS)) return diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/AudioChoiceDialog.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/AudioChoiceDialog.kt index 745814b..beebd4e 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/AudioChoiceDialog.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/AudioChoiceDialog.kt @@ -4,6 +4,13 @@ import androidx.compose.ui.res.stringResource import app.seb3thehacker.gearslip.R 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.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Button +import androidx.compose.material3.OutlinedButton +import androidx.compose.ui.Modifier import androidx.compose.material3.AlertDialog import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -28,23 +35,28 @@ fun AudioChoiceDialog(onUseBluetooth: () -> Unit, onKeepAsking: () -> Unit) { onDismissRequest = onKeepAsking, title = { Text(stringResource(R.string.audio_bt_title)) }, text = { - Column(verticalArrangement = Arrangement.spacedBy(12.dp)) { - Text( - stringResource(R.string.audio_bt_body), - ) + Column(Modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(12.dp)) { + Text(stringResource(R.string.audio_bt_body)) if (showCommand) { Text( stringResource(R.string.audio_keep_usb), style = MaterialTheme.typography.bodyMedium, ) CopyableCommand("adb shell appops set ${BuildConfig.APPLICATION_ID} PROJECT_MEDIA allow") - } else { - TextButton(onClick = { showCommand = true }) { Text(stringResource(R.string.audio_never_ask)) } + } + // Stacked full width: three labels this long never fit the dialog's one button row. + Column(Modifier.fillMaxWidth().padding(top = 4.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { + Button(onClick = onUseBluetooth, Modifier.fillMaxWidth()) { Text(stringResource(R.string.audio_use_bt)) } + OutlinedButton(onClick = onKeepAsking, Modifier.fillMaxWidth()) { Text(stringResource(R.string.audio_keep_asking)) } + if (!showCommand) { + TextButton(onClick = { showCommand = true }, Modifier.fillMaxWidth()) { + Text(stringResource(R.string.audio_never_ask)) + } + } } } }, - confirmButton = { TextButton(onClick = onUseBluetooth) { Text(stringResource(R.string.audio_use_bt)) } }, - dismissButton = { TextButton(onClick = onKeepAsking) { Text(stringResource(R.string.audio_keep_asking)) } }, + confirmButton = {}, ) } diff --git a/gearslip/src/main/res/values/strings.xml b/gearslip/src/main/res/values/strings.xml index bcd8ecc..295e5fc 100644 --- a/gearslip/src/main/res/values/strings.xml +++ b/gearslip/src/main/res/values/strings.xml @@ -415,7 +415,7 @@ Open app settings - Android treats music sent over USB like sharing your screen, so it asks every drive. Over Bluetooth it never asks. You can change this later in Settings. + Android treats the music Gearslip sends to the car like sharing your screen, so it asks every drive, over a cable or wireless. Over Bluetooth it never asks. You can change this later in Settings. Or keep USB and stop the question for good: plug the phone into a computer with USB debugging on, and run this once. Android lets an app send other apps\' sound to the car only if it has the microphone permission. It\'s turned off for Gearslip, so music plays on the phone. Turn it on under Permissions, then Microphone.