custom sorting by drag and drop

This commit is contained in:
Pavel Poley
2022-05-16 13:51:26 +03:00
parent 0bcc9d5cb4
commit 76c7d4762a
8 changed files with 209 additions and 21 deletions

View File

@ -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()
}

View File

@ -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

View File

@ -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)
}