allow batch adding contacts to groups
This commit is contained in:
parent
7a914181de
commit
5ee383af74
|
@ -11,9 +11,11 @@ import com.bumptech.glide.request.RequestOptions
|
|||
import com.bumptech.glide.signature.ObjectKey
|
||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
||||
import com.simplemobiletools.commons.extensions.isActivityDestroyed
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.views.FastScroller
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import com.simplemobiletools.contacts.R
|
||||
|
@ -183,6 +185,23 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
|||
selectedPositions.forEach {
|
||||
selectedContacts.add(contactItems[it])
|
||||
}
|
||||
|
||||
val NEW_GROUP_ID = -1
|
||||
val items = ArrayList<RadioItem>()
|
||||
ContactsHelper(activity).getStoredGroups().forEach {
|
||||
items.add(RadioItem(it.id.toInt(), it.title))
|
||||
}
|
||||
items.add(RadioItem(NEW_GROUP_ID, activity.getString(R.string.create_new_group)))
|
||||
|
||||
RadioGroupDialog(activity, items, 0) {
|
||||
if (it as Int == NEW_GROUP_ID) {
|
||||
|
||||
} else {
|
||||
ContactsHelper(activity).addContactsToGroup(selectedContacts, it.toLong())
|
||||
refreshListener?.refreshContacts(GROUPS_TAB_MASK)
|
||||
finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun shareContacts() {
|
||||
|
|
Loading…
Reference in New Issue