mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
removing a few more calling related redundant things
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
package com.simplemobiletools.contacts.pro.extensions
|
|
||||||
|
|
||||||
import android.view.KeyEvent
|
|
||||||
import android.widget.EditText
|
|
||||||
|
|
||||||
fun EditText.addCharacter(char: Char) {
|
|
||||||
dispatchKeyEvent(getKeyEvent(getCharKeyCode(char)))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun EditText.getKeyEvent(keyCode: Int) = KeyEvent(0, 0, KeyEvent.ACTION_DOWN, keyCode, 0)
|
|
||||||
|
|
||||||
private fun getCharKeyCode(char: Char) = when (char) {
|
|
||||||
'0' -> KeyEvent.KEYCODE_0
|
|
||||||
'1' -> KeyEvent.KEYCODE_1
|
|
||||||
'2' -> KeyEvent.KEYCODE_2
|
|
||||||
'3' -> KeyEvent.KEYCODE_3
|
|
||||||
'4' -> KeyEvent.KEYCODE_4
|
|
||||||
'5' -> KeyEvent.KEYCODE_5
|
|
||||||
'6' -> KeyEvent.KEYCODE_6
|
|
||||||
'7' -> KeyEvent.KEYCODE_7
|
|
||||||
'8' -> KeyEvent.KEYCODE_8
|
|
||||||
'9' -> KeyEvent.KEYCODE_9
|
|
||||||
'*' -> KeyEvent.KEYCODE_STAR
|
|
||||||
'+' -> KeyEvent.KEYCODE_PLUS
|
|
||||||
else -> KeyEvent.KEYCODE_POUND
|
|
||||||
}
|
|
@@ -1,11 +1,7 @@
|
|||||||
package com.simplemobiletools.contacts.pro.helpers
|
package com.simplemobiletools.contacts.pro.helpers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.reflect.TypeToken
|
|
||||||
import com.simplemobiletools.commons.helpers.BaseConfig
|
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||||
import com.simplemobiletools.contacts.pro.models.SpeedDial
|
|
||||||
|
|
||||||
class Config(context: Context) : BaseConfig(context) {
|
class Config(context: Context) : BaseConfig(context) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -73,26 +69,6 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
get() = prefs.getBoolean(SHOW_PRIVATE_CONTACTS, true)
|
get() = prefs.getBoolean(SHOW_PRIVATE_CONTACTS, true)
|
||||||
set(showPrivateContacts) = prefs.edit().putBoolean(SHOW_PRIVATE_CONTACTS, showPrivateContacts).apply()
|
set(showPrivateContacts) = prefs.edit().putBoolean(SHOW_PRIVATE_CONTACTS, showPrivateContacts).apply()
|
||||||
|
|
||||||
fun saveCustomSIM(number: String, SIMlabel: String) {
|
|
||||||
prefs.edit().putString(REMEMBER_SIM_PREFIX + number, Uri.encode(SIMlabel)).apply()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getCustomSIM(number: String) = prefs.getString(REMEMBER_SIM_PREFIX + number, "")
|
|
||||||
|
|
||||||
fun getSpeedDialValues(): ArrayList<SpeedDial> {
|
|
||||||
val speedDialType = object : TypeToken<List<SpeedDial>>() {}.type
|
|
||||||
val speedDialValues = Gson().fromJson<ArrayList<SpeedDial>>(speedDial, speedDialType) ?: ArrayList(1)
|
|
||||||
|
|
||||||
for (i in 1..9) {
|
|
||||||
val speedDial = SpeedDial(i, "", "")
|
|
||||||
if (speedDialValues.firstOrNull { it.id == i } == null) {
|
|
||||||
speedDialValues.add(speedDial)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return speedDialValues
|
|
||||||
}
|
|
||||||
|
|
||||||
var wasDialerMigrationShown: Boolean
|
var wasDialerMigrationShown: Boolean
|
||||||
get() = prefs.getBoolean(WAS_DIALER_MIGRATION_SHOWN, false)
|
get() = prefs.getBoolean(WAS_DIALER_MIGRATION_SHOWN, false)
|
||||||
set(wasDialerMigrationShown) = prefs.edit().putBoolean(WAS_DIALER_MIGRATION_SHOWN, wasDialerMigrationShown).apply()
|
set(wasDialerMigrationShown) = prefs.edit().putBoolean(WAS_DIALER_MIGRATION_SHOWN, wasDialerMigrationShown).apply()
|
||||||
|
@@ -22,7 +22,6 @@ const val SHOW_DIALPAD_BUTTON = "show_dialpad_button"
|
|||||||
const val SPEED_DIAL = "speed_dial"
|
const val SPEED_DIAL = "speed_dial"
|
||||||
const val LAST_EXPORT_PATH = "last_export_path"
|
const val LAST_EXPORT_PATH = "last_export_path"
|
||||||
const val WAS_LOCAL_ACCOUNT_INITIALIZED = "was_local_account_initialized"
|
const val WAS_LOCAL_ACCOUNT_INITIALIZED = "was_local_account_initialized"
|
||||||
const val REMEMBER_SIM_PREFIX = "remember_sim_"
|
|
||||||
const val SHOW_PRIVATE_CONTACTS = "show_private_contacts"
|
const val SHOW_PRIVATE_CONTACTS = "show_private_contacts"
|
||||||
const val WAS_DIALER_MIGRATION_SHOWN = "was_dialer_migration_shown"
|
const val WAS_DIALER_MIGRATION_SHOWN = "was_dialer_migration_shown"
|
||||||
|
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
package com.simplemobiletools.contacts.pro.interfaces
|
|
||||||
|
|
||||||
interface RemoveSpeedDialListener {
|
|
||||||
fun removeSpeedDial(ids: ArrayList<Int>)
|
|
||||||
}
|
|
@@ -1,4 +0,0 @@
|
|||||||
package com.simplemobiletools.contacts.pro.models
|
|
||||||
|
|
||||||
// a simpler Contact model containing just info needed at the call screen
|
|
||||||
data class CallContact(var name: String, var photoUri: String, var number: String)
|
|
@@ -1,5 +0,0 @@
|
|||||||
package com.simplemobiletools.contacts.pro.models
|
|
||||||
|
|
||||||
data class SpeedDial(val id: Int, var number: String, var displayName: String) {
|
|
||||||
fun isValid() = number.trim().isNotEmpty()
|
|
||||||
}
|
|
Reference in New Issue
Block a user