|
|
@ -7,6 +7,7 @@ import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import kotlinx.android.synthetic.main.item_download.view.* |
|
|
|
import kotlinx.android.synthetic.main.item_download.view.* |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
|
|
|
|
import org.jetbrains.anko.toast |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DownloadAdapter(context: Context, private val callBack: CallBack) : |
|
|
|
class DownloadAdapter(context: Context, private val callBack: CallBack) : |
|
|
@ -36,7 +37,14 @@ class DownloadAdapter(context: Context, private val callBack: CallBack) : |
|
|
|
|
|
|
|
|
|
|
|
override fun registerListener(holder: ItemViewHolder) { |
|
|
|
override fun registerListener(holder: ItemViewHolder) { |
|
|
|
holder.itemView.tv_export.onClick { |
|
|
|
holder.itemView.tv_export.onClick { |
|
|
|
callBack.export(holder.layoutPosition) |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
|
|
|
|
val cacheSize = cacheChapters[it.bookUrl]?.size ?: 0 |
|
|
|
|
|
|
|
if (cacheSize < it.totalChapterNum) { |
|
|
|
|
|
|
|
context.toast("未下载完成") |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
callBack.export(holder.layoutPosition) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|