show local contacts in the lists
This commit is contained in:
parent
eb4833ff1e
commit
6c39757cec
|
@ -105,8 +105,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||||
if (storedPrimaryColor != configPrimaryColor) {
|
if (storedPrimaryColor != configPrimaryColor) {
|
||||||
main_tabs_holder.setSelectedTabIndicatorColor(getAdjustedPrimaryColor())
|
main_tabs_holder.setSelectedTabIndicatorColor(getAdjustedPrimaryColor())
|
||||||
main_tabs_holder.getTabAt(viewpager.currentItem)?.icon?.applyColorFilter(getAdjustedPrimaryColor())
|
main_tabs_holder.getTabAt(viewpager.currentItem)?.icon?.applyColorFilter(getAdjustedPrimaryColor())
|
||||||
contacts_fragment.primaryColorChanged(configPrimaryColor)
|
contacts_fragment.primaryColorChanged()
|
||||||
favorites_fragment.primaryColorChanged(configPrimaryColor)
|
favorites_fragment.primaryColorChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
val configStartNameWithSurname = config.startNameWithSurname
|
val configStartNameWithSurname = config.startNameWithSurname
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.simplemobiletools.commons.interfaces.MyAdapterListener
|
||||||
import com.simplemobiletools.contacts.R
|
import com.simplemobiletools.contacts.R
|
||||||
import com.simplemobiletools.contacts.activities.SimpleActivity
|
import com.simplemobiletools.contacts.activities.SimpleActivity
|
||||||
import com.simplemobiletools.contacts.extensions.config
|
import com.simplemobiletools.contacts.extensions.config
|
||||||
|
import com.simplemobiletools.contacts.helpers.SMT_PRIVATE
|
||||||
import com.simplemobiletools.contacts.models.ContactSource
|
import com.simplemobiletools.contacts.models.ContactSource
|
||||||
import kotlinx.android.synthetic.main.item_filter_contact_source.view.*
|
import kotlinx.android.synthetic.main.item_filter_contact_source.view.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -27,6 +28,10 @@ class FilterContactSourcesAdapter(val activity: SimpleActivity, private val cont
|
||||||
if (contactSource.name == activity.config.localAccountName && contactSource.type == activity.config.localAccountType) {
|
if (contactSource.name == activity.config.localAccountName && contactSource.type == activity.config.localAccountType) {
|
||||||
contactSource.name = activity.getString(R.string.phone_storage)
|
contactSource.name = activity.getString(R.string.phone_storage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (contactSource.type == SMT_PRIVATE && displayContactSources.contains(SMT_PRIVATE)) {
|
||||||
|
selectedPositions.add(index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.simplemobiletools.contacts.activities.SimpleActivity
|
||||||
import com.simplemobiletools.contacts.adapters.FilterContactSourcesAdapter
|
import com.simplemobiletools.contacts.adapters.FilterContactSourcesAdapter
|
||||||
import com.simplemobiletools.contacts.extensions.config
|
import com.simplemobiletools.contacts.extensions.config
|
||||||
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
||||||
|
import com.simplemobiletools.contacts.helpers.SMT_PRIVATE
|
||||||
import com.simplemobiletools.contacts.models.ContactSource
|
import com.simplemobiletools.contacts.models.ContactSource
|
||||||
import kotlinx.android.synthetic.main.dialog_filter_contact_sources.view.*
|
import kotlinx.android.synthetic.main.dialog_filter_contact_sources.view.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -41,7 +42,7 @@ class FilterContactSourcesDialog(val activity: SimpleActivity, private val callb
|
||||||
val selectedIndexes = (view.filter_contact_sources_list.adapter as FilterContactSourcesAdapter).getSelectedItemsSet()
|
val selectedIndexes = (view.filter_contact_sources_list.adapter as FilterContactSourcesAdapter).getSelectedItemsSet()
|
||||||
val selectedContactSources = HashSet<String>()
|
val selectedContactSources = HashSet<String>()
|
||||||
selectedIndexes.forEach {
|
selectedIndexes.forEach {
|
||||||
selectedContactSources.add(contactSources[it].name)
|
selectedContactSources.add(if (contactSources[it].type == SMT_PRIVATE) SMT_PRIVATE else contactSources[it].name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activity.config.displayContactSources != selectedContactSources) {
|
if (activity.config.displayContactSources != selectedContactSources) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.simplemobiletools.contacts.BuildConfig
|
||||||
import com.simplemobiletools.contacts.R
|
import com.simplemobiletools.contacts.R
|
||||||
import com.simplemobiletools.contacts.activities.SimpleActivity
|
import com.simplemobiletools.contacts.activities.SimpleActivity
|
||||||
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
||||||
|
import com.simplemobiletools.contacts.helpers.SMT_PRIVATE
|
||||||
import com.simplemobiletools.contacts.helpers.VcfExporter
|
import com.simplemobiletools.contacts.helpers.VcfExporter
|
||||||
import com.simplemobiletools.contacts.models.Contact
|
import com.simplemobiletools.contacts.models.Contact
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -62,6 +63,8 @@ fun SimpleActivity.showContactSourcePicker(currentSource: String, callback: (new
|
||||||
items.add(RadioItem(index, publicAccount))
|
items.add(RadioItem(index, publicAccount))
|
||||||
if (account == currentSource) {
|
if (account == currentSource) {
|
||||||
currentSourceIndex = index
|
currentSourceIndex = index
|
||||||
|
} else if (currentSource == SMT_PRIVATE && account == getString(R.string.phone_storage_hidden)) {
|
||||||
|
currentSourceIndex = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +76,13 @@ fun SimpleActivity.showContactSourcePicker(currentSource: String, callback: (new
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun SimpleActivity.getPublicContactSource(source: String) = if (source == config.localAccountName) getString(R.string.phone_storage) else source
|
fun SimpleActivity.getPublicContactSource(source: String): String {
|
||||||
|
return when (source) {
|
||||||
|
config.localAccountName -> getString(R.string.phone_storage)
|
||||||
|
SMT_PRIVATE -> getString(R.string.phone_storage_hidden)
|
||||||
|
else -> source
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun BaseSimpleActivity.shareContacts(contacts: ArrayList<Contact>) {
|
fun BaseSimpleActivity.shareContacts(contacts: ArrayList<Contact>) {
|
||||||
val file = getTempFile()
|
val file = getTempFile()
|
||||||
|
|
|
@ -59,7 +59,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun primaryColorChanged(color: Int) {
|
fun primaryColorChanged() {
|
||||||
fragment_fastscroller.updatePrimaryColor()
|
fragment_fastscroller.updatePrimaryColor()
|
||||||
fragment_fastscroller.updateBubblePrimaryColor()
|
fragment_fastscroller.updateBubblePrimaryColor()
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,10 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
||||||
contacts[key]?.emails = emails.valueAt(i)
|
contacts[key]?.emails = emails.valueAt(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activity.dbHelper.getContacts().forEach {
|
||||||
|
contacts.put(it.id, it)
|
||||||
|
}
|
||||||
|
|
||||||
val contactsSize = contacts.size()
|
val contactsSize = contacts.size()
|
||||||
var resultContacts = ArrayList<Contact>(contactsSize)
|
var resultContacts = ArrayList<Contact>(contactsSize)
|
||||||
(0 until contactsSize).mapTo(resultContacts) { contacts.valueAt(it) }
|
(0 until contactsSize).mapTo(resultContacts) { contacts.valueAt(it) }
|
||||||
|
|
Loading…
Reference in New Issue