diff --git a/app/src/main/java/org/linphone/ui/call/model/AudioDeviceModel.kt b/app/src/main/java/org/linphone/ui/call/model/AudioDeviceModel.kt index 6265d3f44..1a436380d 100644 --- a/app/src/main/java/org/linphone/ui/call/model/AudioDeviceModel.kt +++ b/app/src/main/java/org/linphone/ui/call/model/AudioDeviceModel.kt @@ -19,14 +19,14 @@ */ package org.linphone.ui.call.model +import androidx.annotation.WorkerThread import org.linphone.core.AudioDevice -data class AudioDeviceModel( +data class AudioDeviceModel @WorkerThread constructor( val audioDevice: AudioDevice, val name: String, - val isSpeaker: Boolean, - val isHeadset: Boolean, - val isBluetooth: Boolean, + val type: AudioDevice.Type, + val isCurrentlySelected: Boolean, private val onAudioDeviceSelected: (() -> Unit)? = null ) { var dismissDialog: (() -> Unit)? = null diff --git a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt index 9c1cebe99..548d6369f 100644 --- a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt @@ -482,18 +482,50 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() { // Only list output audio devices if (!device.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) continue - val isSpeaker = device.type == AudioDevice.Type.Speaker - val isHeadset = device.type == AudioDevice.Type.Headset || device.type == AudioDevice.Type.Headphones - val isBluetooth = device.type == AudioDevice.Type.Bluetooth - val model = AudioDeviceModel(device, device.id, isSpeaker, isHeadset, isBluetooth) { + val name = when (device.type) { + AudioDevice.Type.Earpiece -> { + AppUtils.getString(R.string.call_audio_device_type_earpiece) + } + AudioDevice.Type.Speaker -> { + AppUtils.getString(R.string.call_audio_device_type_speaker) + } + AudioDevice.Type.Headset -> { + AppUtils.getString(R.string.call_audio_device_type_headset) + } + AudioDevice.Type.Headphones -> { + AppUtils.getString(R.string.call_audio_device_type_headphones) + } + AudioDevice.Type.Bluetooth -> { + AppUtils.getFormattedString( + R.string.call_audio_device_type_bluetooth, + device.deviceName + ) + } + AudioDevice.Type.HearingAid -> { + AppUtils.getFormattedString( + R.string.call_audio_device_type_hearing_aid, + device.deviceName + ) + } + else -> device.deviceName + } + val currentDevice = currentCall.outputAudioDevice + val isCurrentlyInUse = device.type == currentDevice?.type && device.deviceName == currentDevice?.deviceName + val model = AudioDeviceModel(device, name, device.type, isCurrentlyInUse) { // onSelected coreContext.postOnCoreThread { Log.i("$TAG Selected audio device with ID [${device.id}]") if (::currentCall.isInitialized) { - when { - isHeadset -> AudioUtils.routeAudioToHeadset(currentCall) - isBluetooth -> AudioUtils.routeAudioToBluetooth(currentCall) - isSpeaker -> AudioUtils.routeAudioToSpeaker(currentCall) + when (device.type) { + AudioDevice.Type.Headset, AudioDevice.Type.Headphones -> AudioUtils.routeAudioToHeadset( + currentCall + ) + AudioDevice.Type.Bluetooth, AudioDevice.Type.HearingAid -> AudioUtils.routeAudioToBluetooth( + currentCall + ) + AudioDevice.Type.Speaker -> AudioUtils.routeAudioToSpeaker( + currentCall + ) else -> AudioUtils.routeAudioToEarpiece(currentCall) } } diff --git a/app/src/main/res/drawable/picture_in_picture.xml b/app/src/main/res/drawable/picture_in_picture.xml new file mode 100644 index 000000000..15dc16e72 --- /dev/null +++ b/app/src/main/res/drawable/picture_in_picture.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/shape_squircle_gray_600_top_background.xml b/app/src/main/res/drawable/shape_squircle_gray_600_top_background.xml new file mode 100644 index 000000000..8a888a493 --- /dev/null +++ b/app/src/main/res/drawable/shape_squircle_gray_600_top_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/squares_four.xml b/app/src/main/res/drawable/squares_four.xml new file mode 100644 index 000000000..39930d7d9 --- /dev/null +++ b/app/src/main/res/drawable/squares_four.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/waveform.xml b/app/src/main/res/drawable/waveform.xml new file mode 100644 index 000000000..120ca1e70 --- /dev/null +++ b/app/src/main/res/drawable/waveform.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/call_audio_device_list_cell.xml b/app/src/main/res/layout/call_audio_device_list_cell.xml index 7ce481bbd..e734f30dd 100644 --- a/app/src/main/res/layout/call_audio_device_list_cell.xml +++ b/app/src/main/res/layout/call_audio_device_list_cell.xml @@ -4,30 +4,27 @@ + - - - - - + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:text="@{model.name, default=`Speaker`}" + android:textColor="@color/white" + android:gravity="center_vertical" + android:layout_marginBottom="1dp" + android:drawableEnd="@{model.type == Type.Speaker ? @drawable/speaker_high : model.type == Type.Bluetooth || model.type == Type.HearingAid ? @drawable/bluetooth : model.type == Type.Headphones || model.type == Type.Headset ? @drawable/headset : @drawable/ear, default=@drawable/speaker_high}" + android:drawableTint="@color/white" + android:checked="@{model.isCurrentlySelected}" + app:useMaterialThemeColors="false" + app:buttonTint="@color/white"/> \ No newline at end of file diff --git a/app/src/main/res/layout/call_audio_devices_menu.xml b/app/src/main/res/layout/call_audio_devices_menu.xml index c90ac6a0f..585e8a2b9 100644 --- a/app/src/main/res/layout/call_audio_devices_menu.xml +++ b/app/src/main/res/layout/call_audio_devices_menu.xml @@ -12,7 +12,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:background="@color/gray_500" + android:background="@drawable/shape_squircle_gray_600_top_background" entries="@{devices}" layout="@{@layout/call_audio_device_list_cell}"> diff --git a/app/src/main/res/layout/call_conference_layout_menu.xml b/app/src/main/res/layout/call_conference_layout_menu.xml new file mode 100644 index 000000000..ebb95b1ea --- /dev/null +++ b/app/src/main/res/layout/call_conference_layout_menu.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 88b018919..7abd76927 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -489,12 +489,23 @@ %s calls %s paused calls + Earpiece + Speaker + Bluetooth (%s) + Hearing aid (%s) + Headset + Headphones + Share invitation Waiting for other participants… Screen share Participants %s participants + Mosaic + Speaker + Audio only + Account connection error You aren\'t connected to internet