mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-23 19:48:30 +00:00
Removed route audio to bluetooth setting, already done by TelecomManager
This commit is contained in:
parent
f9f25b2b15
commit
ee4e332330
4 changed files with 2 additions and 65 deletions
|
|
@ -80,13 +80,6 @@ class CorePreferences @UiThread constructor(private val context: Context) {
|
||||||
|
|
||||||
// Calls settings
|
// Calls settings
|
||||||
|
|
||||||
@get:WorkerThread @set:WorkerThread
|
|
||||||
var routeAudioToBluetoothIfAvailable: Boolean
|
|
||||||
get() = config.getBool("app", "route_audio_to_bluetooth_if_available", true)
|
|
||||||
set(value) {
|
|
||||||
config.setBool("app", "route_audio_to_bluetooth_if_available", value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// This won't be done if bluetooth or wired headset is used
|
// This won't be done if bluetooth or wired headset is used
|
||||||
@get:WorkerThread @set:WorkerThread
|
@get:WorkerThread @set:WorkerThread
|
||||||
var routeAudioToSpeakerWhenVideoIsEnabled: Boolean
|
var routeAudioToSpeakerWhenVideoIsEnabled: Boolean
|
||||||
|
|
|
||||||
|
|
@ -431,24 +431,7 @@ class MeetingWaitingRoomViewModel @UiThread constructor() : GenericViewModel() {
|
||||||
private fun initOutputAudioDevice(videoEnabled: Boolean) {
|
private fun initOutputAudioDevice(videoEnabled: Boolean) {
|
||||||
val core = coreContext.core
|
val core = coreContext.core
|
||||||
|
|
||||||
val audioDevice = if (corePreferences.routeAudioToBluetoothIfAvailable) {
|
val audioDevice = if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && videoEnabled) {
|
||||||
// Prefer bluetooth audio device if setting says so
|
|
||||||
if (bluetoothAudioDevice != null) {
|
|
||||||
bluetoothAudioDevice
|
|
||||||
} else {
|
|
||||||
if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && videoEnabled) {
|
|
||||||
// If setting says to use speaker when video is enabled, use speaker instead of earpiece
|
|
||||||
val defaultDevice = core.outputAudioDevice ?: core.defaultOutputAudioDevice
|
|
||||||
if (defaultDevice?.type == AudioDevice.Type.Earpiece) {
|
|
||||||
speakerAudioDevice
|
|
||||||
} else {
|
|
||||||
defaultDevice
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
core.outputAudioDevice ?: core.defaultOutputAudioDevice
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (corePreferences.routeAudioToSpeakerWhenVideoIsEnabled && videoEnabled) {
|
|
||||||
// If setting says to use speaker when video is enabled, use speaker instead of earpiece
|
// If setting says to use speaker when video is enabled, use speaker instead of earpiece
|
||||||
val defaultDevice = core.outputAudioDevice ?: core.defaultOutputAudioDevice
|
val defaultDevice = core.outputAudioDevice ?: core.defaultOutputAudioDevice
|
||||||
if (defaultDevice?.type == AudioDevice.Type.Earpiece) {
|
if (defaultDevice?.type == AudioDevice.Type.Earpiece) {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
|
||||||
|
|
||||||
// Calls settings
|
// Calls settings
|
||||||
val echoCancellerEnabled = MutableLiveData<Boolean>()
|
val echoCancellerEnabled = MutableLiveData<Boolean>()
|
||||||
val routeAudioToBluetooth = MutableLiveData<Boolean>()
|
|
||||||
val videoEnabled = MutableLiveData<Boolean>()
|
val videoEnabled = MutableLiveData<Boolean>()
|
||||||
val videoFecEnabled = MutableLiveData<Boolean>()
|
val videoFecEnabled = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
|
@ -230,7 +229,6 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
|
||||||
isUiSecureModeEnabled.postValue(corePreferences.enableSecureMode)
|
isUiSecureModeEnabled.postValue(corePreferences.enableSecureMode)
|
||||||
|
|
||||||
echoCancellerEnabled.postValue(core.isEchoCancellationEnabled)
|
echoCancellerEnabled.postValue(core.isEchoCancellationEnabled)
|
||||||
routeAudioToBluetooth.postValue(corePreferences.routeAudioToBluetoothIfAvailable)
|
|
||||||
videoEnabled.postValue(core.isVideoEnabled)
|
videoEnabled.postValue(core.isVideoEnabled)
|
||||||
videoFecEnabled.postValue(core.isFecEnabled)
|
videoFecEnabled.postValue(core.isFecEnabled)
|
||||||
vibrateDuringIncomingCall.postValue(core.isVibrationOnIncomingCallEnabled)
|
vibrateDuringIncomingCall.postValue(core.isVibrationOnIncomingCallEnabled)
|
||||||
|
|
@ -309,15 +307,6 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
|
||||||
fun toggleRouteAudioToBluetooth() {
|
|
||||||
val newValue = routeAudioToBluetooth.value == false
|
|
||||||
coreContext.postOnCoreThread {
|
|
||||||
corePreferences.routeAudioToBluetoothIfAvailable = newValue
|
|
||||||
routeAudioToBluetooth.postValue(newValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun toggleEnableVideo() {
|
fun toggleEnableVideo() {
|
||||||
val newValue = videoEnabled.value == false
|
val newValue = videoEnabled.value == false
|
||||||
|
|
|
||||||
|
|
@ -58,34 +58,6 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
style="@style/settings_title_style"
|
|
||||||
android:onClick="@{() -> viewModel.toggleRouteAudioToBluetooth()}"
|
|
||||||
android:id="@+id/route_audio_to_bluetooth_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:text="@string/settings_calls_route_audio_to_bluetooth_title"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:ellipsize="end"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/route_audio_to_bluetooth_switch"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/route_audio_to_bluetooth_switch"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/route_audio_to_bluetooth_switch"/>
|
|
||||||
|
|
||||||
<com.google.android.material.materialswitch.MaterialSwitch
|
|
||||||
style="@style/material_switch_style"
|
|
||||||
android:id="@+id/route_audio_to_bluetooth_switch"
|
|
||||||
android:onClick="@{() -> viewModel.toggleRouteAudioToBluetooth()}"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:checked="@{viewModel.routeAudioToBluetooth}"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/echo_canceller_switch" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/settings_title_style"
|
style="@style/settings_title_style"
|
||||||
android:onClick="@{() -> viewModel.toggleEnableVideo()}"
|
android:onClick="@{() -> viewModel.toggleEnableVideo()}"
|
||||||
|
|
@ -112,7 +84,7 @@
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:checked="@{viewModel.videoEnabled}"
|
android:checked="@{viewModel.videoEnabled}"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/route_audio_to_bluetooth_switch" />
|
app:layout_constraintTop_toBottomOf="@id/echo_canceller_switch" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/settings_title_style"
|
style="@style/settings_title_style"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue