@@ -4,9 +4,9 @@ import android.content.SharedPreferences
44import androidx.core.content.edit
55import androidx.preference.PreferenceManager
66import androidx.wear.protolayout.material.layouts.LayoutDefaults.MultiButtonLayoutDefaults
7- import com.google.common.reflect.TypeToken
87import com.thewizrd.common.controls.WeatherDetailsType
98import com.thewizrd.shared_resources.appLib
9+ import com.thewizrd.shared_resources.json.listType
1010import com.thewizrd.shared_resources.utils.JSONParser
1111import kotlinx.coroutines.channels.Channel
1212import kotlinx.coroutines.channels.awaitClose
@@ -40,8 +40,7 @@ object DetailsWeatherTileUtils {
4040 val preferences = PreferenceManager .getDefaultSharedPreferences(appLib.context)
4141 val configJSON = preferences.getString(KEY_DETAILSWEATHERTILECONFIG , null )
4242 return configJSON?.let {
43- val arrListType = object : TypeToken <List <WeatherDetailsType >>() {}.type
44- JSONParser .deserializer<List <WeatherDetailsType >>(it, arrListType)
43+ JSONParser .deserializer<List <WeatherDetailsType >>(it, listType<WeatherDetailsType >())
4544 }
4645 }
4746
@@ -68,8 +67,7 @@ object DetailsWeatherTileUtils {
6867 val preferences = PreferenceManager .getDefaultSharedPreferences(appLib.context)
6968 preferences.edit {
7069 putString(KEY_DETAILSWEATHERTILECONFIG , types?.let {
71- val arrListType = object : TypeToken <List <WeatherDetailsType >>() {}.type
72- JSONParser .serializer(it, arrListType)
70+ JSONParser .serializer(it, listType<WeatherDetailsType >())
7371 })
7472 }
7573 }
0 commit comments