minor code style update

This commit is contained in:
Tibor Kaputa 2023-05-13 12:19:24 +02:00 committed by GitHub
parent f34379405d
commit 01467bde81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ class Config(context: Context) : BaseConfig(context) {
companion object {
fun newInstance(context: Context) = Config(context)
}
fun getSpeedDialValues(): ArrayList<SpeedDial> {
val speedDialType = object : TypeToken<List<SpeedDial>>() {}.type
val speedDialValues = Gson().fromJson<ArrayList<SpeedDial>>(speedDial, speedDialType) ?: ArrayList(1)
@ -33,14 +34,12 @@ class Config(context: Context) : BaseConfig(context) {
}
fun getCustomSIM(number: String): PhoneAccountHandle? {
val myPhoneAccountHandle =
prefs.getPhoneAccountHandleModel(REMEMBER_SIM_PREFIX + number, null)
val myPhoneAccountHandle = prefs.getPhoneAccountHandleModel(REMEMBER_SIM_PREFIX + number, null)
return if (myPhoneAccountHandle != null) {
val packageName = myPhoneAccountHandle.packageName
val className = myPhoneAccountHandle.className
val componentName = ComponentName(packageName, className)
val id = myPhoneAccountHandle.id
PhoneAccountHandle(componentName, id)
} else {
null
@ -50,6 +49,7 @@ class Config(context: Context) : BaseConfig(context) {
fun removeCustomSIM(number: String) {
prefs.edit().remove(REMEMBER_SIM_PREFIX + number).apply()
}
var showTabs: Int
get() = prefs.getInt(SHOW_TABS, ALL_TABS_MASK)
set(showTabs) = prefs.edit().putInt(SHOW_TABS, showTabs).apply()