diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 8fabff5a9..7d7ec2eaf 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 746f31250..6300854ca 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,6 +3,11 @@
-
+
diff --git a/app/src/androidTest/java/ch/sdp/vibester/GameSetupScreenTest.kt b/app/src/androidTest/java/ch/sdp/vibester/GameSetupScreenTest.kt
new file mode 100644
index 000000000..81c7dc4fb
--- /dev/null
+++ b/app/src/androidTest/java/ch/sdp/vibester/GameSetupScreenTest.kt
@@ -0,0 +1,115 @@
+package ch.sdp.vibester
+
+import android.widget.AdapterView
+import androidx.test.espresso.Espresso
+import androidx.test.espresso.Espresso.onData
+import androidx.test.espresso.action.ViewActions
+import androidx.test.espresso.intent.Intents
+import androidx.test.espresso.intent.matcher.IntentMatchers
+import androidx.test.espresso.matcher.ViewMatchers
+import androidx.test.ext.junit.rules.ActivityScenarioRule
+import androidx.test.espresso.intent.Intents.intended
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.ViewAssertion
+import androidx.test.espresso.action.ViewActions.click
+import androidx.test.espresso.assertion.ViewAssertions.matches
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.espresso.intent.matcher.IntentMatchers.*
+import androidx.test.espresso.matcher.ViewMatchers.withSpinnerText
+import org.hamcrest.Matchers
+import org.junit.After
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+
+class GameSetupScreenTest {
+
+ @get: Rule
+ val activityRule = ActivityScenarioRule(GameSetupScreen::class.java)
+
+ @Before
+ fun setUp() {
+ Intents.init()
+ }
+
+ @After
+ fun clean() {
+ Intents.release()
+ }
+
+ @Test
+ fun checkDefaultSelect() {
+ onView(withId(R.id.nb_player_spinner)).check(matches(withSpinnerText("One")))
+ }
+
+ @Test
+ fun checkCustomSelectOne() {
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(0).perform(click())
+ onView(withId(R.id.nb_player_spinner)).check(matches(withSpinnerText("One")))
+ }
+
+ @Test
+ fun checkCustomSelectTwo() {
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(1).perform(click())
+ onView(withId(R.id.nb_player_spinner)).check(matches(withSpinnerText("Two")))
+ }
+
+ @Test
+ fun checkCustomSelectThree() {
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(2).perform(click())
+ onView(withId(R.id.nb_player_spinner)).check(matches(withSpinnerText("Three")))
+ }
+
+ @Test
+ fun checkCustomSelectFour() {
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(3).perform(click())
+ onView(withId(R.id.nb_player_spinner)).check(matches(withSpinnerText("Four")))
+ }
+
+ @Test
+ fun checkIntentOnProceedDefault() { //FILLER TEST
+ onView(withId(R.id.nb_players_selected)).perform(click())
+ intended(hasComponent(WelcomeScreen::class.java.name))
+ intended(hasExtra("Number of players", "One"))
+ }
+
+ @Test
+ fun checkIntentOnProceedOne() { //FILLER TEST
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(0).perform(click())
+ onView(withId(R.id.nb_players_selected)).perform(click())
+ intended(hasComponent(WelcomeScreen::class.java.name))
+ intended(hasExtra("Number of players", "One"))
+ }
+
+ @Test
+ fun checkIntentOnProceedTwo() { //FILLER TEST
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(1).perform(click())
+ onView(withId(R.id.nb_players_selected)).perform(click())
+ intended(hasComponent(WelcomeScreen::class.java.name))
+ intended(hasExtra("Number of players", "Two"))
+ }
+
+ @Test
+ fun checkIntentOnProceedThree() { //FILLER TEST
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(2).perform(click())
+ onView(withId(R.id.nb_players_selected)).perform(click())
+ intended(hasComponent(WelcomeScreen::class.java.name))
+ intended(hasExtra("Number of players", "Three"))
+ }
+
+ @Test
+ fun checkIntentOnProceedFour() { //FILLER TEST
+ onView(withId(R.id.nb_player_spinner)).perform(click())
+ onData(Matchers.anything()).atPosition(3).perform(click())
+ onView(withId(R.id.nb_players_selected)).perform(click())
+ intended(hasComponent(WelcomeScreen::class.java.name))
+ intended(hasExtra("Number of players", "Four"))
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/ch/sdp/vibester/MainActivityTest.kt b/app/src/androidTest/java/ch/sdp/vibester/MainActivityTest.kt
index 13236e1c1..2ac56d0b8 100644
--- a/app/src/androidTest/java/ch/sdp/vibester/MainActivityTest.kt
+++ b/app/src/androidTest/java/ch/sdp/vibester/MainActivityTest.kt
@@ -49,5 +49,10 @@ class MainActivityTest {
intended(hasComponent(ScoreBoardActivity::class.qualifiedName))
}
+ @Test
+ fun checkIntentOnWelcome(){ //FILLER TESTING
+ onView(withId(R.id.placeholder_welcome)).perform(click())
+ intended(hasComponent(WelcomeScreen::class.qualifiedName))
+ }
}
\ No newline at end of file
diff --git a/app/src/androidTest/java/ch/sdp/vibester/WelcomeScreenTest.kt b/app/src/androidTest/java/ch/sdp/vibester/WelcomeScreenTest.kt
new file mode 100644
index 000000000..7b8ae386f
--- /dev/null
+++ b/app/src/androidTest/java/ch/sdp/vibester/WelcomeScreenTest.kt
@@ -0,0 +1,70 @@
+package ch.sdp.vibester
+
+import androidx.test.espresso.intent.Intents.intended
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.action.ViewActions.click
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.espresso.intent.Intents
+import androidx.test.ext.junit.rules.ActivityScenarioRule
+import androidx.test.espresso.intent.matcher.IntentMatchers.*
+import ch.sdp.vibester.scoreboard.ScoreBoardActivity
+import org.junit.After
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+
+class WelcomeScreenTest {
+ @get: Rule
+ val activityRule = ActivityScenarioRule(WelcomeScreen::class.java)
+
+ @Before
+ fun setUp() {
+ Intents.init()
+ }
+
+ @After
+ fun clean() {
+ Intents.release()
+ }
+
+ @Test
+ fun checkIntentOnPlay(){
+ onView(withId(R.id.welcome_play)).perform(click())
+ intended(hasComponent(GameSetupScreen::class.java.name))
+ }
+
+ @Test
+ fun checkIntentOnProfile(){ //FILLER TESTING
+ onView(withId(R.id.welcome_profile)).perform(click())
+ intended(hasComponent(GameSetupScreen::class.java.name))
+ }
+
+ @Test
+ fun checkIntentOnScoreboard(){
+ onView(withId(R.id.welcome_scoreboard)).perform(click())
+ intended(hasComponent(ScoreBoardActivity::class.java.name))
+ }
+
+ @Test
+ fun checkIntentOnListen(){ //FILLER TESTING
+ onView(withId(R.id.welcome_listen)).perform(click())
+ intended(hasComponent(GameSetupScreen::class.java.name))
+ }
+
+ @Test
+ fun checkIntentOnSettings(){ //FILLER TESTING
+ onView(withId(R.id.welcome_settings)).perform(click())
+ intended(hasComponent(GameSetupScreen::class.java.name))
+ }
+
+ /*
+ * Belongs to a previously implemented button, taken out for UI purposes.
+ * Might bring it back, thus leaving the code for now.
+ */
+
+ /*@Test
+ fun checkIntentOnLogin(){ //FILLER TESTING
+ onView(withId(R.id.welcome_login)).perform(click())
+ intended(hasComponent(GameSetupScreen::class.java.name))
+ }*/
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2b510bf04..c87538314 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -12,12 +12,18 @@
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication">
+
+
diff --git a/app/src/main/java/ch/sdp/vibester/GameSetupScreen.kt b/app/src/main/java/ch/sdp/vibester/GameSetupScreen.kt
new file mode 100644
index 000000000..f59be4536
--- /dev/null
+++ b/app/src/main/java/ch/sdp/vibester/GameSetupScreen.kt
@@ -0,0 +1,41 @@
+package ch.sdp.vibester
+
+import android.content.Intent
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.view.View
+import android.widget.AdapterView
+import android.widget.ArrayAdapter
+import android.widget.Spinner
+import android.widget.Toast
+
+class GameSetupScreen : AppCompatActivity(), AdapterView.OnItemSelectedListener {
+ var text = "One"
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_game_setup_screen)
+
+ val spinner: Spinner = findViewById(R.id.nb_player_spinner)
+ ArrayAdapter.createFromResource(
+ this,
+ R.array.nb_players,
+ android.R.layout.simple_spinner_item
+ ).also {
+ adapter -> adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
+ spinner.adapter = adapter
+ spinner.onItemSelectedListener = this
+ }
+ }
+
+ override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
+ text = parent.getItemAtPosition(position).toString()
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>) {text = "One"}
+
+ fun proceedToGame(view: View) { //FILLER INTENT
+ val intent = Intent(this, WelcomeScreen::class.java)
+ intent.putExtra("Number of players", text)
+ startActivity(intent)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/ch/sdp/vibester/MainActivity.kt b/app/src/main/java/ch/sdp/vibester/MainActivity.kt
index 24e7914b1..b606a595a 100644
--- a/app/src/main/java/ch/sdp/vibester/MainActivity.kt
+++ b/app/src/main/java/ch/sdp/vibester/MainActivity.kt
@@ -2,6 +2,7 @@ package ch.sdp.vibester
import android.content.Intent
import android.os.Bundle
+import android.view.View
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
@@ -31,4 +32,9 @@ class MainActivity : AppCompatActivity() {
startActivity(scoreboardIntent)
}
}
+
+ fun switchToWelcome(view: View) {
+ val intent = Intent(this, WelcomeScreen::class.java)
+ startActivity(intent)
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/ch/sdp/vibester/WelcomeScreen.kt b/app/src/main/java/ch/sdp/vibester/WelcomeScreen.kt
new file mode 100644
index 000000000..fc3fa6c87
--- /dev/null
+++ b/app/src/main/java/ch/sdp/vibester/WelcomeScreen.kt
@@ -0,0 +1,48 @@
+package ch.sdp.vibester
+
+import android.content.Intent
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.view.View
+import ch.sdp.vibester.scoreboard.ScoreBoardActivity
+
+class WelcomeScreen : AppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_welcome_screen)
+ }
+
+ private fun sendDirectIntent(arg: Class<*>?) {
+ val intent = Intent(this, arg)
+ startActivity(intent)
+ }
+
+ fun switchToPlay(view: View) {
+ sendDirectIntent(GameSetupScreen::class.java)
+ }
+
+ fun switchToProfile(view: View) { //FILLER INTENT
+ sendDirectIntent(GameSetupScreen::class.java)
+ }
+
+ fun switchToScoreboard(view: View) {
+ sendDirectIntent(ScoreBoardActivity::class.java)
+ }
+
+ fun switchToListen(view: View) { //FILLER INTENT
+ sendDirectIntent(GameSetupScreen::class.java)
+ }
+
+ fun switchToSettings(view: View) { //FILLER INTENT
+ sendDirectIntent(GameSetupScreen::class.java)
+ }
+
+ /*
+ * Belongs to a previously implemented button, taken out for UI purposes.
+ * Might bring it back, thus leaving the code for now.
+ */
+
+ /*fun switchToLogin(view: View) { //FILLER INTENT
+ sendDirectIntent(GameSetupScreen::class.java)
+ }*/
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_game_setup_screen.xml b/app/src/main/res/layout/activity_game_setup_screen.xml
new file mode 100644
index 000000000..392d882f7
--- /dev/null
+++ b/app/src/main/res/layout/activity_game_setup_screen.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 6af4dfeb1..082106ddc 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -50,4 +50,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.653" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_welcome_screen.xml b/app/src/main/res/layout/activity_welcome_screen.xml
new file mode 100644
index 000000000..7855b05cd
--- /dev/null
+++ b/app/src/main/res/layout/activity_welcome_screen.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c34b07ed0..bb12acab2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,4 +5,21 @@
Enter
Enter
S C O R E B O A R D
+ Please choose the number of players in your game
+ PROCEED
+ WELCOME SCREEN
+ app_logo
+ Welcome to Vibester!
+ PLAY A GAME
+ PROFILE
+ SCOREBOARD
+ LISTEN TO MUSIC
+ SETTINGS
+
+
+ - One
+ - Two
+ - Three
+ - Four
+
\ No newline at end of file