|
|
|
@ -94,13 +94,21 @@ class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
|
|
|
|
|
|
private fun bindChange(binding: ItemSearchBinding, searchBook: SearchBook, bundle: Bundle) { |
|
|
|
|
binding.run { |
|
|
|
|
bundle.keySet().map { |
|
|
|
|
bundle.keySet().forEach { |
|
|
|
|
when (it) { |
|
|
|
|
"origins" -> bvOriginCount.setBadgeCount(searchBook.origins.size) |
|
|
|
|
"last" -> upLasted(binding, searchBook.latestChapterTitle) |
|
|
|
|
"intro" -> tvIntroduce.text = searchBook.trimIntro(context) |
|
|
|
|
"kind" -> upKind(binding, searchBook.getKindList()) |
|
|
|
|
"cover" -> ivCover.load(searchBook.coverUrl, searchBook.name, searchBook.author, false, searchBook.origin) |
|
|
|
|
"isInBookshelf" -> // todo 添加标志view |
|
|
|
|
callBack.isInBookshelf(searchBook.name, searchBook.author) |
|
|
|
|
"cover" -> ivCover.load( |
|
|
|
|
searchBook.coverUrl, |
|
|
|
|
searchBook.name, |
|
|
|
|
searchBook.author, |
|
|
|
|
false, |
|
|
|
|
searchBook.origin |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -128,7 +136,15 @@ class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否已经加入书架 |
|
|
|
|
*/ |
|
|
|
|
fun isInBookshelf(name: String, author: String): Boolean |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 显示书籍详情 |
|
|
|
|
*/ |
|
|
|
|
fun showBookInfo(name: String, author: String, bookUrl: String) |
|
|
|
|
} |
|
|
|
|
} |