diff --git a/app/src/main/java/org/linphone/ui/call/conference/fragment/ConferenceParticipantsListFragment.kt b/app/src/main/java/org/linphone/ui/call/conference/fragment/ConferenceParticipantsListFragment.kt index b52308f41..63d9f0c4f 100644 --- a/app/src/main/java/org/linphone/ui/call/conference/fragment/ConferenceParticipantsListFragment.kt +++ b/app/src/main/java/org/linphone/ui/call/conference/fragment/ConferenceParticipantsListFragment.kt @@ -19,12 +19,18 @@ */ package org.linphone.ui.call.conference.fragment +import android.content.ClipData +import android.content.ClipboardManager +import android.content.Context import android.os.Bundle +import android.view.Gravity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.animation.Animation import android.view.animation.AnimationUtils +import android.widget.PopupWindow +import androidx.databinding.DataBindingUtil import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager @@ -32,6 +38,7 @@ import org.linphone.R import org.linphone.core.Participant import org.linphone.core.tools.Log import org.linphone.databinding.CallConferenceParticipantsListFragmentBinding +import org.linphone.databinding.CallConferenceParticipantsListPopupMenuBinding import org.linphone.ui.GenericActivity import org.linphone.ui.call.adapter.ConferenceParticipantsListAdapter import org.linphone.ui.call.fragment.GenericCallFragment @@ -100,6 +107,10 @@ class ConferenceParticipantsListFragment : GenericCallFragment() { } } + binding.setShowMenuClickListener { + showPopupMenu(binding.showMenu) + } + viewModel.conferenceModel.participants.observe(viewLifecycleOwner) { Log.i("$TAG participants list updated with [${it.size}] items") adapter.submitList(it) @@ -146,4 +157,37 @@ class ConferenceParticipantsListFragment : GenericCallFragment() { dialog.show() } + + private fun showPopupMenu(view: View) { + val popupView: CallConferenceParticipantsListPopupMenuBinding = DataBindingUtil.inflate( + LayoutInflater.from(requireContext()), + R.layout.call_conference_participants_list_popup_menu, + null, + false + ) + + val popupWindow = PopupWindow( + popupView.root, + ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT, + true + ) + + popupView.setShareInvitationClickListener { + val sipUri = viewModel.conferenceModel.sipUri.value.orEmpty() + if (sipUri.isNotEmpty()) { + Log.i("$TAG Sharing conference SIP URI [$sipUri]") + + val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager + val label = "Conference SIP address" + clipboard.setPrimaryClip(ClipData.newPlainText(label, sipUri)) + } + + popupWindow.dismiss() + } + + // Elevation is for showing a shadow around the popup + popupWindow.elevation = 20f + popupWindow.showAsDropDown(view, 0, 0, Gravity.BOTTOM) + } } diff --git a/app/src/main/res/layout/call_conference_participants_list_fragment.xml b/app/src/main/res/layout/call_conference_participants_list_fragment.xml index a6eb9cde2..fd2526f49 100644 --- a/app/src/main/res/layout/call_conference_participants_list_fragment.xml +++ b/app/src/main/res/layout/call_conference_participants_list_fragment.xml @@ -10,6 +10,9 @@ + @@ -18,7 +21,7 @@ + android:background="?attr/color_background_contrast_in_dark_mode"> + + + + + + + + + + + + + + + + + + + + \ No newline at end of file