Added setting to disable automatically switch audio route to bluetooth device when available

This commit is contained in:
Sylvain Berfini 2021-11-17 17:24:04 +01:00
parent 250c06ec06
commit 59cfddde83
4 changed files with 18 additions and 0 deletions

View file

@ -110,6 +110,13 @@ class AudioSettingsViewModel : GenericSettingsViewModel() {
val outputAudioDeviceLabels = MutableLiveData<ArrayList<String>>()
private val outputAudioDeviceValues = MutableLiveData<ArrayList<AudioDevice>>()
val preferBluetoothDevicesListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) {
prefs.routeAudioToBluetoothIfAvailable = newValue
}
}
val preferBluetoothDevices = MutableLiveData<Boolean>()
val codecBitrateListener = object : SettingListenerStub() {
override fun onListValueChanged(position: Int) {
for (payloadType in core.audioPayloadTypes) {
@ -154,6 +161,7 @@ class AudioSettingsViewModel : GenericSettingsViewModel() {
prefs.getString(R.string.audio_settings_echo_canceller_calibration_summary)
}
echoTesterStatus.value = prefs.getString(R.string.audio_settings_echo_tester_summary)
preferBluetoothDevices.value = prefs.routeAudioToBluetoothIfAvailable
initInputAudioDevicesList()
initOutputAudioDevicesList()
initCodecBitrateList()

View file

@ -110,6 +110,12 @@
linphone:selectedIndex="@{viewModel.outputAudioDeviceIndex}"
linphone:labels="@{viewModel.outputAudioDeviceLabels}"/>
<include
layout="@layout/settings_widget_switch"
linphone:title="@{@string/audio_settings_prefer_bluetooth_devices_title}"
linphone:listener="@{viewModel.preferBluetoothDevicesListener}"
linphone:checked="@={viewModel.preferBluetoothDevices}"/>
<include
layout="@layout/settings_widget_list"
linphone:title="@{@string/audio_settings_codec_bitrate_title}"

View file

@ -627,4 +627,6 @@
<string name="chat_room_unread_messages">%1$d messages non lus</string>
<string name="chat_room_unread_message">%1$d message non lu</string>
<string name="content_descripton_scroll_to_bottom">Aller au dernier message reçu ou au premier message non lu</string>
<string name="audio_settings_prefer_bluetooth_devices_title">Acheminer l\'audio vers l\'appareil bluetooth, s\'il existe</string>
<string name="audio_settings_prefer_bluetooth_devices_summary">Il aura la priorité sur le périphérique de sortie par défaut</string>
</resources>

View file

@ -376,6 +376,8 @@
<string name="audio_settings_input_device_summary">Changes will take effect starting next call</string>
<string name="audio_settings_output_device_title">Default output audio device</string>
<string name="audio_settings_output_device_summary">Changes will take effect starting next call</string>
<string name="audio_settings_prefer_bluetooth_devices_title">Route audio to the bluetooth device if any</string>
<string name="audio_settings_prefer_bluetooth_devices_summary">It will have priority over the default output device</string>
<string name="audio_settings_codec_bitrate_title">Codec bitrate limit</string>
<string name="audio_settings_microphone_gain_title">Microphone gain</string>
<string name="audio_settings_microphone_gain_summary">(in decibels)</string>