From b93ad0adef24a1f4316c341e1b6ee3fa1dab6e94 Mon Sep 17 00:00:00 2001 From: zwierski Date: Fri, 6 May 2022 14:54:53 +0200 Subject: [PATCH 1/4] add artwork to answer v1 --- .../vibester/activity/BuzzerScreenActivity.kt | 9 +++++++-- .../main/res/layout/activity_buzzer_screen.xml | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/ch/sdp/vibester/activity/BuzzerScreenActivity.kt b/app/src/main/java/ch/sdp/vibester/activity/BuzzerScreenActivity.kt index 30bfce9c9..3eeee7693 100644 --- a/app/src/main/java/ch/sdp/vibester/activity/BuzzerScreenActivity.kt +++ b/app/src/main/java/ch/sdp/vibester/activity/BuzzerScreenActivity.kt @@ -1,5 +1,6 @@ package ch.sdp.vibester.activity +import android.annotation.SuppressLint import android.content.Context import android.content.Intent import android.os.Bundle @@ -7,12 +8,12 @@ import android.view.Gravity import android.view.View import android.view.Window import android.widget.* -import androidx.appcompat.app.AppCompatActivity import ch.sdp.vibester.BuzzerScoreUpdater import ch.sdp.vibester.R import ch.sdp.vibester.helper.GameManager import ch.sdp.vibester.helper.BuzzerGameManager import ch.sdp.vibester.model.Song +import com.bumptech.glide.Glide import kotlin.collections.ArrayList import kotlin.collections.HashMap @@ -21,6 +22,7 @@ import kotlin.collections.HashMap class BuzzerScreenActivity : GameActivity() { private val MAX_N_PLAYERS = 4 + private val artwork_dim = 300 private val NO_BUZZER_PRESSED = -1 private val buzzersToRows:HashMap = initHashmap() private val rowsIdArray = ArrayList(buzzersToRows.values) @@ -111,13 +113,16 @@ class BuzzerScreenActivity : GameActivity() { * Function to set a new round. It includes reinitializing activity elements, * and playing new song for the round. */ + @SuppressLint("SetTextI18n") private fun startRound(ctx: Context, gameManager: BuzzerGameManager) { gameIsOn = true findViewById(R.id.answer).visibility=View.INVISIBLE // fetch song and initialise answerText. We'll see later for the image val title = gameManager.getCurrentSong().getTrackName() - findViewById(R.id.answerText).text=title + val artist = gameManager.getCurrentSong().getArtistName() + findViewById(R.id.songTitle).text= "$title - $artist" + Glide.with(ctx).load(gameManager.getCurrentSong().getArtworkUrl()).override(artwork_dim, artwork_dim).into(findViewById(R.id.songArtwork)) gameManager.playSong() checkRunnable() barTimer(findViewById(R.id.progressBarBuzzer), ctx, gameManager) diff --git a/app/src/main/res/layout/activity_buzzer_screen.xml b/app/src/main/res/layout/activity_buzzer_screen.xml index 65baa5e5a..a14a98ed1 100644 --- a/app/src/main/res/layout/activity_buzzer_screen.xml +++ b/app/src/main/res/layout/activity_buzzer_screen.xml @@ -70,10 +70,10 @@ + +