audio: the Bluetooth question stacks its buttons, and no longer says the music goes over USB

This commit is contained in:
Seb3thehacker committed 2026-10-26 20:28:46 -07:00
1 parent 7959b27d38
commit 738b99ff9e
3 files changed
+23 -9

No files matched your search

@@ -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
@@ -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 = {},
)
}
+1 -1
View File
@@ -415,7 +415,7 @@
<string name="audio_open_settings">Open app settings</string>
<!-- -->
<string name="audio_bt_body">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.</string>
<string name="audio_bt_body">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.</string>
<string name="audio_keep_usb">Or keep USB and stop the question for good: plug the phone into a computer with USB debugging on, and run this once.</string>
<string name="audio_mic_body">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.</string>