remove left headers

This commit is contained in:
Li ZongYing
2023-12-20 14:55:39 +08:00
parent e6fa9a50db
commit 0285f1b3b1
15 changed files with 341 additions and 238 deletions
@@ -49,12 +49,12 @@ class CardPresenter(
}
override fun onBindViewHolder(viewHolder: ViewHolder, item: Any) {
val tv = item as TV
val tvViewModel = item as TVViewModel
val cardView = viewHolder.view as ImageCardView
cardView.titleText = tv.title
cardView.titleText = tvViewModel.title.value
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT)
cardView.tag = tv.videoUrl
cardView.tag = tvViewModel.videoUrl.value
// lifecycleScope.launch(Dispatchers.IO) {
// val videoThumbnail = tv.videoUrl?.let { getVideoThumbnail(it) }
@@ -83,17 +83,17 @@ class CardPresenter(
private fun updateCardBackgroundColor(view: ImageCardView) {
val currentTag = view.tag
lifecycleScope.launch(Dispatchers.IO) {
delay(1000)
if (view.isSelected && view.tag != null && currentTag == view.tag) {
val videoThumbnail = view.tag.toString().let { getVideoThumbnail(it) }
withContext(Dispatchers.Main) {
if (view.isSelected && currentTag == view.tag) {
view.mainImageView.setImageBitmap(videoThumbnail)
}
}
}
}
// lifecycleScope.launch(Dispatchers.IO) {
// delay(1000)
// if (view.isSelected && view.tag != null && currentTag == view.tag) {
// val videoThumbnail = view.tag.toString().let { getVideoThumbnail(it) }
// withContext(Dispatchers.Main) {
// if (view.isSelected && currentTag == view.tag) {
// view.mainImageView.setImageBitmap(videoThumbnail)
// }
// }
// }
// }
}
private fun getVideoThumbnail(url: String): Bitmap? {
@@ -112,7 +112,7 @@ class CardPresenter(
companion object {
private const val TAG = "CardPresenter"
private const val CARD_WIDTH = 313
private const val CARD_HEIGHT = 176
private const val CARD_WIDTH = 300
private const val CARD_HEIGHT = 169
}
}