mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-27 16:49:21 +00:00
Removed delete contact option for native ones, will be re-imported at next restart anyway
This commit is contained in:
parent
bdd5c8766b
commit
3698e1673e
6 changed files with 15 additions and 3 deletions
|
|
@ -282,6 +282,7 @@ class ContactsListFragment : AbstractMainFragment() {
|
|||
model.isFavourite.value == true,
|
||||
model.isStored,
|
||||
isReadOnly = model.isReadOnly,
|
||||
isNative = model.isNative,
|
||||
{ // onDismiss
|
||||
adapter.resetSelection()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class ContactsListMenuDialogFragment(
|
|||
private val isFavourite: Boolean,
|
||||
private val isStored: Boolean,
|
||||
private val isReadOnly: Boolean,
|
||||
private val isNative: Boolean,
|
||||
private val onDismiss: (() -> Unit)? = null,
|
||||
private val onFavourite: (() -> Unit)? = null,
|
||||
private val onShare: (() -> Unit)? = null,
|
||||
|
|
@ -72,6 +73,7 @@ class ContactsListMenuDialogFragment(
|
|||
view.isFavourite = isFavourite
|
||||
view.isStored = isStored
|
||||
view.isReadOnly = isReadOnly
|
||||
view.isNative = isNative
|
||||
|
||||
view.setFavoriteClickListener {
|
||||
onFavourite?.invoke()
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ class ContactAvatarModel
|
|||
|
||||
val isReadOnly = friend.isReadOnly
|
||||
|
||||
val isNative = !friend.nativeUri.isNullOrEmpty()
|
||||
|
||||
val isFavourite = MutableLiveData<Boolean>()
|
||||
|
||||
val lastPresenceInfo = MutableLiveData<String>()
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ class ContactViewModel
|
|||
|
||||
val isReadOnly = MutableLiveData<Boolean>()
|
||||
|
||||
val isNative = MutableLiveData<Boolean>()
|
||||
|
||||
val chatDisabled = MutableLiveData<Boolean>()
|
||||
|
||||
val videoCallDisabled = MutableLiveData<Boolean>()
|
||||
|
|
@ -236,6 +238,7 @@ class ContactViewModel
|
|||
init {
|
||||
isStored.value = false
|
||||
isReadOnly.value = false
|
||||
isNative.value = false
|
||||
|
||||
expandNumbersAndAddresses.value = true
|
||||
trustedDevicesPercentage.value = 0
|
||||
|
|
@ -312,6 +315,7 @@ class ContactViewModel
|
|||
// if they are in a temporary one (for example if they are from a remote directory such as LDAP or CardDAV)
|
||||
isStored.postValue(!coreContext.contactsManager.isContactTemporary(friend))
|
||||
isReadOnly.postValue(friend.isReadOnly)
|
||||
isNative.postValue(!friend.nativeUri.isNullOrEmpty())
|
||||
|
||||
contact.value?.destroy()
|
||||
contact.postValue(ContactAvatarModel(friend))
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@
|
|||
android:background="@drawable/action_background_bottom"
|
||||
android:text="@string/contact_details_delete"
|
||||
android:drawableStart="@drawable/trash_simple"
|
||||
android:visibility="@{viewModel.isStored && !viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{viewModel.isStored && !viewModel.isReadOnly && !viewModel.isNative ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/action_share"/>
|
||||
|
|
@ -573,7 +573,7 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:background="?attr/color_separator"
|
||||
android:importantForAccessibility="no"
|
||||
android:visibility="@{viewModel.isStored && !viewModel.isReadOnly ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{viewModel.isStored && !viewModel.isReadOnly && !viewModel.isNative ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintEnd_toEndOf="@id/action_edit"
|
||||
app:layout_constraintStart_toStartOf="@id/action_edit"
|
||||
app:layout_constraintTop_toBottomOf="@+id/action_edit"/>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
<variable
|
||||
name="isReadOnly"
|
||||
type="Boolean" />
|
||||
<variable
|
||||
name="isNative"
|
||||
type="Boolean" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -69,7 +72,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/contact_details_delete"
|
||||
android:visibility="@{isStored && !isReadOnly ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{isStored && !isReadOnly && !isNative ? View.VISIBLE : View.GONE}"
|
||||
android:background="@drawable/menu_item_background"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:drawableStart="@drawable/trash_simple"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue