mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-19 07:48:28 +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) {
|
viewModel.showLongPressMenuForNumberOrAddressEvent.observe(viewLifecycleOwner) {
|
||||||
it.consume { model ->
|
it.consume { model ->
|
||||||
val modalBottomSheet = ContactNumberOrAddressMenuDialogFragment(model.isSip, {
|
val modalBottomSheet = ContactNumberOrAddressMenuDialogFragment(model.isSip, model.hasPresence, {
|
||||||
// onDismiss
|
// onDismiss
|
||||||
model.selected.value = false
|
model.selected.value = false
|
||||||
}, {
|
}, {
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import org.linphone.databinding.ContactNumberOrAddressLongPressMenuBinding
|
||||||
@UiThread
|
@UiThread
|
||||||
class ContactNumberOrAddressMenuDialogFragment(
|
class ContactNumberOrAddressMenuDialogFragment(
|
||||||
private val isSip: Boolean,
|
private val isSip: Boolean,
|
||||||
|
private val hideInviteMenu: Boolean,
|
||||||
private val onDismiss: (() -> Unit)? = null,
|
private val onDismiss: (() -> Unit)? = null,
|
||||||
private val onCopyNumberOrAddressToClipboard: (() -> Unit)? = null,
|
private val onCopyNumberOrAddressToClipboard: (() -> Unit)? = null,
|
||||||
private val onInviteNumberOrAddress: (() -> Unit)? = null
|
private val onInviteNumberOrAddress: (() -> Unit)? = null
|
||||||
|
|
@ -56,6 +57,7 @@ class ContactNumberOrAddressMenuDialogFragment(
|
||||||
): View {
|
): View {
|
||||||
val view = ContactNumberOrAddressLongPressMenuBinding.inflate(layoutInflater)
|
val view = ContactNumberOrAddressLongPressMenuBinding.inflate(layoutInflater)
|
||||||
view.isSip = isSip
|
view.isSip = isSip
|
||||||
|
view.hideInvite = hideInviteMenu
|
||||||
|
|
||||||
view.setCopyNumberOrAddressClickListener {
|
view.setCopyNumberOrAddressClickListener {
|
||||||
onCopyNumberOrAddressToClipboard?.invoke()
|
onCopyNumberOrAddressToClipboard?.invoke()
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ class ContactNumberOrAddressModel @UiThread constructor(
|
||||||
val isEnabled: Boolean,
|
val isEnabled: Boolean,
|
||||||
private val listener: ContactNumberOrAddressClickListener,
|
private val listener: ContactNumberOrAddressClickListener,
|
||||||
val isSip: Boolean = true,
|
val isSip: Boolean = true,
|
||||||
val label: String = ""
|
val label: String = "",
|
||||||
|
val hasPresence: Boolean = true
|
||||||
) {
|
) {
|
||||||
val selected = MutableLiveData<Boolean>()
|
val selected = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,8 @@ class ContactViewModel @UiThread constructor() : ViewModel() {
|
||||||
enablePhoneNumbers,
|
enablePhoneNumbers,
|
||||||
listener,
|
listener,
|
||||||
false,
|
false,
|
||||||
label
|
label,
|
||||||
|
presenceAddress != null
|
||||||
)
|
)
|
||||||
addressesAndNumbers.add(data)
|
addressesAndNumbers.add(data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
<variable
|
<variable
|
||||||
name="isSip"
|
name="isSip"
|
||||||
type="Boolean" />
|
type="Boolean" />
|
||||||
|
<variable
|
||||||
|
name="hideInvite"
|
||||||
|
type="Boolean" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
@ -37,7 +40,7 @@
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:onClick="@{inviteNumberOrAddressClickListener}"
|
android:onClick="@{inviteNumberOrAddressClickListener}"
|
||||||
style="@style/context_menu_action_label_style"
|
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:id="@+id/invite"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue