mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
custom sorting by drag and drop
This commit is contained in:
@ -59,4 +59,12 @@ class Config(context: Context) : BaseConfig(context) {
|
||||
var showTabs: Int
|
||||
get() = prefs.getInt(SHOW_TABS, ALL_TABS_MASK)
|
||||
set(showTabs) = prefs.edit().putInt(SHOW_TABS, showTabs).apply()
|
||||
|
||||
var favoritesContactsOrder: String
|
||||
get() = prefs.getString(FAVORITES_CONTACTS_ORDER, "")!!
|
||||
set(order) = prefs.edit().putString(FAVORITES_CONTACTS_ORDER, order).apply()
|
||||
|
||||
var isCustomOrderSelected: Boolean
|
||||
get() = prefs.getBoolean(FAVORITES_CUSTOM_ORDER_SELECTED, false)
|
||||
set(selected) = prefs.edit().putBoolean(FAVORITES_CUSTOM_ORDER_SELECTED, selected).apply()
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ const val OPEN_DIAL_PAD_AT_LAUNCH = "open_dial_pad_at_launch"
|
||||
const val DISABLE_PROXIMITY_SENSOR = "disable_proximity_sensor"
|
||||
const val DISABLE_SWIPE_TO_ANSWER = "disable_swipe_to_answer"
|
||||
const val SHOW_TABS = "show_tabs"
|
||||
const val FAVORITES_CONTACTS_ORDER = "favorites_contacts_order"
|
||||
const val FAVORITES_CUSTOM_ORDER_SELECTED = "favorites_custom_order_selected"
|
||||
|
||||
const val ALL_TABS_MASK = TAB_CONTACTS or TAB_FAVORITES or TAB_CALL_HISTORY
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.simplemobiletools.dialer.helpers
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
|
||||
class Converters {
|
||||
private val gson = Gson()
|
||||
private val stringType = object : TypeToken<List<String>>() {}.type
|
||||
|
||||
fun jsonToStringList(value: String) = gson.fromJson<ArrayList<String>>(value, stringType)
|
||||
|
||||
fun stringListToJson(list: ArrayList<String>) = gson.toJson(list)
|
||||
}
|
Reference in New Issue
Block a user