mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Started conference layout bottom sheet
This commit is contained in:
parent
fd3f85f2b7
commit
a571b77117
5 changed files with 115 additions and 2 deletions
|
|
@ -45,6 +45,7 @@ import org.linphone.ui.GenericActivity
|
|||
import org.linphone.ui.call.fragment.ActiveCallFragmentDirections
|
||||
import org.linphone.ui.call.fragment.ActiveConferenceCallFragmentDirections
|
||||
import org.linphone.ui.call.fragment.AudioDevicesMenuDialogFragment
|
||||
import org.linphone.ui.call.fragment.ConferenceLayoutMenuDialogFragment
|
||||
import org.linphone.ui.call.fragment.IncomingCallFragmentDirections
|
||||
import org.linphone.ui.call.fragment.OutgoingCallFragmentDirections
|
||||
import org.linphone.ui.call.model.AudioDeviceModel
|
||||
|
|
@ -103,6 +104,12 @@ class CallActivity : GenericActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
callViewModel.conferenceModel.showLayoutMenuEvent.observe(this) {
|
||||
it.consume {
|
||||
showConferenceLayoutMenu()
|
||||
}
|
||||
}
|
||||
|
||||
callViewModel.showLowWifiSignalEvent.observe(this) {
|
||||
it.consume { show ->
|
||||
val tag = "LOW_WIFI_SIGNAL"
|
||||
|
|
@ -408,4 +415,9 @@ class CallActivity : GenericActivity() {
|
|||
val modalBottomSheet = AudioDevicesMenuDialogFragment(devicesList)
|
||||
modalBottomSheet.show(supportFragmentManager, AudioDevicesMenuDialogFragment.TAG)
|
||||
}
|
||||
|
||||
private fun showConferenceLayoutMenu() {
|
||||
val modalBottomSheet = ConferenceLayoutMenuDialogFragment(callViewModel.conferenceModel)
|
||||
modalBottomSheet.show(supportFragmentManager, ConferenceLayoutMenuDialogFragment.TAG)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.call.fragment
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.UiThread
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import org.linphone.databinding.CallConferenceLayoutMenuBinding
|
||||
import org.linphone.ui.call.model.ConferenceModel
|
||||
|
||||
@UiThread
|
||||
class ConferenceLayoutMenuDialogFragment(
|
||||
val conferenceModel: ConferenceModel,
|
||||
private val onDismiss: (() -> Unit)? = null
|
||||
) : BottomSheetDialogFragment() {
|
||||
companion object {
|
||||
const val TAG = "ConferenceLayoutMenuDialogFragment"
|
||||
}
|
||||
|
||||
override fun onCancel(dialog: DialogInterface) {
|
||||
onDismiss?.invoke()
|
||||
super.onCancel(dialog)
|
||||
}
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
onDismiss?.invoke()
|
||||
super.onDismiss(dialog)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val view = CallConferenceLayoutMenuBinding.inflate(layoutInflater)
|
||||
|
||||
view.viewModel = conferenceModel
|
||||
|
||||
view.setGridClickListener {
|
||||
dismiss()
|
||||
}
|
||||
view.setActiveSpeakerClickListener {
|
||||
dismiss()
|
||||
}
|
||||
view.setAudioOnlyClickListener {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
return view.root
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
package org.linphone.ui.call.model
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.R
|
||||
|
|
@ -29,6 +30,7 @@ import org.linphone.core.Participant
|
|||
import org.linphone.core.ParticipantDevice
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class ConferenceModel {
|
||||
companion object {
|
||||
|
|
@ -45,10 +47,14 @@ class ConferenceModel {
|
|||
|
||||
val participantsLabel = MutableLiveData<String>()
|
||||
|
||||
private lateinit var conference: Conference
|
||||
|
||||
val isCurrentCallInConference = MutableLiveData<Boolean>()
|
||||
|
||||
val showLayoutMenuEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
private lateinit var conference: Conference
|
||||
|
||||
private val conferenceListener = object : ConferenceListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onParticipantAdded(conference: Conference, participant: Participant) {
|
||||
|
|
@ -154,6 +160,11 @@ class ConferenceModel {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun showLayoutMenu() {
|
||||
showLayoutMenuEvent.value = Event(true)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun computeParticipants() {
|
||||
participants.value.orEmpty().forEach(ConferenceParticipantModel::destroy)
|
||||
|
|
@ -209,6 +220,7 @@ class ConferenceModel {
|
|||
)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun sortParticipantDevicesList(devices: List<ConferenceParticipantDeviceModel>): ArrayList<ConferenceParticipantDeviceModel> {
|
||||
val sortedList = arrayListOf<ConferenceParticipantDeviceModel>()
|
||||
sortedList.addAll(devices)
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/layout"
|
||||
android:onClick="@{() -> viewModel.conferenceModel.showLayoutMenu()}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/call_button_size"
|
||||
android:layout_marginTop="@dimen/call_extra_button_top_margin"
|
||||
|
|
@ -193,6 +194,7 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/in_call_extra_action_label_style"
|
||||
android:id="@+id/layout_label"
|
||||
android:onClick="@{() -> viewModel.conferenceModel.showLayoutMenu()}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/call_action_change_layout"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,18 @@
|
|||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="gridClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="activeSpeakerClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="audioOnlyClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.call.model.ConferenceModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -14,6 +26,7 @@
|
|||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:onClick="@{gridClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -30,6 +43,7 @@
|
|||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:onClick="@{activeSpeakerClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -46,6 +60,7 @@
|
|||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:onClick="@{audioOnlyClickListener}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue