mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Hide 'invite' menu when phone number has presence info
This commit is contained in:
parent
bb55246197
commit
855b03fb34
5 changed files with 11 additions and 4 deletions
|
|
@ -118,7 +118,7 @@ class ContactFragment : GenericFragment() {
|
|||
|
||||
viewModel.showLongPressMenuForNumberOrAddressEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { model ->
|
||||
val modalBottomSheet = ContactNumberOrAddressMenuDialogFragment(model.isSip, {
|
||||
val modalBottomSheet = ContactNumberOrAddressMenuDialogFragment(model.isSip, model.hasPresence, {
|
||||
// onDismiss
|
||||
model.selected.value = false
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.linphone.databinding.ContactNumberOrAddressLongPressMenuBinding
|
|||
@UiThread
|
||||
class ContactNumberOrAddressMenuDialogFragment(
|
||||
private val isSip: Boolean,
|
||||
private val hideInviteMenu: Boolean,
|
||||
private val onDismiss: (() -> Unit)? = null,
|
||||
private val onCopyNumberOrAddressToClipboard: (() -> Unit)? = null,
|
||||
private val onInviteNumberOrAddress: (() -> Unit)? = null
|
||||
|
|
@ -56,6 +57,7 @@ class ContactNumberOrAddressMenuDialogFragment(
|
|||
): View {
|
||||
val view = ContactNumberOrAddressLongPressMenuBinding.inflate(layoutInflater)
|
||||
view.isSip = isSip
|
||||
view.hideInvite = hideInviteMenu
|
||||
|
||||
view.setCopyNumberOrAddressClickListener {
|
||||
onCopyNumberOrAddressToClipboard?.invoke()
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ class ContactNumberOrAddressModel @UiThread constructor(
|
|||
val isEnabled: Boolean,
|
||||
private val listener: ContactNumberOrAddressClickListener,
|
||||
val isSip: Boolean = true,
|
||||
val label: String = ""
|
||||
val label: String = "",
|
||||
val hasPresence: Boolean = true
|
||||
) {
|
||||
val selected = MutableLiveData<Boolean>()
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,8 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
|
|||
enablePhoneNumbers,
|
||||
listener,
|
||||
false,
|
||||
label
|
||||
label,
|
||||
presenceAddress != null
|
||||
)
|
||||
addressesAndNumbers.add(data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@
|
|||
<variable
|
||||
name="isSip"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="hideInvite"
|
||||
type="Boolean" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -37,7 +40,7 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{inviteNumberOrAddressClickListener}"
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:visibility="@{isSip ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{isSip || hideInvite ? View.GONE : View.VISIBLE}"
|
||||
android:id="@+id/invite"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue