This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
margaux/artwork-on-answer #256
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,21 +7,19 @@ 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 | ||
|
||
|
||
|
||
class BuzzerScreenActivity : GameActivity() { | ||
|
||
private val MAX_N_PLAYERS = 4 | ||
private val NO_BUZZER_PRESSED = -1 | ||
private val artworkDim = 200 | ||
private val noBuzzerPressed = -1 | ||
private val buzzersToRows:HashMap<Int, Int> = initHashmap() | ||
private val rowsIdArray = ArrayList(buzzersToRows.values) | ||
private val buzIds = ArrayList(buzzersToRows.keys) | ||
|
@@ -37,7 +35,7 @@ class BuzzerScreenActivity : GameActivity() { | |
buzzersToRows.put(R.id.buzzer_3, R.id.row_3) | ||
return buzzersToRows | ||
} | ||
var pressedBuzzer = NO_BUZZER_PRESSED | ||
var pressedBuzzer = noBuzzerPressed | ||
|
||
private fun setPressed(id: Int) { | ||
pressedBuzzer = id | ||
|
@@ -114,10 +112,10 @@ class BuzzerScreenActivity : GameActivity() { | |
private fun startRound(ctx: Context, gameManager: BuzzerGameManager) { | ||
gameIsOn = true | ||
findViewById<LinearLayout>(R.id.answer).visibility=View.INVISIBLE | ||
|
||
// fetch song and initialise answerText. We'll see later for the image | ||
val title = gameManager.getCurrentSong().getTrackName() | ||
findViewById<TextView>(R.id.answerText).text=title | ||
val artist = gameManager.getCurrentSong().getArtistName() | ||
findViewById<TextView>(R.id.songTitle).text= "$title - $artist" | ||
Glide.with(ctx).load(gameManager.getCurrentSong().getArtworkUrl()).override(artworkDim, artworkDim).into(findViewById(R.id.songArtwork)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I have never heard of that Library. After having a look on internet, it may be great to use it everywhere. I will check later in my refactor if it is worth it or not. |
||
gameManager.playSong() | ||
checkRunnable() | ||
barTimer(findViewById(R.id.progressBarBuzzer), ctx, gameManager) | ||
|
@@ -260,7 +258,7 @@ class BuzzerScreenActivity : GameActivity() { | |
if (gameManager.playingMediaPlayer()) { | ||
gameManager.stopMediaPlayer() | ||
} | ||
setPressed(NO_BUZZER_PRESSED) // reset the buzzer | ||
setPressed(noBuzzerPressed) // reset the buzzer | ||
gameManager.setNextSong() | ||
startRound(ctx, gameManager) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have no more limitations on the maximum number of players?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the limitation to 4 players is still there, but this val was only used in a check before I figured out how to directly fetch the player names from the intent, so it's not useful anymore.