Cleanup and fix a few compiler warnings
This commit is contained in:
parent
73523dbff8
commit
02e6eaae12
@ -372,4 +372,4 @@ if (!getGradle().getStartParameter().getTaskRequests().toString().contains("Debu
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
// Firebase Crashlytics
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
}
|
||||
}
|
@ -66,7 +66,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
|
||||
db.execSQL(MangaTable.addDateAdded)
|
||||
db.execSQL(MangaTable.backfillDateAdded)
|
||||
}
|
||||
if (oldVersion < 4) {
|
||||
if (oldVersion < 12) {
|
||||
db.execSQL(MergedTable.dropTableQuery)
|
||||
db.execSQL(MergedTable.createTableQuery)
|
||||
db.execSQL(MergedTable.createIndexQuery)
|
||||
|
@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import exh.util.asObservable
|
||||
import kotlin.jvm.Throws
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
@ -28,6 +29,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page number to retrieve.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchPopularManga(page: Int): Observable<MangasPage> {
|
||||
return fetchPopularMangaFlow(page).asObservable()
|
||||
}
|
||||
@ -71,6 +73,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
* @param query the search query.
|
||||
* @param filters the list of filters to apply.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||
return fetchSearchMangaSuspended(page, query, filters).asObservable()
|
||||
}
|
||||
@ -113,6 +116,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page number to retrieve.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchLatestUpdates(page: Int): Observable<MangasPage> {
|
||||
return fetchLatestUpdatesFlow(page).asObservable()
|
||||
}
|
||||
@ -154,6 +158,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param manga the manga to be updated.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||
return fetchMangaDetailsFlow(manga).asObservable()
|
||||
}
|
||||
@ -198,6 +203,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param manga the manga to look for chapters.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||
return try {
|
||||
fetchChapterListFlow(manga).asObservable()
|
||||
@ -250,6 +256,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param chapter the chapter whose page list has to be fetched.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||
return fetchPageListFlow(chapter).asObservable()
|
||||
}
|
||||
@ -294,6 +301,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page whose source image has to be fetched.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchImageUrl(page: Page): Observable<String> {
|
||||
return fetchImageUrlFlow(page).asObservable()
|
||||
}
|
||||
@ -337,6 +345,7 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page whose source image has to be downloaded.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchImage(page: Page): Observable<Response> {
|
||||
return fetchImageFlow(page).asObservable()
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class MangaDex(delegate: HttpSource, val context: Context) :
|
||||
override val needsLogin: Boolean = true
|
||||
|
||||
override fun getLoginDialog(source: Source, activity: Activity): DialogController {
|
||||
return MangadexLoginDialog(source as MangaDex, activity)
|
||||
return MangadexLoginDialog(source as MangaDex)
|
||||
}
|
||||
|
||||
override fun isLogged(): Boolean {
|
||||
|
@ -34,13 +34,13 @@ import eu.kanade.tachiyomi.util.lang.launchUI
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import exh.smartsearch.SmartSearchEngine
|
||||
import exh.util.RecyclerWindowInsetsListener
|
||||
import exh.util.await
|
||||
import exh.util.executeOnIO
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.isActive
|
||||
@ -107,7 +107,6 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
binding.recycler.adapter = adapter
|
||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||
binding.recycler.setHasFixedSize(true)
|
||||
binding.recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener)
|
||||
|
||||
adapter?.updateDataSet(newMigratingManga.map { it.toModal() })
|
||||
|
||||
@ -118,6 +117,7 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
private suspend fun runMigrations(mangas: List<MigratingManga>) {
|
||||
if (config == null) return
|
||||
val useSourceWithMost = preferences.useSourceWithMost().get()
|
||||
@ -157,7 +157,7 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
val processedSources = AtomicInteger()
|
||||
|
||||
validSources.map { source ->
|
||||
async {
|
||||
async async2@{
|
||||
sourceSemaphore.withPermit {
|
||||
try {
|
||||
val searchResult = if (useSmartSearch) {
|
||||
@ -176,7 +176,7 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
try {
|
||||
syncChaptersWithSource(db, chapters, localManga, source)
|
||||
} catch (e: Exception) {
|
||||
return@async null
|
||||
return@async2 null
|
||||
}
|
||||
manga.progress.send(validSources.size to processedSources.incrementAndGet())
|
||||
localManga to chapters.size
|
||||
@ -327,6 +327,7 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
fun useMangaForMigration(manga: Manga, source: Source) {
|
||||
val firstIndex = selectedPosition ?: return
|
||||
val migratingManga = adapter?.getItem(firstIndex) ?: return
|
||||
|
@ -255,9 +255,9 @@ class SourceController(bundle: Bundle? = null) :
|
||||
val sources = preferenceSources.map { it.split("|")[0] }
|
||||
|
||||
if (source.id.toString() in sources) {
|
||||
val preferenceSources = preferenceSources.map { it.split("|") }.filter { it[0] == source.id.toString() }.map { Pair(it[0], it[1]) }.toMutableList()
|
||||
val preferenceSourcePairs = preferenceSources.map { it.split("|") }.filter { it[0] == source.id.toString() }.map { it[0] to it[1] }.toMutableList()
|
||||
|
||||
val preselected = preferenceSources.map { category ->
|
||||
val preselected = preferenceSourcePairs.map { category ->
|
||||
categories.indexOf(category.second)
|
||||
}.toTypedArray()
|
||||
|
||||
|
@ -36,7 +36,7 @@ class SettingsMangaDexController :
|
||||
dialog.targetController = this@SettingsMangaDexController
|
||||
dialog.showDialog(router)
|
||||
} else {
|
||||
val dialog = MangadexLoginDialog(source, activity)
|
||||
val dialog = MangadexLoginDialog(source)
|
||||
dialog.targetController = this@SettingsMangaDexController
|
||||
dialog.showDialog(router)
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ object ImageUtil {
|
||||
}
|
||||
|
||||
// SY -->
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
fun autoSetBackground(image: Bitmap?, alwaysUseWhite: Boolean, context: Context): Drawable {
|
||||
val backgroundColor = if (alwaysUseWhite) Color.WHITE else {
|
||||
context.getResourceColor(R.attr.colorPrimary)
|
||||
|
@ -50,6 +50,7 @@ class AutoCompleteAdapter(context: Context, resource: Int, var objects: List<Str
|
||||
|
||||
override fun publishResults(constraint: CharSequence?, results: FilterResults) {
|
||||
objects = if (results.values != null) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
results.values as List<String>? ?: emptyList()
|
||||
} else {
|
||||
emptyList()
|
||||
|
@ -26,6 +26,7 @@ import exh.util.await
|
||||
import exh.util.cancellable
|
||||
import exh.util.jobScheduler
|
||||
import java.lang.RuntimeException
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.mapNotNull
|
||||
import kotlinx.coroutines.flow.toList
|
||||
@ -34,6 +35,7 @@ import timber.log.Timber
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import xyz.nulldev.ts.api.http.serializer.FilterSerializer
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
object DebugFunctions {
|
||||
val app: Application by injectLazy()
|
||||
val db: DatabaseHelper by injectLazy()
|
||||
|
@ -1,6 +1,7 @@
|
||||
package exh.debug
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
enum class DebugToggles(val default: Boolean) {
|
||||
@ -17,6 +18,7 @@ enum class DebugToggles(val default: Boolean) {
|
||||
|
||||
val prefKey = "eh_debug_toggle_${name.toLowerCase()}"
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
var enabled: Boolean
|
||||
get() = prefs.flowPrefs.getBoolean(prefKey, default).get()
|
||||
set(value) {
|
||||
|
@ -34,6 +34,8 @@ import kotlin.time.days
|
||||
import kotlin.time.hours
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancelAndJoin
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
@ -128,6 +130,7 @@ class EHentaiUpdateWorker : JobService(), CoroutineScope {
|
||||
return true
|
||||
}
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
private suspend fun startUpdating() {
|
||||
logger.d("Update job started!")
|
||||
val startTime = System.currentTimeMillis()
|
||||
@ -255,6 +258,7 @@ class EHentaiUpdateWorker : JobService(), CoroutineScope {
|
||||
}
|
||||
|
||||
// New, current
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
private suspend fun updateEntryAndGetChapters(manga: Manga): Pair<List<Chapter>, List<Chapter>> {
|
||||
val source = sourceManager.get(manga.source) as? EHentai
|
||||
?: throw GalleryNotUpdatedException(false, IllegalStateException("Missing EH-based source (${manga.source})!"))
|
||||
|
@ -117,7 +117,7 @@ class FavoritesSyncHelper(val context: Context) {
|
||||
ignore { wifiLock?.release() }
|
||||
wifiLock = ignore {
|
||||
context.wifiManager.createWifiLock(
|
||||
WifiManager.WIFI_MODE_FULL,
|
||||
WifiManager.WIFI_MODE_FULL_HIGH_PERF,
|
||||
"teh:ExhFavoritesSyncWifi"
|
||||
)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import exh.md.utils.MdUtil
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import okhttp3.CacheControl
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
@ -14,6 +15,7 @@ import rx.Observable
|
||||
// Unused, kept for reference todo
|
||||
class PageHandler(val client: OkHttpClient, val headers: Headers, private val imageServer: String, val dataSaver: String?) {
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||
if (chapter.scanlator.equals("MangaPlus")) {
|
||||
return client.newCall(pageListRequest(chapter))
|
||||
|
@ -51,11 +51,6 @@ class NHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
if (it.isNotEmpty()) manga.artist = it.joinToString(transform = { it.name })
|
||||
}
|
||||
|
||||
var category: String? = null
|
||||
tags.filter { it.namespace == NHENTAI_CATEGORIES_NAMESPACE }.let {
|
||||
if (it.isNotEmpty()) category = it.joinToString(transform = { it.name })
|
||||
}
|
||||
|
||||
// Copy tags -> genres
|
||||
manga.genre = tagsToGenreString()
|
||||
|
||||
@ -70,23 +65,7 @@ class NHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
}
|
||||
}
|
||||
|
||||
/*val titleDesc = StringBuilder()
|
||||
englishTitle?.let { titleDesc += "English Title: $it\n" }
|
||||
japaneseTitle?.let { titleDesc += "Japanese Title: $it\n" }
|
||||
shortTitle?.let { titleDesc += "Short Title: $it\n" }
|
||||
|
||||
val detailsDesc = StringBuilder()
|
||||
category?.let { detailsDesc += "Category: $it\n" }
|
||||
uploadDate?.let { detailsDesc += "Upload Date: ${EX_DATE_FORMAT.format(Date(it * 1000))}\n" }
|
||||
pageImageTypes.size.let { detailsDesc += "Length: $it pages\n" }
|
||||
favoritesCount?.let { detailsDesc += "Favorited: $it times\n" }
|
||||
scanlator?.nullIfBlank()?.let { detailsDesc += "Scanlator: $it\n" }
|
||||
|
||||
val tagsDesc = tagsToDescription()*/
|
||||
|
||||
manga.description = "meta" /*listOf(titleDesc.toString(), detailsDesc.toString(), tagsDesc.toString())
|
||||
.filter(String::isNotBlank)
|
||||
.joinToString(separator = "\n")*/
|
||||
manga.description = "meta"
|
||||
}
|
||||
|
||||
override fun getExtraInfoPairs(context: Context): List<Pair<String, String>> {
|
||||
|
@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.source.model.SManga
|
||||
import exh.util.await
|
||||
import info.debatty.java.stringsimilarity.NormalizedLevenshtein
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.supervisorScope
|
||||
import rx.schedulers.Schedulers
|
||||
@ -20,6 +21,7 @@ class SmartSearchEngine(
|
||||
|
||||
private val normalizedLevenshtein = NormalizedLevenshtein()
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
suspend fun smartSearch(source: CatalogueSource, title: String): SManga? {
|
||||
val cleanedTitle = cleanSmartSearchTitle(title)
|
||||
|
||||
@ -49,6 +51,7 @@ class SmartSearchEngine(
|
||||
return eligibleManga.maxByOrNull { it.dist }?.manga
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
suspend fun normalSearch(source: CatalogueSource, title: String): SManga? {
|
||||
val eligibleManga = supervisorScope {
|
||||
val searchQuery = if (extraSearchParams != null) {
|
||||
|
@ -70,12 +70,14 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
}
|
||||
} else null
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val headers = (
|
||||
(source as? HttpSource)?.headers?.toMultimap()?.mapValues {
|
||||
it.value.joinToString(",")
|
||||
} ?: emptyMap()
|
||||
) + (intent.getSerializableExtra(HEADERS_EXTRA) as? HashMap<String, String> ?: emptyMap())
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val cookies: HashMap<String, String>? =
|
||||
intent.getSerializableExtra(COOKIES_EXTRA) as? HashMap<String, String>
|
||||
val script: String? = intent.getStringExtra(SCRIPT_EXTRA)
|
||||
|
@ -44,12 +44,14 @@ class DeferredField<T> {
|
||||
*/
|
||||
suspend fun get(): T {
|
||||
// Check if field is initialized and return immediately if it is
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
if (initialized) return content as T
|
||||
|
||||
// Wait for field to initialize
|
||||
mutex.withLock {}
|
||||
|
||||
// Field is initialized, return value
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return content as T
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package exh.util
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.WindowInsets
|
||||
import androidx.annotation.Px
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.google.android.material.chip.ChipGroup
|
||||
import exh.EH_SOURCE_ID
|
||||
@ -12,23 +9,6 @@ import exh.metadata.metadata.EHentaiSearchMetadata.Companion.TAG_TYPE_LIGHT
|
||||
import exh.metadata.metadata.EHentaiSearchMetadata.Companion.TAG_TYPE_NORMAL
|
||||
import exh.metadata.metadata.EHentaiSearchMetadata.Companion.TAG_TYPE_WEAK
|
||||
|
||||
inline fun View.updatePaddingRelative(
|
||||
@Px start: Int = paddingStart,
|
||||
@Px top: Int = paddingTop,
|
||||
@Px end: Int = paddingEnd,
|
||||
@Px bottom: Int = paddingBottom
|
||||
) {
|
||||
setPaddingRelative(start, top, end, bottom)
|
||||
}
|
||||
|
||||
object RecyclerWindowInsetsListener : View.OnApplyWindowInsetsListener {
|
||||
override fun onApplyWindowInsets(v: View, insets: WindowInsets): WindowInsets {
|
||||
v.updatePaddingRelative(bottom = insets.systemWindowInsetBottom)
|
||||
// v.updatePaddingRelative(bottom = v.paddingBottom + insets.systemWindowInsetBottom)
|
||||
return insets
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces chips in a ChipGroup.
|
||||
*
|
||||
|
@ -1,6 +1,5 @@
|
||||
package exh.widget.preference
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@ -32,7 +31,7 @@ class MangadexLoginDialog(bundle: Bundle? = null) : LoginDialogPreference(bundle
|
||||
|
||||
val scope = CoroutineScope(Job() + Dispatchers.Main)
|
||||
|
||||
constructor(source: MangaDex, activity: Activity? = null) : this(
|
||||
constructor(source: MangaDex) : this(
|
||||
Bundle().apply {
|
||||
putLong(
|
||||
"key",
|
||||
|
@ -20,7 +20,7 @@ import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.full.isSubclassOf
|
||||
|
||||
class FilterSerializer {
|
||||
val serializers = listOf<Serializer<*>>(
|
||||
private val serializers = listOf<Serializer<*>>(
|
||||
// EXH -->
|
||||
HelpDialogSerializer(this),
|
||||
AutoCompleteSerializer(this),
|
||||
@ -37,6 +37,7 @@ class FilterSerializer {
|
||||
|
||||
fun serialize(filters: FilterList) = JsonArray().apply {
|
||||
filters.forEach {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
add(serialize(it as Filter<Any?>))
|
||||
}
|
||||
}
|
||||
@ -46,6 +47,7 @@ class FilterSerializer {
|
||||
for (serializer in serializers) {
|
||||
if (filter::class.isSubclassOf(serializer.clazz)) {
|
||||
// TODO Not sure how to deal with the mess of types here
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
serializer as Serializer<Filter<Any?>>
|
||||
|
||||
serializer.serialize(out, filter)
|
||||
@ -68,6 +70,7 @@ class FilterSerializer {
|
||||
|
||||
fun deserialize(filters: FilterList, json: JsonArray) {
|
||||
filters.zip(json).forEach { (filter, obj) ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
deserialize(filter as Filter<Any?>, obj.obj)
|
||||
}
|
||||
}
|
||||
@ -78,6 +81,7 @@ class FilterSerializer {
|
||||
} ?: throw IllegalArgumentException("Cannot deserialize this type!")
|
||||
|
||||
// TODO Not sure how to deal with the mess of types here
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
serializer as Serializer<Filter<Any?>>
|
||||
|
||||
serializer.deserialize(json, filter)
|
||||
@ -98,6 +102,7 @@ class FilterSerializer {
|
||||
"null" -> null
|
||||
else -> throw IllegalArgumentException("Cannot deserialize this type!")
|
||||
}
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(it.second as KMutableProperty1<in Filter<Any?>, in Any?>).set(filter, res)
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package xyz.nulldev.ts.api.http.serializer
|
||||
|
||||
import com.github.salomonbrys.kotson.bool
|
||||
import com.github.salomonbrys.kotson.forEach
|
||||
import com.github.salomonbrys.kotson.int
|
||||
import com.github.salomonbrys.kotson.nullArray
|
||||
import com.github.salomonbrys.kotson.nullObj
|
||||
@ -152,6 +151,7 @@ class GroupSerializer(override val serializer: FilterSerializer) : Serializer<Fi
|
||||
filter.state.forEach {
|
||||
add(
|
||||
if (it is Filter<*>) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
serializer.serialize(it as Filter<Any?>)
|
||||
} else {
|
||||
JsonNull.INSTANCE
|
||||
@ -164,6 +164,7 @@ class GroupSerializer(override val serializer: FilterSerializer) : Serializer<Fi
|
||||
override fun deserialize(json: JsonObject, filter: Filter.Group<Any?>) {
|
||||
json[STATE].asJsonArray.forEachIndexed { index, jsonElement ->
|
||||
if (!jsonElement.isJsonNull) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
serializer.deserialize(filter.state[index] as Filter<Any?>, jsonElement.asJsonObject)
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
@ -11,9 +11,7 @@
|
||||
android:id="@+id/image"
|
||||
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||
android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||
android:paddingLeft="@dimen/material_component_lists_icon_left_padding"
|
||||
android:paddingStart="@dimen/material_component_lists_icon_left_padding"
|
||||
android:paddingRight="0dp"
|
||||
android:paddingEnd="0dp"
|
||||
tools:src="@mipmap/ic_launcher_round"/>
|
||||
|
||||
@ -21,9 +19,7 @@
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/material_component_lists_text_left_padding"
|
||||
android:layout_marginStart="@dimen/material_component_lists_text_left_padding"
|
||||
android:layout_marginRight="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||
android:layout_marginEnd="@dimen/material_component_lists_single_line_with_avatar_height"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user