init: play

This commit is contained in:
Mylloon 2024-01-04 01:07:41 +01:00
parent 678582b562
commit 3fed81982c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 24 additions and 3 deletions

View file

@ -3,7 +3,6 @@ package fr.uparis.diamantkennel.memorisationapplication
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Arrangement
@ -113,7 +112,9 @@ fun HomeScreen(
ActionRow(context, model, navController)
Button(onClick = { Toast.makeText(context, "Start", Toast.LENGTH_SHORT).show() }) {
Button(
enabled = currentSelection != null,
onClick = { navController.navigate(PLAY) }) {
Text(text = context.getString(R.string.main_button_start), fontSize = 30.sp)
}

View file

@ -1,10 +1,20 @@
package fr.uparis.diamantkennel.memorisationapplication
import android.widget.Toast
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import fr.uparis.diamantkennel.memorisationapplication.ui.PlayViewModel
@Composable
fun PlayScreen(padding: PaddingValues, navController: NavController) {
fun PlayScreen(
padding: PaddingValues,
navController: NavController,
model: PlayViewModel = viewModel()
) {
val context = LocalContext.current
Toast.makeText(context, "Start", Toast.LENGTH_SHORT).show()
}

View file

@ -0,0 +1,10 @@
package fr.uparis.diamantkennel.memorisationapplication.ui
import android.app.Application
import androidx.lifecycle.AndroidViewModel
import fr.uparis.diamantkennel.memorisationapplication.MemoApplication
class PlayViewModel(application: Application) : AndroidViewModel(application) {
private val dao = (application as MemoApplication).database.memoDao()
}