Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Jwen/scoreboard documentation #47

Merged
merged 2 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/main/java/ch/sdp/vibester/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class MainActivity : AppCompatActivity() {
startActivity(greetingIntent)
}

// button to scoreboard
// FIXME: scoreboard enter button need to be move to the welcome screen
val btnScoreboard = findViewById<Button>(R.id.scoreboardButton)
val scoreboardIntent = Intent(this, ScoreBoardActivity::class.java)

Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/ch/sdp/vibester/scoreboard/Player.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package ch.sdp.vibester.scoreboard

/**
* Player class for scoreboard
*
* @param nik id of the player
* @param name name of the player
* @param photo profile photo of the player
* @param score score of the player
*/
data class Player (
val nik: Int = 0,
val name: String = "",
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/ch/sdp/vibester/scoreboard/PlayerAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ class PlayerAdapter(playersInit: List<Player>) : RecyclerView.Adapter<PlayerAdap
notifyDataSetChanged()
}

/**
* Customer ViewHolder class for PlayerAdapter
*/
inner class PlayerViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

/**
* @param player
* @param position position of the player
*/
fun bind(player: Player, position: Int) {
val newPosition = position + 1
itemView.findViewById<TextView>(R.id.tv_position).text = (newPosition).toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ScoreBoardActivity : AppCompatActivity() {
loadPlayers()
}

// temporary hard-coded list of players for display
private val players: List<Player> = listOf(
Player(111, "Brownie","https://images.app.goo.gl/yiPpy7JDRFaZRiAg9", 687 ),
Player(555, "Cheesecake", "https://images.app.goo.gl/REJnoWR2t3mi2kYJA", 678),
Expand Down