Added conference subject to address when copying it into clipboard
This commit is contained in:
parent
f304055671
commit
318d41a9fc
3 changed files with 14 additions and 6 deletions
|
@ -31,7 +31,6 @@ import androidx.recyclerview.widget.ListAdapter
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.linphone.R
|
||||
import org.linphone.activities.main.conference.data.ScheduledConferenceData
|
||||
import org.linphone.core.Address
|
||||
import org.linphone.databinding.ConferenceScheduleCellBinding
|
||||
import org.linphone.databinding.ConferenceScheduleListHeaderBinding
|
||||
import org.linphone.utils.Event
|
||||
|
@ -42,8 +41,8 @@ class ScheduledConferencesAdapter(
|
|||
private val viewLifecycleOwner: LifecycleOwner
|
||||
) : ListAdapter<ScheduledConferenceData, RecyclerView.ViewHolder>(ConferenceInfoDiffCallback()),
|
||||
HeaderAdapter {
|
||||
val copyAddressToClipboardEvent: MutableLiveData<Event<Address>> by lazy {
|
||||
MutableLiveData<Event<Address>>()
|
||||
val copyAddressToClipboardEvent: MutableLiveData<Event<String>> by lazy {
|
||||
MutableLiveData<Event<String>>()
|
||||
}
|
||||
|
||||
val joinConferenceEvent: MutableLiveData<Event<Pair<String, String?>>> by lazy {
|
||||
|
@ -108,8 +107,8 @@ class ScheduledConferencesAdapter(
|
|||
lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
setCopyAddressClickListener {
|
||||
val address = conferenceData.conferenceInfo.uri
|
||||
if (address != null) {
|
||||
val address = conferenceData.getAddressAsString()
|
||||
if (address.isNotEmpty()) {
|
||||
copyAddressToClipboardEvent.value = Event(address)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,6 +99,15 @@ class ScheduledConferenceData(val conferenceInfo: ConferenceInfo) {
|
|||
computeBackgroundResId()
|
||||
}
|
||||
|
||||
fun getAddressAsString(): String {
|
||||
val address = conferenceInfo.uri?.clone()
|
||||
if (address != null) {
|
||||
address.displayName = conferenceInfo.subject
|
||||
return address.asString()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun computeBackgroundResId() {
|
||||
backgroundResId.value = if (isFinished.value == true) {
|
||||
if (expanded.value == true) {
|
||||
|
|
|
@ -83,7 +83,7 @@ class ScheduledConferencesFragment : GenericFragment<ConferencesScheduledFragmen
|
|||
it.consume { address ->
|
||||
val clipboard =
|
||||
requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip = ClipData.newPlainText("Conference address", address.asStringUriOnly())
|
||||
val clip = ClipData.newPlainText("Conference address", address)
|
||||
clipboard.setPrimaryClip(clip)
|
||||
|
||||
(activity as MainActivity).showSnackBar(R.string.conference_schedule_address_copied_to_clipboard)
|
||||
|
|
Loading…
Reference in a new issue