mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed CardDAV settings when it's read only
This commit is contained in:
parent
c4618702ab
commit
899129d4bc
4 changed files with 28 additions and 0 deletions
|
|
@ -58,6 +58,8 @@ class CardDavViewModel
|
|||
|
||||
val storeNewContactsInIt = MutableLiveData<Boolean>()
|
||||
|
||||
val isReadOnly = MutableLiveData<Boolean>()
|
||||
|
||||
val syncSuccessfulEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
|
@ -88,12 +90,14 @@ class CardDavViewModel
|
|||
val previous = corePreferences.friendListInWhichStoreNewlyCreatedFriends
|
||||
if (friendList.isReadOnly) {
|
||||
Log.w("$TAG User asked to add newly created contacts in this friend list but it is read only, keep currently default friend list [$previous]")
|
||||
storeNewContactsInIt.postValue(false)
|
||||
} else {
|
||||
Log.i(
|
||||
"$TAG Updating default friend list to store newly created contacts from [$previous] to [$name]"
|
||||
)
|
||||
corePreferences.friendListInWhichStoreNewlyCreatedFriends = name
|
||||
}
|
||||
isReadOnly.postValue(friendList.isReadOnly)
|
||||
}
|
||||
|
||||
Log.i("$TAG Notifying contacts manager that contacts have changed")
|
||||
|
|
@ -142,6 +146,7 @@ class CardDavViewModel
|
|||
isEdit.postValue(true)
|
||||
friendList = found
|
||||
friendList.addListener(friendListListener)
|
||||
isReadOnly.postValue(friendList.isReadOnly)
|
||||
|
||||
displayName.postValue(name)
|
||||
storeNewContactsInIt.postValue(
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@
|
|||
android:text="@string/settings_contacts_carddav_use_as_default_title"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:visibility="@{viewModel.isReadOnly ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintTop_toTopOf="@id/save_new_contacts_in_this_list_switch"
|
||||
app:layout_constraintBottom_toBottomOf="@id/save_new_contacts_in_this_list_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -274,9 +275,29 @@
|
|||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:checked="@={viewModel.storeNewContactsInIt}"
|
||||
android:visibility="@{viewModel.isReadOnly ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/realm" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:id="@+id/carddav_read_only"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/settings_contacts_carddav_read_only_label"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:drawableStart="@drawable/warning_circle"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableTint="?attr/color_main2_700"
|
||||
android:visibility="@{viewModel.isReadOnly ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toBottomOf="@id/save_new_contacts_in_this_list_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@
|
|||
<string name="settings_contacts_carddav_sync_error_toast">Erreur de synchronization !</string>
|
||||
<string name="settings_contacts_carddav_deleted_toast">Compte CardDAV supprimé</string>
|
||||
<string name="settings_contacts_carddav_mandatory_field_not_filled_toast">Veuillez remplir au moins le nom d\'affichage et l\'URL du serveur</string>
|
||||
<string name="settings_contacts_carddav_read_only_label">Ce carnet d\'adresses est en lecture seule</string>
|
||||
<string name="settings_contacts_ldap_enabled_title">Activé</string>
|
||||
<string name="settings_contacts_ldap_server_url_title">URL du serveur (ne peut être vide)</string>
|
||||
<string name="settings_contacts_ldap_bind_dn_title">Bind DN</string>
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@
|
|||
<string name="settings_contacts_carddav_sync_error_toast">Synchronization error!</string>
|
||||
<string name="settings_contacts_carddav_deleted_toast">CardDAV account removed</string>
|
||||
<string name="settings_contacts_carddav_mandatory_field_not_filled_toast">Please fill at least the display name and the server URL</string>
|
||||
<string name="settings_contacts_carddav_read_only_label">This address-book is read-only</string>
|
||||
<string name="settings_contacts_ldap_enabled_title">Enabled</string>
|
||||
<string name="settings_contacts_ldap_server_url_title">Server URL (can\'t be empty)</string>
|
||||
<string name="settings_contacts_ldap_bind_dn_title">Bind DN</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue