diff --git a/Android/app/src/main/AndroidManifest.xml b/Android/app/src/main/AndroidManifest.xml index 214188b..3f54b3e 100644 --- a/Android/app/src/main/AndroidManifest.xml +++ b/Android/app/src/main/AndroidManifest.xml @@ -21,5 +21,6 @@ + \ No newline at end of file diff --git a/Android/app/src/main/java/com/example/mathseduc/CreateLobbyActivity.kt b/Android/app/src/main/java/com/example/mathseduc/CreateLobbyActivity.kt new file mode 100644 index 0000000..267e16e --- /dev/null +++ b/Android/app/src/main/java/com/example/mathseduc/CreateLobbyActivity.kt @@ -0,0 +1,64 @@ +package com.example.mathseduc + +import android.content.Intent +import android.os.Bundle +import android.widget.* +import androidx.appcompat.app.AppCompatActivity +import com.example.mathseduc.controllers.ControllerChapter +import com.example.mathseduc.controllers.ControllerLobby +import com.example.mathseduc.models.Lobby +import org.json.JSONObject + + +class CreateLobbyActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_create_lobby) + + var spinnerChapter = findViewById(R.id.spinnerChapter) + + // Fetch chapters from API + val chaptersFromApi = ControllerChapter.getChapters() + + // Populate Spinner with fetched chapters + if (chaptersFromApi != null) { + val chapterNames = chaptersFromApi.map { it.name }.toTypedArray() + + val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, chapterNames) + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) + spinnerChapter.adapter = adapter + } + + val buttonCreateLobby = findViewById