pull/32/head
kunfei 5 years ago
parent eb3bfd4db7
commit f3e1fd0d69
  1. 22
      app/src/main/java/io/legado/app/data/entities/SearchShow.kt
  2. 8
      app/src/main/java/io/legado/app/ui/main/findbook/FindBookAdapter.kt
  3. 10
      app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt

@ -1,17 +1,29 @@
package io.legado.app.data.entities
import io.legado.app.utils.splitNotBlank
data class SearchShow(
var name: String = "",
var author: String = "",
override var kind: String? = null,
var kind: String? = null,
var coverUrl: String? = null,
var intro: String? = null,
override var wordCount: String? = null,
var wordCount: String? = null,
var latestChapterTitle: String? = null,
var time: Long = 0L,
var originCount: Int = 0
) : BaseBook {
override var variableMap: HashMap<String, String>? = null
) {
fun getKindList(): List<String> {
val kindList = arrayListOf<String>()
wordCount?.let {
if (it.isNotBlank()) kindList.add(it)
}
kind?.let {
val kinds = it.splitNotBlank(",", "\n")
kindList.addAll(kinds)
}
return kindList
}
override fun putVariable(key: String, value: String) = Unit
}

@ -85,7 +85,11 @@ class FindBookAdapter(private val scope: CoroutineScope, val callBack: CallBack)
rowNum++
}
tv.onClick {
callBack.openExplore(
bookSource.bookSourceUrl,
kind.title,
kind.url
)
}
}
}
@ -104,5 +108,7 @@ class FindBookAdapter(private val scope: CoroutineScope, val callBack: CallBack)
interface CallBack {
fun scrollTo(pos: Int)
fun openExplore(sourceUrl: String, title: String, exploreUrl: String)
}
}

@ -13,6 +13,8 @@ import io.legado.app.R
import io.legado.app.base.BaseFragment
import io.legado.app.data.entities.BookSource
import io.legado.app.lib.theme.ATH
import io.legado.app.ui.explore.ExploreShowActivity
import io.legado.app.utils.startActivity
import kotlinx.android.synthetic.main.fragment_find_book.*
import kotlinx.android.synthetic.main.view_title_bar.*
@ -48,4 +50,12 @@ class FindBookFragment : BaseFragment(R.layout.fragment_find_book),
override fun scrollTo(pos: Int) {
rv_find.scrollToPosition(pos)
}
override fun openExplore(sourceUrl: String, title: String, exploreUrl: String) {
startActivity<ExploreShowActivity>(
Pair("exploreName", title),
Pair("sourceUrl", sourceUrl),
Pair("exploreUrl", exploreUrl)
)
}
}
Loading…
Cancel
Save