pull/49/head
kunfei 5 years ago
parent e565085979
commit 9729b111b3
  1. 3
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  2. 3
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  3. 4
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt
  4. 6
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceDialog.kt

@ -225,9 +225,6 @@ class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_boo
} }
} }
override val curOrigin: String?
get() = viewModel.bookData.value?.origin
override val oldBook: Book? override val oldBook: Book?
get() = viewModel.bookData.value get() = viewModel.bookData.value

@ -330,9 +330,6 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
return ReadBook.chapterSize return ReadBook.chapterSize
} }
override val curOrigin: String?
get() = ReadBook.book?.origin
override val oldBook: Book? override val oldBook: Book?
get() = ReadBook.book get() = ReadBook.book

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

@ -135,16 +135,14 @@ class ChangeSourceDialog : DialogFragment(),
dismiss() dismiss()
} }
override fun curOrigin(): String { override val bookUrl: String?
return callBack?.curOrigin ?: "" get() = callBack?.oldBook?.bookUrl
}
override fun adapter(): ChangeSourceAdapter { override fun adapter(): ChangeSourceAdapter {
return changeSourceAdapter return changeSourceAdapter
} }
interface CallBack { interface CallBack {
val curOrigin: String?
val oldBook: Book? val oldBook: Book?
fun changeTo(book: Book) fun changeTo(book: Book)
} }

Loading…
Cancel
Save