Use lowercase contact mode values

This commit is contained in:
Juha Heinanen
2022-02-25 09:04:34 +02:00
parent 3eab999478
commit 158a46a2bc
4 changed files with 7 additions and 7 deletions

View File

@ -363,7 +363,7 @@ class BaresipService: Service() {
File(filesDir, "history").renameTo(File(filesDir, "calls"))
if (contactsMode != "Android")
if (contactsMode != "android")
Contact.restoreBaresipContacts()
if (contactsMode != "baresip") {
Contact.loadAndroidContacts(applicationContext)

View File

@ -300,11 +300,11 @@ class ConfigActivity : AppCompatActivity() {
darkTheme.isChecked = oldDisplayTheme == AppCompatDelegate.MODE_NIGHT_YES
contactsSpinner = binding.contactsSpinner
contactsModeKeys = arrayListOf("baresip", "Android", "Both")
contactsModeKeys = arrayListOf("baresip", "android", "both")
val contactsModeVals = arrayListOf(getString(R.string.baresip), getString(R.string.android),
getString(R.string.both))
val ctCv = Config.variable("contacts_mode")
oldContactsMode = if (ctCv.size == 0) "baresip" else ctCv[0]
oldContactsMode = if (ctCv.size == 0) "baresip" else ctCv[0].lowercase()
contactsMode = oldContactsMode
val keyIndex = contactsModeKeys.indexOf(oldContactsMode)
val keyValue = contactsModeVals.elementAt(keyIndex)
@ -518,12 +518,12 @@ class ConfigActivity : AppCompatActivity() {
Contact.restoreBaresipContacts()
baresipService.action = "Stop Content Observer"
}
"Android" -> {
"android" -> {
BaresipService.baresipContacts.clear()
Contact.loadAndroidContacts(this)
baresipService.action = "Start Content Observer"
}
"Both" -> {
"both" -> {
Contact.restoreBaresipContacts()
Contact.loadAndroidContacts(this)
baresipService.action = "Start Content Observer"

View File

@ -195,7 +195,7 @@ sealed class Contact {
fun contactsUpdate() {
BaresipService.contacts.clear()
if (BaresipService.contactsMode != "Android")
if (BaresipService.contactsMode != "android")
BaresipService.contacts.addAll(BaresipService.baresipContacts)
if (BaresipService.contactsMode != "baresip")
addAndroidContacts()

View File

@ -80,7 +80,7 @@ class ContactActivity : AppCompatActivity() {
else
uriView.setText(uri)
uOrI = uri
if ((BaresipService.contactsMode == "Android")) {
if ((BaresipService.contactsMode == "android")) {
androidCheck.isChecked = true
androidCheck.isClickable = false
} else {