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
@@ -363,7 +363,7 @@ class BaresipService: Service() {
File(filesDir, "history").renameTo(File(filesDir, "calls")) File(filesDir, "history").renameTo(File(filesDir, "calls"))
if (contactsMode != "Android") if (contactsMode != "android")
Contact.restoreBaresipContacts() Contact.restoreBaresipContacts()
if (contactsMode != "baresip") { if (contactsMode != "baresip") {
Contact.loadAndroidContacts(applicationContext) Contact.loadAndroidContacts(applicationContext)
@@ -300,11 +300,11 @@ class ConfigActivity : AppCompatActivity() {
darkTheme.isChecked = oldDisplayTheme == AppCompatDelegate.MODE_NIGHT_YES darkTheme.isChecked = oldDisplayTheme == AppCompatDelegate.MODE_NIGHT_YES
contactsSpinner = binding.contactsSpinner contactsSpinner = binding.contactsSpinner
contactsModeKeys = arrayListOf("baresip", "Android", "Both") contactsModeKeys = arrayListOf("baresip", "android", "both")
val contactsModeVals = arrayListOf(getString(R.string.baresip), getString(R.string.android), val contactsModeVals = arrayListOf(getString(R.string.baresip), getString(R.string.android),
getString(R.string.both)) getString(R.string.both))
val ctCv = Config.variable("contacts_mode") 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 contactsMode = oldContactsMode
val keyIndex = contactsModeKeys.indexOf(oldContactsMode) val keyIndex = contactsModeKeys.indexOf(oldContactsMode)
val keyValue = contactsModeVals.elementAt(keyIndex) val keyValue = contactsModeVals.elementAt(keyIndex)
@@ -518,12 +518,12 @@ class ConfigActivity : AppCompatActivity() {
Contact.restoreBaresipContacts() Contact.restoreBaresipContacts()
baresipService.action = "Stop Content Observer" baresipService.action = "Stop Content Observer"
} }
"Android" -> { "android" -> {
BaresipService.baresipContacts.clear() BaresipService.baresipContacts.clear()
Contact.loadAndroidContacts(this) Contact.loadAndroidContacts(this)
baresipService.action = "Start Content Observer" baresipService.action = "Start Content Observer"
} }
"Both" -> { "both" -> {
Contact.restoreBaresipContacts() Contact.restoreBaresipContacts()
Contact.loadAndroidContacts(this) Contact.loadAndroidContacts(this)
baresipService.action = "Start Content Observer" baresipService.action = "Start Content Observer"
@@ -195,7 +195,7 @@ sealed class Contact {
fun contactsUpdate() { fun contactsUpdate() {
BaresipService.contacts.clear() BaresipService.contacts.clear()
if (BaresipService.contactsMode != "Android") if (BaresipService.contactsMode != "android")
BaresipService.contacts.addAll(BaresipService.baresipContacts) BaresipService.contacts.addAll(BaresipService.baresipContacts)
if (BaresipService.contactsMode != "baresip") if (BaresipService.contactsMode != "baresip")
addAndroidContacts() addAndroidContacts()
@@ -80,7 +80,7 @@ class ContactActivity : AppCompatActivity() {
else else
uriView.setText(uri) uriView.setText(uri)
uOrI = uri uOrI = uri
if ((BaresipService.contactsMode == "Android")) { if ((BaresipService.contactsMode == "android")) {
androidCheck.isChecked = true androidCheck.isChecked = true
androidCheck.isClickable = false androidCheck.isClickable = false
} else { } else {