at the speed dial picker show only contacts with phone numbers
This commit is contained in:
parent
cfc97d9453
commit
21029ac119
|
@ -70,7 +70,7 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh
|
|||
}
|
||||
|
||||
private fun fabClicked() {
|
||||
SelectContactsDialog(this, allContacts, true, groupContacts) { addedContacts, removedContacts ->
|
||||
SelectContactsDialog(this, allContacts, true, false, groupContacts) { addedContacts, removedContacts ->
|
||||
ensureBackgroundThread {
|
||||
addContactsToGroup(addedContacts, 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 kotlinx.android.synthetic.main.layout_select_contact.view.*
|
||||
|
||||
class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayList<Contact>, val allowSelectMultiple: Boolean, selectContacts: ArrayList<Contact>? = null,
|
||||
val callback: (addedContacts: ArrayList<Contact>, removedContacts: ArrayList<Contact>) -> Unit) {
|
||||
class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayList<Contact>, val allowSelectMultiple: Boolean, val showOnlyContactsWithNumber: Boolean,
|
||||
selectContacts: ArrayList<Contact>? = null, val callback: (addedContacts: ArrayList<Contact>, removedContacts: ArrayList<Contact>) -> Unit) {
|
||||
private var dialog: AlertDialog? = null
|
||||
private var view = activity.layoutInflater.inflate(R.layout.layout_select_contact, null)
|
||||
private var initiallySelectedContacts = ArrayList<Contact>()
|
||||
|
@ -23,6 +23,10 @@ class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayL
|
|||
val contactSources = activity.getVisibleContactSources()
|
||||
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>
|
||||
} else {
|
||||
initiallySelectedContacts = selectContacts
|
||||
|
|
|
@ -19,7 +19,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
|||
}
|
||||
|
||||
private fun showAddFavoritesDialog() {
|
||||
SelectContactsDialog(activity!!, allContacts, true) { addedContacts, removedContacts ->
|
||||
SelectContactsDialog(activity!!, allContacts, true, false) { addedContacts, removedContacts ->
|
||||
ContactsHelper(activity as SimpleActivity).apply {
|
||||
addFavorites(addedContacts)
|
||||
removeFavorites(removedContacts)
|
||||
|
|
Loading…
Reference in New Issue