Browse Source

App: скрытие верхней панели

ПроваленкоЛН 1 week ago
parent
commit
43c47d22f6

+ 1 - 1
OscellaMobile/.idea/misc.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ExternalStorageConfigurationManager" enabled="true" />
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">

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

@@ -74,4 +74,6 @@ dependencies {
     implementation(libs.auth.kt)
     implementation(libs.ktor.client.android)
     implementation(libs.storage.kt)
+
+    implementation (libs.accompanist.systemuicontroller)
 }

+ 26 - 1
OscellaMobile/app/src/main/java/com/example/oscellamobile/screens/MainWindow.kt

@@ -2,21 +2,34 @@ package com.example.oscellamobile.screens
 
 import androidx.compose.foundation.Canvas
 import androidx.compose.foundation.Image
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.Row
 import androidx.compose.foundation.layout.Spacer
 import androidx.compose.foundation.layout.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.size
 import androidx.compose.foundation.layout.width
 import androidx.compose.material3.Icon
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.SideEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.geometry.Offset
 import androidx.compose.ui.graphics.Brush
 import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.drawscope.DrawScope
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.text.font.Font
 import androidx.compose.ui.text.font.FontFamily
@@ -24,11 +37,22 @@ import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
 import com.example.oscellamobile.R
+import com.google.accompanist.systemuicontroller.rememberSystemUiController
+import kotlinx.coroutines.delay
+
 
 @Composable
 fun MainWindow(navController: NavHostController) {
-    val kdamFontFamily = FontFamily(Font(R.font.kdam));
+    val systemUiController = rememberSystemUiController()
+
+    // Automatically hide the status bar when the composable is first displayed
+    LaunchedEffect(Unit) {
+        systemUiController.isStatusBarVisible = false // Hide the status bar by default
+        delay(5000) // Keep it visible for 5 seconds (if needed, you can adjust this)
+        systemUiController.isStatusBarVisible = false // Ensure it stays hidden
+    }
 
+    val kdamFontFamily = FontFamily(Font(R.font.kdam))
     Canvas(
         modifier = Modifier
             .fillMaxWidth()
@@ -45,6 +69,7 @@ fun MainWindow(navController: NavHostController) {
 
         drawRect(brush = gradient)
     }
+
     Column(
         modifier = Modifier
             .fillMaxWidth()

+ 1 - 0
OscellaMobile/app/src/main/res/values/themes.xml

@@ -2,4 +2,5 @@
 <resources>
 
     <style name="Theme.OscellaMobile" parent="android:Theme.Material.Light.NoActionBar" />
+
 </resources>

+ 2 - 0
OscellaMobile/gradle/libs.versions.toml

@@ -1,4 +1,5 @@
 [versions]
+accompanistSystemuicontroller = "0.36.0"
 agp = "8.5.1"
 bom = "3.0.1"
 kotlin = "1.9.0"
@@ -15,6 +16,7 @@ navigationCompose = "2.8.3"
 storageKt = "3.0.1"
 
 [libraries]
+accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanistSystemuicontroller" }
 androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
 auth-kt = { module = "io.github.jan-tennert.supabase:auth-kt" }
 bom = { module = "io.github.jan-tennert.supabase:bom", version.ref = "bom" }