add startActivity onClick on item of boardsList
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Raffaele Mignone 2019-12-30 15:33:27 +01:00
parent 842573ece9
commit 2b060f7d38
Signed by: norangebit
GPG Key ID: F5255658CB220573

View File

@ -1,6 +1,7 @@
package it.unisannio.ding.ids.wedroid.app.view.adapter package it.unisannio.ding.ids.wedroid.app.view.adapter
import android.content.Context import android.content.Context
import android.content.Intent
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -33,14 +34,21 @@ class BoardsListAdapter internal constructor(
override fun onBindViewHolder(holder: BoardViewHolder, position: Int) { override fun onBindViewHolder(holder: BoardViewHolder, position: Int) {
val board = boards[position] val board = boards[position]
holder.itemView.setOnClickListener {
// TODO start board activity
}
holder.boardTitle.text = board.title holder.boardTitle.text = board.title
holder.itemView.setOnClickListener {
val intent = Intent(it.context, TODO())
intent.putExtra(BOARD_ID, board.id)
it.context.startActivity(intent)
}
} }
internal fun setBoards(boards: List<Board>) { internal fun setBoards(boards: List<Board>) {
this.boards = boards this.boards = boards
notifyDataSetChanged() notifyDataSetChanged()
} }
companion object {
const val BOARD_ID = "BOARD_ID"
}
} }