Skip to content

Commit

Permalink
Merge pull request #150 from SDP-Rock-Paper-Scissors/fix_leaderboard_…
Browse files Browse the repository at this point in the history
…offline
  • Loading branch information
panadax authored May 31, 2022
2 parents 08ce3f3 + 5ff587f commit 0cddcbb
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,16 @@ class LeaderboardFragment : Fragment() {

private fun loadPlayersUI(itemView: View, players: List<LeaderBoardInfo>) {
val champions = players.take(3)
showPlayersPosition(itemView, players)
showChampions(itemView, champions)
showPlayersPosition(itemView, players)

}

private fun showChampions(itemView: View, championPlayers: List<LeaderBoardInfo>) {

itemView.findViewById<ImageView>(R.id.iv_champion1)
.load(championPlayers[0].userProfilePictureUrl)
itemView.findViewById<ImageView>(R.id.iv_champion2)
.load(championPlayers[1].userProfilePictureUrl)
itemView.findViewById<ImageView>(R.id.iv_champion3)
.load(championPlayers[2].userProfilePictureUrl)

val championImgViewList = listOf<ImageView>(itemView.findViewById(R.id.iv_champion1),itemView.findViewById(R.id.iv_champion2), itemView.findViewById(R.id.iv_champion3))
for ((i, championPlayer) in championPlayers.withIndex()) {
championImgViewList[i].load(championPlayer.userProfilePictureUrl)
}
}

private fun showPlayersPosition(
Expand Down

0 comments on commit 0cddcbb

Please sign in to comment.