mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
store the local account type in shared prefs
This commit is contained in:
@ -51,6 +51,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
setContentView(R.layout.activity_main)
|
||||
appLaunched()
|
||||
setupTabColors()
|
||||
storeLocalAccountType()
|
||||
|
||||
handlePermission(PERMISSION_READ_CONTACTS) {
|
||||
if (it) {
|
||||
@ -214,6 +215,30 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun storeLocalAccountType() {
|
||||
if (config.localAccountType == "-1") {
|
||||
// some manufacturer contact account types from https://stackoverflow.com/a/44802016/1967672
|
||||
val localAccountTypes = arrayListOf("vnd.sec.contact.phone",
|
||||
"com.htc.android.pcsc",
|
||||
"com.sonyericsson.localcontacts",
|
||||
"com.lge.sync",
|
||||
"com.lge.phone",
|
||||
"vnd.tmobileus.contact.phone",
|
||||
"com.android.huawei.phone",
|
||||
"Local Phone Account")
|
||||
|
||||
ContactsHelper(this).getContactTypes {
|
||||
var localAccountType = ""
|
||||
it.forEach {
|
||||
if (localAccountTypes.contains(it)) {
|
||||
localAccountType = it
|
||||
}
|
||||
}
|
||||
config.localAccountType = localAccountType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOtherViewPagerItem(used: Int) = if (used == 1) 0 else 1
|
||||
|
||||
private fun initFragments() {
|
||||
|
Reference in New Issue
Block a user