do not show contact phone numbers on the main screen by default

This commit is contained in:
tibbi
2017-12-30 10:52:00 +01:00
parent b42e3bb695
commit 88b624bbc5
18 changed files with 137 additions and 13 deletions

View File

@ -24,6 +24,10 @@ class Config(context: Context) : BaseConfig(context) {
fun showAllContacts() = displayContactSources.size == 1 && displayContactSources.first() == "-1"
var showPhoneNumbers: Boolean
get() = prefs.getBoolean(SHOW_PHONE_NUMBERS, false)
set(showPhoneNumbers) = prefs.edit().putBoolean(SHOW_PHONE_NUMBERS, showPhoneNumbers).apply()
var startNameWithSurname: Boolean
get() = prefs.getBoolean(START_NAME_WITH_SURNAME, false)
set(startNameWithSurname) = prefs.edit().putBoolean(START_NAME_WITH_SURNAME, startNameWithSurname).apply()

View File

@ -2,6 +2,7 @@ package com.simplemobiletools.contacts.helpers
// shared prefs
val CALL_CONTACT_ON_CLICK = "call_contact_on_click"
val SHOW_PHONE_NUMBERS = "show_phone_numbers"
val DISPLAY_CONTACT_SOURCES = "display_contact_sources"
val START_NAME_WITH_SURNAME = "start_name_with_surname"
val LAST_USED_CONTACT_SOURCE = "last_used_contact_source"

View File

@ -71,11 +71,13 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
cursor?.close()
}
val phoneNumbers = getPhoneNumbers()
val size = phoneNumbers.size()
for (i in 0 until size) {
val key = phoneNumbers.keyAt(i)
contacts[key]?.phoneNumbers = phoneNumbers.valueAt(i)
if (activity.config.showPhoneNumbers) {
val phoneNumbers = getPhoneNumbers()
val size = phoneNumbers.size()
for (i in 0 until size) {
val key = phoneNumbers.keyAt(i)
contacts[key]?.phoneNumbers = phoneNumbers.valueAt(i)
}
}
val contactsSize = contacts.size()