mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-20 05:20:56 +01:00
add secret phone storage account at group destination too
This commit is contained in:
parent
79d9e2045b
commit
5076c11a21
@ -12,6 +12,7 @@ import com.simplemobiletools.commons.models.RadioItem
|
|||||||
import com.simplemobiletools.contacts.R
|
import com.simplemobiletools.contacts.R
|
||||||
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 com.simplemobiletools.contacts.models.Group
|
import com.simplemobiletools.contacts.models.Group
|
||||||
import kotlinx.android.synthetic.main.dialog_create_new_group.view.*
|
import kotlinx.android.synthetic.main.dialog_create_new_group.view.*
|
||||||
@ -40,6 +41,7 @@ class CreateNewGroupDialog(val activity: BaseSimpleActivity, val callback: (newG
|
|||||||
|
|
||||||
ContactsHelper(activity).getContactSources {
|
ContactsHelper(activity).getContactSources {
|
||||||
it.filter { it.type.contains("google", true) }.mapTo(contactSources, { ContactSource(it.name, it.type) })
|
it.filter { it.type.contains("google", true) }.mapTo(contactSources, { ContactSource(it.name, it.type) })
|
||||||
|
contactSources.add(ContactSource(activity.getString(R.string.phone_storage_hidden), SMT_PRIVATE))
|
||||||
|
|
||||||
val items = ArrayList<RadioItem>()
|
val items = ArrayList<RadioItem>()
|
||||||
contactSources.forEachIndexed { index, contactSource ->
|
contactSources.forEachIndexed { index, contactSource ->
|
||||||
|
@ -394,6 +394,10 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun createNewGroup(title: String, accountName: String, accountType: String): Group? {
|
fun createNewGroup(title: String, accountName: String, accountType: String): Group? {
|
||||||
|
if (accountType == SMT_PRIVATE) {
|
||||||
|
return activity.dbHelper.createGroup(title)
|
||||||
|
}
|
||||||
|
|
||||||
val operations = ArrayList<ContentProviderOperation>()
|
val operations = ArrayList<ContentProviderOperation>()
|
||||||
ContentProviderOperation.newInsert(ContactsContract.Groups.CONTENT_URI).apply {
|
ContentProviderOperation.newInsert(ContactsContract.Groups.CONTENT_URI).apply {
|
||||||
withValue(ContactsContract.Groups.TITLE, title)
|
withValue(ContactsContract.Groups.TITLE, title)
|
||||||
|
@ -126,6 +126,10 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
mDb.update(CONTACTS_TABLE_NAME, contactValues, selection, null)
|
mDb.update(CONTACTS_TABLE_NAME, contactValues, selection, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createGroup(name: String): Group? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
fun getContacts(selection: String? = null, selectionArgs: Array<String>? = null): ArrayList<Contact> {
|
fun getContacts(selection: String? = null, selectionArgs: Array<String>? = null): ArrayList<Contact> {
|
||||||
val contacts = ArrayList<Contact>()
|
val contacts = ArrayList<Contact>()
|
||||||
val projection = arrayOf(COL_ID, COL_FIRST_NAME, COL_MIDDLE_NAME, COL_SURNAME, COL_PHONE_NUMBERS, COL_EMAILS, COL_EVENTS, COL_STARRED,
|
val projection = arrayOf(COL_ID, COL_FIRST_NAME, COL_MIDDLE_NAME, COL_SURNAME, COL_PHONE_NUMBERS, COL_EMAILS, COL_EVENTS, COL_STARRED,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user