feat: 优化代码

pull/105/head
kunfei 5 years ago
parent b4d2de8717
commit c2eaa3e34b
  1. 10
      app/src/main/java/io/legado/app/ui/download/DownloadAdapter.kt

@ -10,7 +10,6 @@ import io.legado.app.data.entities.BookChapter
import io.legado.app.service.help.Download import io.legado.app.service.help.Download
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) :
@ -53,14 +52,7 @@ class DownloadAdapter(context: Context, private val callBack: CallBack) :
} }
} }
tv_export.onClick { tv_export.onClick {
getItem(holder.layoutPosition)?.let { callBack.export(holder.layoutPosition)
val cacheSize = cacheChapters[it.bookUrl]?.size ?: 0
if (cacheSize < it.totalChapterNum) {
context.toast("未下载完成")
} else {
callBack.export(holder.layoutPosition)
}
}
} }
} }
} }

Loading…
Cancel
Save