mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-02-14 10:30:46 +01:00
Merge pull request #590 from ismailnurudeen/fix/contacts-without-num
fix: prevent showing of contacts without phone numbers.
This commit is contained in:
commit
08d09bc18a
@ -140,9 +140,8 @@ class DialpadActivity : SimpleActivity() {
|
||||
dialpad_input.requestFocus()
|
||||
dialpad_input.disableKeyboard()
|
||||
|
||||
ContactsHelper(this).getContacts { allContacts ->
|
||||
val contactsWithNumber = allContacts.filter { it.phoneNumbers.isNotEmpty() }.toMutableList() as ArrayList<Contact>
|
||||
gotContacts(contactsWithNumber)
|
||||
ContactsHelper(this).getContacts(showOnlyContactsWithNumbers = true) { allContacts ->
|
||||
gotContacts(allContacts)
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ class ManageSpeedDialActivity : SimpleActivity(), RemoveSpeedDialListener {
|
||||
|
||||
speedDialValues = config.getSpeedDialValues()
|
||||
updateAdapter()
|
||||
ContactsHelper(this).getContacts(false) { contacts ->
|
||||
ContactsHelper(this).getContacts(showOnlyContactsWithNumbers = true) { contacts ->
|
||||
allContacts = contacts
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class FilterContactSourcesDialog(val activity: SimpleActivity, private val callb
|
||||
processDataIfReady()
|
||||
}
|
||||
|
||||
contactHelper.getContacts(getAll = true) {
|
||||
contactHelper.getContacts(getAll = true, showOnlyContactsWithNumbers = true) {
|
||||
it.mapTo(contacts) { contact -> contact.copy() }
|
||||
val privateCursor = activity.getMyContactsCursor(false, true)
|
||||
val privateContacts = MyContactsContentProvider.getContacts(activity, privateCursor)
|
||||
|
@ -62,7 +62,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
|
||||
override fun refreshItems(callback: (() -> Unit)?) {
|
||||
val privateCursor = context?.getMyContactsCursor(false, true)
|
||||
ContactsHelper(context).getContacts { contacts ->
|
||||
ContactsHelper(context).getContacts(showOnlyContactsWithNumbers = true) { contacts ->
|
||||
allContacts = contacts
|
||||
|
||||
if (SMT_PRIVATE !in context.baseConfig.ignoredContactSources) {
|
||||
@ -159,7 +159,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
if (it) {
|
||||
fragment_placeholder.text = context.getString(R.string.no_contacts_found)
|
||||
fragment_placeholder_2.text = context.getString(R.string.create_new_contact)
|
||||
ContactsHelper(context).getContacts(false) { contacts ->
|
||||
ContactsHelper(context).getContacts(showOnlyContactsWithNumbers = true) { contacts ->
|
||||
activity?.runOnUiThread {
|
||||
gotContacts(contacts)
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
}
|
||||
|
||||
override fun refreshItems(callback: (() -> Unit)?) {
|
||||
ContactsHelper(context).getContacts { contacts ->
|
||||
ContactsHelper(context).getContacts(showOnlyContactsWithNumbers = true) { contacts ->
|
||||
allContacts = contacts
|
||||
|
||||
if (SMT_PRIVATE !in context.baseConfig.ignoredContactSources) {
|
||||
|
@ -50,7 +50,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
val privateCursor = context?.getMyContactsCursor(false, true)
|
||||
val groupSubsequentCalls = context?.config?.groupSubsequentCalls ?: false
|
||||
RecentsHelper(context).getRecentCalls(groupSubsequentCalls) { recents ->
|
||||
ContactsHelper(context).getContacts { contacts ->
|
||||
ContactsHelper(context).getContacts(showOnlyContactsWithNumbers = true) { contacts ->
|
||||
val privateContacts = MyContactsContentProvider.getContacts(context, privateCursor)
|
||||
|
||||
recents.filter { it.phoneNumber == it.name }.forEach { recent ->
|
||||
|
@ -35,7 +35,7 @@ fun getCallContact(context: Context, call: Call?, callback: (CallContact) -> Uni
|
||||
val uri = Uri.decode(handle)
|
||||
if (uri.startsWith("tel:")) {
|
||||
val number = uri.substringAfter("tel:")
|
||||
ContactsHelper(context).getContacts{ contacts ->
|
||||
ContactsHelper(context).getContacts(showOnlyContactsWithNumbers = true) { contacts ->
|
||||
val privateContacts = MyContactsContentProvider.getContacts(context, privateCursor)
|
||||
if (privateContacts.isNotEmpty()) {
|
||||
contacts.addAll(privateContacts)
|
||||
|
@ -24,7 +24,7 @@ class RecentsHelper(private val context: Context) {
|
||||
return@ensureBackgroundThread
|
||||
}
|
||||
|
||||
ContactsHelper(context).getContacts(false) { contacts ->
|
||||
ContactsHelper(context).getContacts(showOnlyContactsWithNumbers = true) { contacts ->
|
||||
val privateContacts = MyContactsContentProvider.getContacts(context, privateCursor)
|
||||
if (privateContacts.isNotEmpty()) {
|
||||
contacts.addAll(privateContacts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user