Skip to content

Commit

Permalink
Fix PreviewScene data binding
Browse files Browse the repository at this point in the history
  • Loading branch information
xb2016 committed Aug 30, 2024
1 parent 998d7fb commit f4d3825
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,8 @@ class GalleryPreviewsScene : ToolbarScene() {
}

private class GalleryPreviewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var image: LoadImageView
var text: TextView

init {
image = itemView.findViewById(R.id.image)
text = itemView.findViewById(R.id.text)
}
var image: LoadImageView = itemView.findViewById(R.id.image)
var text: TextView = itemView.findViewById(R.id.text)
}

private inner class GetPreviewSetListener(
Expand Down Expand Up @@ -265,14 +260,11 @@ class GalleryPreviewsScene : ToolbarScene() {

@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: GalleryPreviewHolder, position: Int) {
if (null != mHelper) {
val preview = mHelper!!.getDataAtEx(position)
if (preview != null) {
preview.load(holder.image)
holder.text.text = (preview.position + 1).toString()
}
mHelper?.getDataAtEx(position)?.let {
it.load(holder.image)
holder.text.text = (it.position + 1).toString()
}
holder.itemView.setOnClickListener { onItemClick(position) }
holder.itemView.setOnClickListener { onItemClick(holder.bindingAdapterPosition) }
}

override fun getItemCount(): Int {
Expand Down

0 comments on commit f4d3825

Please sign in to comment.