diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..cde3e19
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c751a..74dd639 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,3 +1,4 @@
+
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index a51e0af..5651002 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -49,6 +49,7 @@ dependencies {
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
+ implementation(libs.androidx.navigation.compose)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
diff --git a/app/src/main/java/com/example/tvcontroller/MainActivity.kt b/app/src/main/java/com/example/tvcontroller/MainActivity.kt
index b9fac74..1cfe3c3 100644
--- a/app/src/main/java/com/example/tvcontroller/MainActivity.kt
+++ b/app/src/main/java/com/example/tvcontroller/MainActivity.kt
@@ -1,17 +1,33 @@
package com.example.tvcontroller
+import android.content.ContentValues.TAG
import android.os.Bundle
+import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
+import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.DateRange
+import androidx.compose.material.icons.filled.PlayArrow
+import androidx.compose.material.icons.filled.Settings
+import androidx.compose.material3.Icon
+import androidx.compose.material3.NavigationBar
+import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.Scaffold
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.NavHostController
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.compose.currentBackStackEntryAsState
+import androidx.navigation.compose.rememberNavController
import com.example.tvcontroller.ui.theme.TVControllerTheme
+import androidx.compose.runtime.getValue
+
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -19,11 +35,69 @@ class MainActivity : ComponentActivity() {
enableEdgeToEdge()
setContent {
TVControllerTheme {
- Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
- Greeting(
- name = "Android",
- modifier = Modifier.padding(innerPadding)
+ TvControllerApp()
+ }
+ }
+ }
+}
+
+@Composable
+fun TvControllerApp(
+ navController: NavHostController = rememberNavController()
+) {
+ val backStackEntry by navController.currentBackStackEntryAsState()
+ val currentScreen = Screens.valueOf(backStackEntry?.destination?.route ?: Screens.Camera.name)
+ Scaffold(modifier = Modifier.fillMaxSize(), bottomBar = {
+ NavigationBar {
+ NavigationBarItem(
+ onClick = { navController.navigate(Screens.Camera.name) },
+ icon = {
+ Icon(
+ Icons.Filled.PlayArrow,
+ contentDescription = "Camera"
)
+ },
+ label = { Text("Camera") },
+ selected = currentScreen == Screens.Camera
+ )
+ NavigationBarItem(
+ onClick = { navController.navigate(Screens.Remote.name) },
+ icon = {
+ Icon(
+ Icons.Filled.DateRange,
+ contentDescription = "Remote"
+ )
+ },
+ label = { Text("Remote") },
+ selected = currentScreen == Screens.Remote
+ )
+ NavigationBarItem(
+ onClick = { navController.navigate(Screens.Settings.name) },
+ icon = {
+ Icon(
+ Icons.Filled.Settings,
+ contentDescription = "Settings"
+ )
+ },
+ label = { Text("Settings") },
+ selected = currentScreen == Screens.Settings
+ )
+ }
+ }) { innerPadding ->
+ Column {
+ NavHost(
+ navController = navController,
+ startDestination = Screens.Camera.name,
+ modifier = Modifier.padding(innerPadding)
+ ) {
+ composable(route = Screens.Camera.name) {
+ CameraScreen()
+ }
+ composable(route = Screens.Remote.name) {
+ RemoteScreen()
+ }
+ composable(route = Screens.Settings.name) {
+ SettingsScreen()
}
}
}
@@ -31,17 +105,16 @@ class MainActivity : ComponentActivity() {
}
@Composable
-fun Greeting(name: String, modifier: Modifier = Modifier) {
- Text(
- text = "Hello $name!",
- modifier = modifier
- )
+fun CameraScreen(modifier: Modifier = Modifier) {
+ Text(text = "Camera Screen", modifier = modifier)
}
-@Preview(showBackground = true)
@Composable
-fun GreetingPreview() {
- TVControllerTheme {
- Greeting("Android")
- }
-}
\ No newline at end of file
+fun RemoteScreen(modifier: Modifier = Modifier) {
+ Text(text = "Remote Screen", modifier = modifier)
+}
+
+@Composable
+fun SettingsScreen(modifier: Modifier = Modifier) {
+ Text(text = "Settings Screen", modifier = modifier)
+}
diff --git a/app/src/main/java/com/example/tvcontroller/Screens.kt b/app/src/main/java/com/example/tvcontroller/Screens.kt
new file mode 100644
index 0000000..c466f07
--- /dev/null
+++ b/app/src/main/java/com/example/tvcontroller/Screens.kt
@@ -0,0 +1,7 @@
+package com.example.tvcontroller
+
+enum class Screens {
+ Camera,
+ Remote,
+ Settings
+}
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index a5581cd..44ebe47 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -8,9 +8,11 @@ espressoCore = "3.5.1"
lifecycleRuntimeKtx = "2.6.1"
activityCompose = "1.8.0"
composeBom = "2024.04.01"
+navigationCompose = "2.8.4"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }