pull/694/head
deniscerri 1 year ago
parent 1e329d3a8a
commit def6d9e7a0
No known key found for this signature in database
GPG Key ID: 95C43D517D830350

@ -17,14 +17,12 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.deniscerri.ytdl.R
import com.deniscerri.ytdl.database.models.Format
import com.deniscerri.ytdl.database.models.YoutubePlayerClientItem
import com.deniscerri.ytdl.ui.adapter.YoutubePlayerClientAdapter
import com.deniscerri.ytdl.ui.more.settings.SettingsActivity
import com.deniscerri.ytdl.util.UiUtil
import com.google.android.material.card.MaterialCardView
import com.google.android.material.chip.Chip
import com.google.common.reflect.TypeToken
import com.google.gson.Gson
@ -61,8 +59,7 @@ class YoutubePlayerClientFragment : Fragment(), YoutubePlayerClientAdapter.OnIte
recyclerView.adapter = listAdapter
itemTouchHelper.attachToRecyclerView(recyclerView)
currentListRaw = preferences.getString("youtube_player_clients", "[]")!!
val itemType = object : TypeToken<List<YoutubePlayerClientItem>>() {}.type
currentList = Gson().fromJson<List<YoutubePlayerClientItem>>(currentListRaw, itemType).toMutableList()
currentList = Gson().fromJson(currentListRaw, Array<YoutubePlayerClientItem>::class.java).toMutableList()
listAdapter.submitList(currentList.toList())
val newClient = view.findViewById<Chip>(R.id.newClient)
@ -96,7 +93,7 @@ class YoutubePlayerClientFragment : Fragment(), YoutubePlayerClientAdapter.OnIte
val hasNoResults = currentList.isEmpty()
noResults.isVisible = hasNoResults
recyclerView.isVisible = !hasNoResults
dragHandle.isVisible = !hasNoResults
dragHandle.isVisible = currentList.size > 1
}

@ -2329,8 +2329,7 @@ object UiUtil {
})
val existingConfigsRaw = preferences.getString("youtube_player_clients", "[]")
val itemType = object : com.google.common.reflect.TypeToken<List<YoutubePlayerClientItem>>() {}.type
val existingConfigs = Gson().fromJson<List<YoutubePlayerClientItem>>(existingConfigsRaw, itemType).toMutableList()
val existingConfigs = Gson().fromJson(existingConfigsRaw, Array<YoutubePlayerClientItem>::class.java).toMutableList()
defaultChips.filter { it.isNotBlank() }.forEach {
if (!existingConfigs.any { it2 -> it2.playerClient == it }) {

@ -37,8 +37,6 @@ import org.json.JSONArray
import org.json.JSONObject
import java.io.File
import java.lang.reflect.Type
import java.net.URLEncoder
import java.security.MessageDigest
import java.util.ArrayList
import java.util.Locale
import java.util.UUID
@ -1243,8 +1241,7 @@ class YTDLPUtil(private val context: Context) {
val poTokens = mutableListOf<String>()
val configuredPlayerClientsRaw = sharedPreferences.getString("youtube_player_clients", "[]")!!
val itemType = object : com.google.common.reflect.TypeToken<List<YoutubePlayerClientItem>>() {}.type
val configuredPlayerClients = Gson().fromJson<List<YoutubePlayerClientItem>>(configuredPlayerClientsRaw, itemType).toMutableList()
val configuredPlayerClients = Gson().fromJson(configuredPlayerClientsRaw, Array<YoutubePlayerClientItem>::class.java).toMutableList()
for (value in configuredPlayerClients) {
if (value.enabled) {

Loading…
Cancel
Save