|
|
@ -18,7 +18,7 @@ import com.novel.read.utlis.GlideImageLoader |
|
|
|
import java.util.ArrayList |
|
|
|
import java.util.ArrayList |
|
|
|
|
|
|
|
|
|
|
|
class BookAdapter(private val mList: List<CollBookBean>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { |
|
|
|
class BookAdapter(private val mList: List<CollBookBean>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { |
|
|
|
private var mContext: Context? = null |
|
|
|
private lateinit var mContext: Context |
|
|
|
|
|
|
|
|
|
|
|
private var mClickListener: OnItemClickListener? = null |
|
|
|
private var mClickListener: OnItemClickListener? = null |
|
|
|
private var mEdit: Boolean = false |
|
|
|
private var mEdit: Boolean = false |
|
|
@ -35,9 +35,7 @@ class BookAdapter(private val mList: List<CollBookBean>) : RecyclerView.Adapter< |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): RecyclerView.ViewHolder { |
|
|
|
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): RecyclerView.ViewHolder { |
|
|
|
if (mContext == null) { |
|
|
|
|
|
|
|
mContext = viewGroup.context |
|
|
|
mContext = viewGroup.context |
|
|
|
} |
|
|
|
|
|
|
|
val view: View |
|
|
|
val view: View |
|
|
|
if (i == VALUE_ITEM) { |
|
|
|
if (i == VALUE_ITEM) { |
|
|
|
view = LayoutInflater.from(mContext).inflate(R.layout.rlv_item_book, viewGroup, false) |
|
|
|
view = LayoutInflater.from(mContext).inflate(R.layout.rlv_item_book, viewGroup, false) |
|
|
@ -61,7 +59,7 @@ class BookAdapter(private val mList: List<CollBookBean>) : RecyclerView.Adapter< |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
viewHolder.mIvGeng.visibility = View.GONE |
|
|
|
viewHolder.mIvGeng.visibility = View.GONE |
|
|
|
} |
|
|
|
} |
|
|
|
GlideImageLoader.displayCornerImage(mContext!!, mList[i].cover, viewHolder.mIvBook) |
|
|
|
GlideImageLoader.displayCornerImage(mContext, mList[i].cover, viewHolder.mIvBook) |
|
|
|
viewHolder.itemView.setOnClickListener { |
|
|
|
viewHolder.itemView.setOnClickListener { |
|
|
|
viewHolder.mIvCheck.isSelected = !mList[i].isSelect |
|
|
|
viewHolder.mIvCheck.isSelected = !mList[i].isSelect |
|
|
|
mList[i].isSelect = !mList[i].isSelect |
|
|
|
mList[i].isSelect = !mList[i].isSelect |
|
|
@ -88,7 +86,7 @@ class BookAdapter(private val mList: List<CollBookBean>) : RecyclerView.Adapter< |
|
|
|
viewHolder.mIvGeng.visibility = View.GONE |
|
|
|
viewHolder.mIvGeng.visibility = View.GONE |
|
|
|
} |
|
|
|
} |
|
|
|
GlideImageLoader.displayCornerImage( |
|
|
|
GlideImageLoader.displayCornerImage( |
|
|
|
mContext!!, |
|
|
|
mContext, |
|
|
|
mList[i].cover, |
|
|
|
mList[i].cover, |
|
|
|
viewHolder.mIvBook |
|
|
|
viewHolder.mIvBook |
|
|
|
) |
|
|
|
) |
|
|
@ -96,7 +94,7 @@ class BookAdapter(private val mList: List<CollBookBean>) : RecyclerView.Adapter< |
|
|
|
val intent = Intent(mContext, NovelReadActivity::class.java) |
|
|
|
val intent = Intent(mContext, NovelReadActivity::class.java) |
|
|
|
intent.putExtra(NovelReadActivity.EXTRA_IS_COLLECTED, true) |
|
|
|
intent.putExtra(NovelReadActivity.EXTRA_IS_COLLECTED, true) |
|
|
|
intent.putExtra(NovelReadActivity.EXTRA_COLL_BOOK, mList[i]) |
|
|
|
intent.putExtra(NovelReadActivity.EXTRA_COLL_BOOK, mList[i]) |
|
|
|
mContext!!.startActivity(intent) |
|
|
|
mContext.startActivity(intent) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|