mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
at the speed dial picker show only contacts with phone numbers
This commit is contained in:
@ -70,7 +70,7 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun fabClicked() {
|
private fun fabClicked() {
|
||||||
SelectContactsDialog(this, allContacts, true, groupContacts) { addedContacts, removedContacts ->
|
SelectContactsDialog(this, allContacts, true, false, groupContacts) { addedContacts, removedContacts ->
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
addContactsToGroup(addedContacts, group.id!!)
|
addContactsToGroup(addedContacts, group.id!!)
|
||||||
removeContactsFromGroup(removedContacts, group.id!!)
|
removeContactsFromGroup(removedContacts, group.id!!)
|
||||||
|
@ -11,8 +11,8 @@ import com.simplemobiletools.contacts.pro.extensions.getVisibleContactSources
|
|||||||
import com.simplemobiletools.contacts.pro.models.Contact
|
import com.simplemobiletools.contacts.pro.models.Contact
|
||||||
import kotlinx.android.synthetic.main.layout_select_contact.view.*
|
import kotlinx.android.synthetic.main.layout_select_contact.view.*
|
||||||
|
|
||||||
class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayList<Contact>, val allowSelectMultiple: Boolean, selectContacts: ArrayList<Contact>? = null,
|
class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayList<Contact>, val allowSelectMultiple: Boolean, val showOnlyContactsWithNumber: Boolean,
|
||||||
val callback: (addedContacts: ArrayList<Contact>, removedContacts: ArrayList<Contact>) -> Unit) {
|
selectContacts: ArrayList<Contact>? = null, val callback: (addedContacts: ArrayList<Contact>, removedContacts: ArrayList<Contact>) -> Unit) {
|
||||||
private var dialog: AlertDialog? = null
|
private var dialog: AlertDialog? = null
|
||||||
private var view = activity.layoutInflater.inflate(R.layout.layout_select_contact, null)
|
private var view = activity.layoutInflater.inflate(R.layout.layout_select_contact, null)
|
||||||
private var initiallySelectedContacts = ArrayList<Contact>()
|
private var initiallySelectedContacts = ArrayList<Contact>()
|
||||||
@ -23,6 +23,10 @@ class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayL
|
|||||||
val contactSources = activity.getVisibleContactSources()
|
val contactSources = activity.getVisibleContactSources()
|
||||||
allContacts = allContacts.filter { contactSources.contains(it.source) } as ArrayList<Contact>
|
allContacts = allContacts.filter { contactSources.contains(it.source) } as ArrayList<Contact>
|
||||||
|
|
||||||
|
if (showOnlyContactsWithNumber) {
|
||||||
|
allContacts = allContacts.filter { it.phoneNumbers.isNotEmpty() }.toMutableList() as ArrayList<Contact>
|
||||||
|
}
|
||||||
|
|
||||||
initiallySelectedContacts = allContacts.filter { it.starred == 1 } as ArrayList<Contact>
|
initiallySelectedContacts = allContacts.filter { it.starred == 1 } as ArrayList<Contact>
|
||||||
} else {
|
} else {
|
||||||
initiallySelectedContacts = selectContacts
|
initiallySelectedContacts = selectContacts
|
||||||
|
@ -19,7 +19,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun showAddFavoritesDialog() {
|
private fun showAddFavoritesDialog() {
|
||||||
SelectContactsDialog(activity!!, allContacts, true) { addedContacts, removedContacts ->
|
SelectContactsDialog(activity!!, allContacts, true, false) { addedContacts, removedContacts ->
|
||||||
ContactsHelper(activity as SimpleActivity).apply {
|
ContactsHelper(activity as SimpleActivity).apply {
|
||||||
addFavorites(addedContacts)
|
addFavorites(addedContacts)
|
||||||
removeFavorites(removedContacts)
|
removeFavorites(removedContacts)
|
||||||
|
Reference in New Issue
Block a user