Android: Test button beside the sound pack picker
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import eu.lixko.ts3j.client.android.audio.AndroidAudioBackend
|
||||
import eu.lixko.ts3j.client.android.audio.AudioRoute
|
||||
import eu.lixko.ts3j.client.audio.AudioDevice
|
||||
import eu.lixko.ts3j.client.config.Settings
|
||||
import eu.lixko.ts3j.client.sound.SoundEvent
|
||||
import eu.lixko.ts3j.client.sound.SoundNotifier
|
||||
import eu.lixko.ts3j.client.sound.SoundPack
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
@@ -53,6 +54,8 @@ class AudioSetup internal constructor(private val context: Context, private val
|
||||
settings.save()
|
||||
}
|
||||
|
||||
fun playTestSound() = sounds.preview(SoundEvent.SPECIAL_SOUND_TEST)
|
||||
|
||||
/** Unpacks the packs the app ships with, when this version has not yet. */
|
||||
fun installSoundPacks() {
|
||||
if (!SoundPackInstaller(context).install()) return
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.provider.Settings.canDrawOverlays
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -16,12 +17,14 @@ import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableFloatStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
@@ -156,9 +159,14 @@ fun SoundSettingsScreen(settings: Settings, sessions: SessionController, audio:
|
||||
if (packs.isEmpty()) {
|
||||
Hint("This build of the app came without sound packs.")
|
||||
} else {
|
||||
Picker("Sound pack", packs.map { it.id() to it.name() }, pack) { id ->
|
||||
packs.firstOrNull { it.id() == id }?.let(audio::setSoundPack)
|
||||
pack = id
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Box(Modifier.weight(1f)) {
|
||||
Picker("Sound pack", packs.map { it.id() to it.name() }, pack) { id ->
|
||||
packs.firstOrNull { it.id() == id }?.let(audio::setSoundPack)
|
||||
pack = id
|
||||
}
|
||||
}
|
||||
TextButton(audio::playTestSound, Modifier.padding(end = 8.dp)) { Text("Test") }
|
||||
}
|
||||
}
|
||||
Level("Volume", settings.soundVolume.get().toFloat(), 0f..1f, { "${(it * 100).roundToInt()} %" }) {
|
||||
|
||||
Reference in New Issue
Block a user