|
|
@ -8,7 +8,7 @@ import io.legado.app.R |
|
|
|
import io.legado.app.base.BaseActivity |
|
|
|
import io.legado.app.base.BaseActivity |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.data.entities.ReadRecord |
|
|
|
import io.legado.app.data.entities.ReadRecordShow |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.lib.dialogs.noButton |
|
|
|
import io.legado.app.lib.dialogs.noButton |
|
|
|
import io.legado.app.lib.dialogs.okButton |
|
|
|
import io.legado.app.lib.dialogs.okButton |
|
|
@ -45,7 +45,7 @@ class ReadRecordActivity : BaseActivity(R.layout.activity_read_record) { |
|
|
|
withContext(Main) { |
|
|
|
withContext(Main) { |
|
|
|
tv_read_time.text = formatDuring(allTime) |
|
|
|
tv_read_time.text = formatDuring(allTime) |
|
|
|
} |
|
|
|
} |
|
|
|
val readRecords = App.db.readRecordDao().all |
|
|
|
val readRecords = App.db.readRecordDao().allShow |
|
|
|
withContext(Main) { |
|
|
|
withContext(Main) { |
|
|
|
adapter.setItems(readRecords) |
|
|
|
adapter.setItems(readRecords) |
|
|
|
} |
|
|
|
} |
|
|
@ -53,9 +53,13 @@ class ReadRecordActivity : BaseActivity(R.layout.activity_read_record) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inner class RecordAdapter(context: Context) : |
|
|
|
inner class RecordAdapter(context: Context) : |
|
|
|
SimpleRecyclerAdapter<ReadRecord>(context, R.layout.item_read_record) { |
|
|
|
SimpleRecyclerAdapter<ReadRecordShow>(context, R.layout.item_read_record) { |
|
|
|
|
|
|
|
|
|
|
|
override fun convert(holder: ItemViewHolder, item: ReadRecord, payloads: MutableList<Any>) { |
|
|
|
override fun convert( |
|
|
|
|
|
|
|
holder: ItemViewHolder, |
|
|
|
|
|
|
|
item: ReadRecordShow, |
|
|
|
|
|
|
|
payloads: MutableList<Any> |
|
|
|
|
|
|
|
) { |
|
|
|
holder.itemView.apply { |
|
|
|
holder.itemView.apply { |
|
|
|
tv_book_name.text = item.bookName |
|
|
|
tv_book_name.text = item.bookName |
|
|
|
tv_read_time.text = formatDuring(item.readTime) |
|
|
|
tv_read_time.text = formatDuring(item.readTime) |
|
|
@ -69,7 +73,7 @@ class ReadRecordActivity : BaseActivity(R.layout.activity_read_record) { |
|
|
|
alert(R.string.delete, R.string.sure_del) { |
|
|
|
alert(R.string.delete, R.string.sure_del) { |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
App.db.readRecordDao().delete(it) |
|
|
|
App.db.readRecordDao().deleteByName(it.bookName) |
|
|
|
initData() |
|
|
|
initData() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|