mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Added a setting to edit native contacts in-app
This commit is contained in:
parent
844b182df2
commit
a7593e07fc
9 changed files with 55 additions and 4 deletions
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="21" />
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -1,6 +1,6 @@
|
|||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ Group changes to describe their impact on the project, as follows:
|
|||
- one for user to choose whether to sort contacts by first name or last name
|
||||
- one to hide contacts that have neither a SIP address nor a phone number
|
||||
- one to let app auto-answer call with video sending already enabled
|
||||
- one to let edit native contacts Linphone copy in-app instead of opening native addressbook third party app
|
||||
- Added a vu meter for recording & playback volumes (must be enabled in developer settings)
|
||||
- Added support for HDMI audio devices
|
||||
|
||||
|
|
|
|||
|
|
@ -264,6 +264,13 @@ class CorePreferences
|
|||
config.setString("app", "friend_list_to_store_newly_created_contacts", value)
|
||||
}
|
||||
|
||||
@get:AnyThread @set:WorkerThread
|
||||
var editNativeContactsInLinphone: Boolean
|
||||
get() = config.getBool("ui", "edit_native_contact_in_linphone", false)
|
||||
set(value) {
|
||||
config.setBool("ui", "edit_native_contact_in_linphone", value)
|
||||
}
|
||||
|
||||
@get:AnyThread @set:WorkerThread
|
||||
var disableAddContact: Boolean
|
||||
get() = config.getBool("ui", "disable_add_contact", false)
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ class ContactViewModel
|
|||
coreContext.postOnCoreThread {
|
||||
if (::friend.isInitialized) {
|
||||
val uri = friend.nativeUri
|
||||
if (uri != null) {
|
||||
if (uri != null && !corePreferences.editNativeContactsInLinphone) {
|
||||
Log.i(
|
||||
"$TAG Contact [${friend.name}] is a native contact, opening native contact editor using URI [$uri]"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ class SettingsViewModel
|
|||
AppUtils.getString(R.string.contact_editor_last_name),
|
||||
)
|
||||
val sortContactsByValues = arrayListOf(0, 1)
|
||||
|
||||
val editNativeContactsInLinphone = MutableLiveData<Boolean>()
|
||||
val hideEmptyContacts = MutableLiveData<Boolean>()
|
||||
|
||||
val ldapAvailable = MutableLiveData<Boolean>()
|
||||
|
|
@ -343,6 +345,7 @@ class SettingsViewModel
|
|||
)
|
||||
|
||||
sortContactsBy.postValue(if (corePreferences.sortContactsByFirstName) 0 else 1)
|
||||
editNativeContactsInLinphone.postValue(corePreferences.editNativeContactsInLinphone)
|
||||
hideEmptyContacts.postValue(corePreferences.hideContactsWithoutPhoneNumberOrSipAddress)
|
||||
presenceSubscribe.postValue(core.isFriendListSubscriptionEnabled)
|
||||
|
||||
|
|
@ -585,6 +588,15 @@ class SettingsViewModel
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleEditNativeContactsInLinphone() {
|
||||
val newValue = editNativeContactsInLinphone.value == false
|
||||
coreContext.postOnCoreThread {
|
||||
corePreferences.editNativeContactsInLinphone = newValue
|
||||
editNativeContactsInLinphone.postValue(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleHideEmptyContacts() {
|
||||
val newValue = hideEmptyContacts.value == false
|
||||
|
|
|
|||
|
|
@ -78,6 +78,35 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/hide_empty_contacts_switch"/>
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/material_switch_style"
|
||||
android:id="@+id/edit_native_contacts_in_linphone_switch"
|
||||
android:onClick="@{() -> viewModel.toggleEditNativeContactsInLinphone()}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:checked="@{viewModel.editNativeContactsInLinphone}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/sort_contacts_by_first_name_spinner" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleEditNativeContactsInLinphone()}"
|
||||
android:id="@+id/edit_native_contacts_in_linphone_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/settings_contacts_edit_native_contacts_in_linphone_title"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:labelFor="@id/edit_native_contacts_in_linphone_switch"
|
||||
app:layout_constraintTop_toTopOf="@id/edit_native_contacts_in_linphone_switch"
|
||||
app:layout_constraintBottom_toBottomOf="@id/edit_native_contacts_in_linphone_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/edit_native_contacts_in_linphone_switch"/>
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/material_switch_style"
|
||||
android:id="@+id/hide_empty_contacts_switch"
|
||||
|
|
@ -88,7 +117,7 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:checked="@{viewModel.hideEmptyContacts}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/sort_contacts_by_first_name_spinner" />
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_native_contacts_in_linphone_switch" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@
|
|||
<string name="settings_conversations_mark_as_read_when_dismissing_notif_title">Marquer la conversation comme lue lorsqu\'une notification de message est supprimée</string>
|
||||
<string name="settings_contacts_title">Contacts</string>
|
||||
<string name="settings_contacts_sort_by_first_name_title">Trier les contacts par</string>
|
||||
<string name="settings_contacts_edit_native_contacts_in_linphone_title">Editer les contacts natifs dans &appName;</string>
|
||||
<string name="settings_contacts_hide_empty_contacts_title">Masquer les contacts sans adresse SIP ni numéro de téléphone</string>
|
||||
<string name="settings_contacts_presence_subscribe_title">Souscrire aux informations de présence</string>
|
||||
<string name="settings_contacts_add_ldap_server_title">Ajouter un serveur LDAP</string>
|
||||
|
|
|
|||
|
|
@ -268,6 +268,7 @@
|
|||
<string name="settings_conversations_mark_as_read_when_dismissing_notif_title">Mark conversation as read when dismissing message notification</string>
|
||||
<string name="settings_contacts_title">Contacts</string>
|
||||
<string name="settings_contacts_sort_by_first_name_title">Sort contacts by</string>
|
||||
<string name="settings_contacts_edit_native_contacts_in_linphone_title">Use &appName; contact editor for native contacts</string>
|
||||
<string name="settings_contacts_hide_empty_contacts_title">Hide contacts without SIP address nor phone number</string>
|
||||
<string name="settings_contacts_presence_subscribe_title">Subscribe to presence info</string>
|
||||
<string name="settings_contacts_add_ldap_server_title">Add LDAP server</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue