pull/32/head
kunfei 5 years ago
parent 02164d24c7
commit f4a21709e5
  1. 4
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt
  2. 12
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceDialog.kt
  3. 2
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt

@ -20,7 +20,7 @@ class ChangeSourceAdapter(context: Context, val callBack: CallBack) :
this.onClick { callBack.changeTo(item) }
tv_origin.text = item.originName
tv_last.text = item.latestChapterTitle
if (callBack.curBookUrl() == item.bookUrl) {
if (callBack.curOrigin() == item.origin) {
iv_checked.visible()
} else {
iv_checked.invisible()
@ -34,6 +34,6 @@ class ChangeSourceAdapter(context: Context, val callBack: CallBack) :
interface CallBack {
fun changeTo(searchBook: SearchBook)
fun curBookUrl(): String
fun curOrigin(): String
}
}

@ -24,12 +24,12 @@ class ChangeSourceDialog : DialogFragment(),
companion object {
const val tag = "changeSourceDialog"
fun newInstance(name: String, author: String, bookUrl: String? = null): ChangeSourceDialog {
fun newInstance(name: String, author: String, origin: String): ChangeSourceDialog {
val changeSourceDialog = ChangeSourceDialog()
val bundle = Bundle()
bundle.putString("name", name)
bundle.putString("author", author)
bundle.putString("bookUrl", bookUrl)
bundle.putString("origin", origin)
changeSourceDialog.arguments = bundle
return changeSourceDialog
}
@ -53,8 +53,8 @@ class ChangeSourceDialog : DialogFragment(),
bundle.getString("author")?.let {
viewModel.author = it
}
bundle.getString("bookUrl")?.let {
viewModel.curBookUrl = it
bundle.getString("origin")?.let {
viewModel.curOrigin = it
}
}
tool_bar.inflateMenu(R.menu.search_view)
@ -127,8 +127,8 @@ class ChangeSourceDialog : DialogFragment(),
dismiss()
}
override fun curBookUrl(): String {
return viewModel.curBookUrl
override fun curOrigin(): String {
return viewModel.curOrigin
}
override fun adapter(): ChangeSourceAdapter {

@ -16,7 +16,7 @@ import org.jetbrains.anko.debug
class ChangeSourceViewModel(application: Application) : BaseViewModel(application) {
var callBack: CallBack? = null
var curBookUrl = ""
var curOrigin = ""
var name: String = ""
var author: String = ""
var screenKey: String = ""

Loading…
Cancel
Save