Added settings to hide contacts list selectors
This commit is contained in:
parent
df4d136305
commit
1767ae559b
3 changed files with 31 additions and 2 deletions
|
@ -42,6 +42,10 @@ class ContactsListViewModel : ViewModel() {
|
||||||
|
|
||||||
val readOnlyNativeAddressBook = MutableLiveData<Boolean>()
|
val readOnlyNativeAddressBook = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val hideSipContactsList = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val onlyShowSipContactsList = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val fetchInProgress = MutableLiveData<Boolean>()
|
val fetchInProgress = MutableLiveData<Boolean>()
|
||||||
private var searchResultsPending: Boolean = false
|
private var searchResultsPending: Boolean = false
|
||||||
private var fastFetchJob: Job? = null
|
private var fastFetchJob: Job? = null
|
||||||
|
@ -79,6 +83,15 @@ class ContactsListViewModel : ViewModel() {
|
||||||
nativeAddressBookEnabled.value = corePreferences.enableNativeAddressBookIntegration
|
nativeAddressBookEnabled.value = corePreferences.enableNativeAddressBookIntegration
|
||||||
readOnlyNativeAddressBook.value = corePreferences.readOnlyNativeContacts
|
readOnlyNativeAddressBook.value = corePreferences.readOnlyNativeContacts
|
||||||
|
|
||||||
|
onlyShowSipContactsList.value = corePreferences.onlyShowSipContactsList
|
||||||
|
hideSipContactsList.value = corePreferences.hideSipContactsList
|
||||||
|
if (onlyShowSipContactsList.value == true) {
|
||||||
|
sipContactsSelected.value = true
|
||||||
|
}
|
||||||
|
if (hideSipContactsList.value == true) {
|
||||||
|
sipContactsSelected.value = false
|
||||||
|
}
|
||||||
|
|
||||||
coreContext.contactsManager.addListener(contactsUpdatedListener)
|
coreContext.contactsManager.addListener(contactsUpdatedListener)
|
||||||
coreContext.contactsManager.magicSearch.addListener(magicSearchListener)
|
coreContext.contactsManager.magicSearch.addListener(magicSearchListener)
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,6 +475,14 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
val readOnlyNativeContacts: Boolean
|
val readOnlyNativeContacts: Boolean
|
||||||
get() = config.getBool("app", "read_only_native_address_book", false)
|
get() = config.getBool("app", "read_only_native_address_book", false)
|
||||||
|
|
||||||
|
// Will hide the contacts selector to allow listing all contacts, even those without a SIP address
|
||||||
|
val onlyShowSipContactsList: Boolean
|
||||||
|
get() = config.getBool("app", "only_show_sip_contacts_list", false)
|
||||||
|
|
||||||
|
// Will hide the SIP contacts selector, leaving only the all contacts list
|
||||||
|
val hideSipContactsList: Boolean
|
||||||
|
get() = config.getBool("app", "hide_sip_contacts_list", false)
|
||||||
|
|
||||||
// Will disable chat feature completely
|
// Will disable chat feature completely
|
||||||
val disableChat: Boolean
|
val disableChat: Boolean
|
||||||
get() = config.getBool("app", "disable_chat_feature", false)
|
get() = config.getBool("app", "disable_chat_feature", false)
|
||||||
|
|
|
@ -43,7 +43,8 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.2">
|
android:layout_weight="0.2"
|
||||||
|
android:visibility="@{viewModel.onlyShowSipContactsList ? View.GONE : View.VISIBLE}">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:onClick="@{allContactsToggleClickListener}"
|
android:onClick="@{allContactsToggleClickListener}"
|
||||||
|
@ -67,7 +68,8 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.2">
|
android:layout_weight="0.2"
|
||||||
|
android:visibility="@{viewModel.hideSipContactsList ? View.GONE : View.VISIBLE}">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:onClick="@{sipContactsToggleClickListener}"
|
android:onClick="@{sipContactsToggleClickListener}"
|
||||||
|
@ -89,6 +91,12 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.2"
|
||||||
|
android:visibility="@{viewModel.onlyShowSipContactsList || viewModel.hideSipContactsList ? View.VISIBLE : View.GONE}" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue