Иван před 1 týdnem
rodič
revize
281281e444

+ 2 - 0
Project/app/build.gradle.kts

@@ -76,4 +76,6 @@ dependencies {
     implementation(libs.functions.kt)
     implementation(libs.ktor.client.android)
 
+    implementation(libs.androidx.navigation.compose)
+
 }

+ 22 - 21
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/MainActivity.kt

@@ -6,12 +6,18 @@ import androidx.activity.compose.setContent
 import androidx.activity.enableEdgeToEdge
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.MaterialTheme
 import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Surface
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.tooling.preview.Preview
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.compose.rememberNavController
 import com.example.mygymapp.ui.theme.MyGymAppTheme
+import com.example.mygymapp.view.mainActivity.components.StartScreen
 
 class MainActivity : ComponentActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
@@ -19,29 +25,24 @@ class MainActivity : ComponentActivity() {
         enableEdgeToEdge()
         setContent {
             MyGymAppTheme {
-                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
-                    Greeting(
-                        name = "Android",
-                        modifier = Modifier.padding(innerPadding)
-                    )
+                Surface(
+                    modifier = Modifier.fillMaxSize(),
+                    color = MaterialTheme.colorScheme.background
+                ) {
+                    val navController = rememberNavController()
+                    NavHost(
+                        navController = navController,
+                        startDestination = "start_screen"
+                    ){
+                        composable("start_screen") {
+                            StartScreen()
+                        }
+                    }
+
                 }
-            }
-        }
-    }
-}
 
-@Composable
-fun Greeting(name: String, modifier: Modifier = Modifier) {
-    Text(
-        text = "Hello $name!",
-        modifier = modifier
-    )
-}
 
-@Preview(showBackground = true)
-@Composable
-fun GreetingPreview() {
-    MyGymAppTheme {
-        Greeting("Android")
+            }
+        }
     }
 }

+ 4 - 4
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/MainViewModel.kt

@@ -18,9 +18,9 @@ class MainViewModel:ViewModel() {
                 }
                 println(user.toString())
                 println(Constants.supabase.auth.currentUserOrNull()!!.id)
-                println("Success")
+                println("Authorization was successful")
             } catch (e: Exception) {
-                println("Error")
+                println("Authorization unknown error")
                 println(e.message.toString())
             }
         }
@@ -34,10 +34,10 @@ class MainViewModel:ViewModel() {
                 }
                 println(user.toString())
                 println(Constants.supabase.auth.currentUserOrNull()!!.id)
-                println("Success")
+                println("Registration was successful")
             }
             catch (e: Exception) {
-                println("Error")
+                println("Registration unknown error")
                 println(e.message.toString())
             }
 

+ 29 - 0
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/components/StartScreen.kt

@@ -0,0 +1,29 @@
+package com.example.mygymapp.view.mainActivity.components
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavController
+
+@Composable
+fun StartScreen()
+{
+    Column(
+        Modifier.padding(top = 30.dp, start = 15.dp, end = 15.dp),
+        verticalArrangement = Arrangement.Top,
+        horizontalAlignment = Alignment.CenterHorizontally
+
+    ) {
+        Text(
+            text = "MyGym", fontSize = 30.sp, color = Color(0xFF000000),
+            modifier = Modifier.padding(top = 100.dp, bottom = 20.dp, start = 15.dp)
+        )
+    }
+}

+ 3 - 1
Project/gradle/libs.versions.toml

@@ -1,5 +1,5 @@
 [versions]
-agp = "8.5.2"
+agp = "8.6.1"
 authKt = "3.0.1"
 bom = "2.6.1"
 kotlin = "2.0.0"
@@ -11,10 +11,12 @@ ktorClientAndroid = "3.0.0"
 lifecycleRuntimeKtx = "2.8.7"
 activityCompose = "1.9.3"
 composeBom = "2024.10.01"
+navigationCompose = "2.8.3"
 postgrestKt = "3.0.1"
 
 [libraries]
 androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
 auth-kt = { module = "io.github.jan-tennert.supabase:auth-kt", version.ref = "authKt" }
 bom = { module = "io.github.jan-tennert.supabase:bom", version.ref = "bom" }
 functions-kt = { module = "io.github.jan-tennert.supabase:functions-kt", version.ref = "authKt" }