|
|
|
@ -34,22 +34,22 @@ class RemoteBookAdapter (context: Context, val callBack: CallBack) : |
|
|
|
|
payloads: MutableList<Any> |
|
|
|
|
) { |
|
|
|
|
binding.run { |
|
|
|
|
//Todo:需要判断书籍是否已经加入书架,来改变“下载”按钮的文本,暂时还没有比较好的方案 |
|
|
|
|
tvName.text = item.filename.substringBeforeLast(".") |
|
|
|
|
tvContentType.text = item.contentType |
|
|
|
|
tvSize.text = ConvertUtils.formatFileSize(item.size) |
|
|
|
|
tvDate.text = LocalDateTimeUtil.format(LocalDateTimeUtil.of(item.lastModify), "yyyy-MM-dd") |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun registerListener(holder: ItemViewHolder, binding: ItemRemoteBookBinding) { |
|
|
|
|
|
|
|
|
|
binding.btnDownload.setOnClickListener { |
|
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
|
callBack.addToBookshelf(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
|