diff --git a/app/build.gradle b/app/build.gradle index c15bcc12f..08f47c12b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -82,7 +82,7 @@ dependencies { implementation 'androidx.core:core-ktx:1.2.0-alpha02' implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.preference:preference:1.1.0-rc01' - implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2' implementation 'com.google.android.material:material:1.1.0-alpha07' implementation 'com.google.android:flexbox:1.1.0' diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 19326cbf6..ed162df36 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -36,7 +36,7 @@ class AnalyzeRule(private var book: BaseBook? = null) { } @JvmOverloads - fun setContent(body: Any?, baseUrl: String? = null): AnalyzeRule { + fun setContent(body: Any?, baseUrl: String? = this.baseUrl): AnalyzeRule { if (body == null) throw AssertionError("Content cannot be null") isJSON = body.toString().isJson() `object` = body @@ -129,21 +129,23 @@ class AnalyzeRule(private var book: BaseBook? = null) { } if (result == null) return ArrayList() if (result is String) { - result = Arrays.asList((result as String?)?.htmlFormat()?.split("\n")) + result = listOf((result as String?)?.htmlFormat()?.split("\n")) } baseUrl?.let { if (isUrl && !TextUtils.isEmpty(it)) { val urlList = ArrayList() - for (url in (result as List?)!!) { - val absoluteURL = NetworkUtils.getAbsoluteURL(it, url) - if (!urlList.contains(absoluteURL)) { - urlList.add(absoluteURL) + if (result is List<*>) { + for (url in result) { + val absoluteURL = NetworkUtils.getAbsoluteURL(it, url.toString()) + if (!urlList.contains(absoluteURL)) { + urlList.add(absoluteURL) + } } } return urlList } } - return result as List? + return result as? List } /** diff --git a/app/src/main/java/io/legado/app/model/book/BookList.kt b/app/src/main/java/io/legado/app/model/book/BookList.kt index 489d694c7..a4660a4d8 100644 --- a/app/src/main/java/io/legado/app/model/book/BookList.kt +++ b/app/src/main/java/io/legado/app/model/book/BookList.kt @@ -1,5 +1,12 @@ package io.legado.app.model.book +import io.legado.app.data.entities.SearchBook + class BookList { + fun analyzeBookList(): ArrayList { + var bookList = ArrayList() + + return bookList + } } \ No newline at end of file