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

Commit

Permalink
Merge branch 'main' into laurislopata/upload-image
Browse files Browse the repository at this point in the history
  • Loading branch information
laurislopata authored Apr 19, 2022
2 parents 221cf77 + 7529331 commit e06de9d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import ch.sdp.vibester.R
Expand Down Expand Up @@ -43,6 +42,7 @@ class GameEndingActivityTest {
private var incArray: ArrayList<String> = arrayListOf()
private var statNames: ArrayList<String> = arrayListOf()
private var statRes: ArrayList<String> = arrayListOf()
private var wName = "Winner"


@Test
Expand Down Expand Up @@ -130,4 +130,9 @@ class GameEndingActivityTest {

intended(hasComponent(IncorrectSongsActivity::class.java.name))
}

@Test
fun winnerTextIsVisible() {
onView(withId(R.id.winnerText)).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}
}
12 changes: 3 additions & 9 deletions app/src/main/java/ch/sdp/vibester/activity/GameEndingActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.Window
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import ch.sdp.vibester.R
Expand Down Expand Up @@ -46,12 +47,9 @@ class GameEndingActivity : AppCompatActivity() {

if (intent.hasExtra("Winner Name")) {
val winner = intent.getStringExtra("Winner Name")
// FIXME: commented until I get the winner panel to work without crashing the app
/*
if (winner!=null) {
findViewById<TextView>(R.id.winnerText).text="And the winner is... $winner!"
} else {findViewById<TextView>(R.id.winnerText).text="Nobody won this game!"}
*/
}


Expand Down Expand Up @@ -105,12 +103,8 @@ class GameEndingActivity : AppCompatActivity() {
playerNameView.text = statPlayerText
}

// FIXME: commented until I get the winner panel to work without crashing the app
/*
fun hideWinnerPanel(view: View) {
findViewById<TextView>(R.id.winnerPanel).visibility=View.INVISIBLE
}
*/


fun goToIncorrectlyGuessedSongs(view: View) {
val intent = Intent(this, IncorrectSongsActivity::class.java)
intent.putExtra("nb_false", nbIncorrectSongs)
Expand Down
18 changes: 17 additions & 1 deletion app/src/main/res/layout/activity_game_ending_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
<TextView
android:id="@+id/end_player_name"
android:layout_width="251dp"
android:layout_height="52dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="519dp"
android:fontFamily="monospace"
android:text="@string/game_end__player_name"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/winnerText"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -188,6 +190,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/end_stat_table" />

<TextView
android:id="@+id/winnerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:fontFamily="monospace"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/end_go_to_inc" />


</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
<string name="game_lyrics">Local Lyrics</string>
<string name="profile_username">Profile Username</string>
<string name="search_users">SEARCH USERS</string>

<string name="no_lyrics_found">No lyrics found, try the next song</string>
<string name="correct_message">%1$d Well Done!</string>
<string name="wrong_message">Sadly you\'re wrong</string>
Expand Down

0 comments on commit e06de9d

Please sign in to comment.