pull/32/head
kunfei 5 years ago
parent 0f70ab546b
commit 354e00794e
  1. 2
      app/build.gradle
  2. 16
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt
  3. 7
      app/src/main/java/io/legado/app/model/book/BookList.kt

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

@ -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<String>()
for (url in (result as List<String>?)!!) {
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<String>?
return result as? List<String>
}
/**

@ -1,5 +1,12 @@
package io.legado.app.model.book
import io.legado.app.data.entities.SearchBook
class BookList {
fun analyzeBookList(): ArrayList<SearchBook> {
var bookList = ArrayList<SearchBook>()
return bookList
}
}
Loading…
Cancel
Save