diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index a60f2b7..f77bd0c 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -51,6 +51,9 @@ android {
dependencies {
+ implementation("androidx.navigation:navigation-compose:2.7.4")
+ implementation("androidx.compose.material:material:1.5.4")
+
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
implementation("androidx.activity:activity-compose:1.7.0")
@@ -58,7 +61,7 @@ dependencies {
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
- implementation("androidx.compose.material3:material3")
+ //implementation("androidx.compose.material3:material3")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
diff --git a/app/src/main/java/com/example/labwork/MainActivity.kt b/app/src/main/java/com/example/labwork/MainActivity.kt
index 8f3b4a1..7d9fbb4 100644
--- a/app/src/main/java/com/example/labwork/MainActivity.kt
+++ b/app/src/main/java/com/example/labwork/MainActivity.kt
@@ -4,12 +4,10 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.MaterialTheme
-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 com.example.labwork.button_navigation.MainScreen
import com.example.labwork.ui.theme.LabWorkTheme
class MainActivity : ComponentActivity() {
@@ -17,30 +15,8 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
setContent {
LabWorkTheme {
- // A surface container using the 'background' color from the theme
- Surface(
- modifier = Modifier.fillMaxSize(),
- color = MaterialTheme.colorScheme.background
- ) {
- Greeting("Android")
- }
+ MainScreen()
}
}
}
}
-
-@Composable
-fun Greeting(name: String, modifier: Modifier = Modifier) {
- Text(
- text = "Hello $name!",
- modifier = modifier
- )
-}
-
-@Preview(showBackground = true)
-@Composable
-fun GreetingPreview() {
- LabWorkTheme {
- Greeting("Android")
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/labwork/button_navigation/MainScreen.kt b/app/src/main/java/com/example/labwork/button_navigation/MainScreen.kt
new file mode 100644
index 0000000..b4409e4
--- /dev/null
+++ b/app/src/main/java/com/example/labwork/button_navigation/MainScreen.kt
@@ -0,0 +1,21 @@
+package com.example.labwork.button_navigation
+
+import android.annotation.SuppressLint
+
+import androidx.compose.material.Scaffold
+import androidx.compose.runtime.Composable
+import androidx.navigation.compose.rememberNavController
+
+@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
+@Composable
+fun MainScreen() {
+ val navController = rememberNavController()
+ Scaffold(
+ bottomBar = {
+ SlideNavigation(navController = navController)
+
+ }
+ ) {
+ SlideGraph(navHostController = navController)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/labwork/button_navigation/Screens.kt b/app/src/main/java/com/example/labwork/button_navigation/Screens.kt
new file mode 100644
index 0000000..bb4ffa5
--- /dev/null
+++ b/app/src/main/java/com/example/labwork/button_navigation/Screens.kt
@@ -0,0 +1,23 @@
+package com.example.labwork.button_navigation
+
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.wrapContentHeight
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+
+@Composable
+fun ScreenInfo() {
+ Text(
+ modifier = Modifier.fillMaxSize().wrapContentHeight(),
+ text = "Тут будет главный экран..."
+ )
+}
+
+@Composable
+fun ScreenProfile() {
+ Text(
+ modifier = Modifier.fillMaxSize().wrapContentHeight(),
+ text = "Тут будет профиль экран..."
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/labwork/button_navigation/SlideGraph.kt b/app/src/main/java/com/example/labwork/button_navigation/SlideGraph.kt
new file mode 100644
index 0000000..e1a25a7
--- /dev/null
+++ b/app/src/main/java/com/example/labwork/button_navigation/SlideGraph.kt
@@ -0,0 +1,22 @@
+package com.example.labwork.button_navigation
+
+
+import androidx.compose.runtime.Composable
+import androidx.navigation.NavHostController
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+
+
+@Composable
+fun SlideGraph(
+ navHostController: NavHostController
+) {
+ NavHost(navController = navHostController, startDestination = "Profile"){
+ composable("Profile"){
+ ScreenProfile()
+ }
+ composable("Info"){
+ ScreenInfo()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/labwork/button_navigation/SlideItem.kt b/app/src/main/java/com/example/labwork/button_navigation/SlideItem.kt
new file mode 100644
index 0000000..b76ad34
--- /dev/null
+++ b/app/src/main/java/com/example/labwork/button_navigation/SlideItem.kt
@@ -0,0 +1,8 @@
+package com.example.labwork.button_navigation
+
+import com.example.labwork.R
+
+sealed class SlideItem(val title: String, val iconId: Int, val route: String){
+ object ScreenInfo: SlideItem("Информация", R.drawable.baseline_info,"Info" )
+ object ScreenProfile: SlideItem("Профиль", R.drawable.baseline_account_circle,"Profile" )
+}
diff --git a/app/src/main/java/com/example/labwork/button_navigation/SlideNavigation.kt b/app/src/main/java/com/example/labwork/button_navigation/SlideNavigation.kt
new file mode 100644
index 0000000..017ad5c
--- /dev/null
+++ b/app/src/main/java/com/example/labwork/button_navigation/SlideNavigation.kt
@@ -0,0 +1,53 @@
+package com.example.labwork.button_navigation
+
+import androidx.compose.material.BottomNavigation
+import androidx.compose.material.BottomNavigationItem
+import androidx.compose.material.Icon
+import androidx.compose.material.SnackbarDefaults.backgroundColor
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavController
+import androidx.navigation.compose.currentBackStackEntryAsState
+
+@Composable
+fun SlideNavigation(
+ navController: NavController
+) {
+ val listItems = listOf(
+ SlideItem.ScreenInfo,
+ SlideItem.ScreenProfile
+ )
+
+ BottomNavigation(
+ backgroundColor = Color.White
+ ) {
+ val backStackEntry by navController.currentBackStackEntryAsState()
+ val currentRout = backStackEntry?.destination?.route
+ listItems.forEach { item ->
+ BottomNavigationItem(
+ selected = currentRout == item.route,
+ onClick = {
+ navController.navigate(item.route)
+ },
+ icon = {
+ Icon(
+ painter = painterResource(id = item.iconId),
+ contentDescription = "Icon"
+ )
+ },
+ label = {
+ Text(
+ text = item.title,
+ fontSize = 9.sp
+ )
+ },
+ selectedContentColor = Color.Blue,
+ unselectedContentColor = Color.Gray
+ )
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/baseline_account_circle.xml b/app/src/main/res/drawable/baseline_account_circle.xml
new file mode 100644
index 0000000..93ce250
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_account_circle.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/baseline_info.xml b/app/src/main/res/drawable/baseline_info.xml
new file mode 100644
index 0000000..e0ecb40
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_info.xml
@@ -0,0 +1,5 @@
+
+
+