Added propably working navbar
This commit is contained in:
parent
0b459e9f95
commit
4d25cd1329
26
.idea/appInsightsSettings.xml
generated
Normal file
26
.idea/appInsightsSettings.xml
generated
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AppInsightsSettings">
|
||||||
|
<option name="tabSettings">
|
||||||
|
<map>
|
||||||
|
<entry key="Firebase Crashlytics">
|
||||||
|
<value>
|
||||||
|
<InsightsFilterSettings>
|
||||||
|
<option name="connection">
|
||||||
|
<ConnectionSetting>
|
||||||
|
<option name="appId" value="PLACEHOLDER" />
|
||||||
|
<option name="mobileSdkAppId" value="" />
|
||||||
|
<option name="projectId" value="" />
|
||||||
|
<option name="projectNumber" value="" />
|
||||||
|
</ConnectionSetting>
|
||||||
|
</option>
|
||||||
|
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||||
|
<option name="timeIntervalDays" value="THIRTY_DAYS" />
|
||||||
|
<option name="visibilityType" value="ALL" />
|
||||||
|
</InsightsFilterSettings>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -10,11 +10,14 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import com.f1rq.lifemap.navigationbar.NavigationBar
|
import com.f1rq.lifemap.navigationbar.NavigationBar
|
||||||
import com.f1rq.lifemap.screens.ListView
|
import com.f1rq.lifemap.screens.ListView
|
||||||
import com.f1rq.lifemap.screens.MapView
|
import com.f1rq.lifemap.screens.MapView
|
||||||
import com.f1rq.lifemap.ui.theme.LifeMapTheme
|
import com.f1rq.lifemap.ui.theme.LifeMapTheme
|
||||||
|
import com.f1rq.lifemap.ui.theme.ActiveNavColor
|
||||||
|
import com.f1rq.lifemap.ui.theme.InactiveNavColor
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -24,7 +27,17 @@ class MainActivity : ComponentActivity() {
|
|||||||
val navController = rememberNavController()
|
val navController = rememberNavController()
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
bottomBar = { NavigationBar(navController) }
|
bottomBar = {
|
||||||
|
val navBackStackEntry = navController.currentBackStackEntryAsState()
|
||||||
|
val currentRoute = navBackStackEntry.value?.destination?.route
|
||||||
|
|
||||||
|
NavigationBar(
|
||||||
|
onWorldViewTapped = { navController.navigate("mapview") },
|
||||||
|
onListViewTapped = { navController.navigate("listview") },
|
||||||
|
worldViewBackgroundColor = if (currentRoute == "mapview") ActiveNavColor else InactiveNavColor,
|
||||||
|
listViewBackgroundColor = if (currentRoute == "listview") ActiveNavColor else InactiveNavColor
|
||||||
|
)
|
||||||
|
}
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
NavHost(
|
NavHost(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
@ -44,7 +57,9 @@ class MainActivity : ComponentActivity() {
|
|||||||
@Composable
|
@Composable
|
||||||
fun GreetingPreview() {
|
fun GreetingPreview() {
|
||||||
LifeMapTheme {
|
LifeMapTheme {
|
||||||
val previewNavController = rememberNavController()
|
NavigationBar(
|
||||||
NavigationBar(navController = previewNavController)
|
onWorldViewTapped = {},
|
||||||
|
onListViewTapped = {}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,32 +0,0 @@
|
|||||||
package com.f1rq.lifemap
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.navigation.NavHostController
|
|
||||||
import com.f1rq.lifemap.navigationbar.NavigationBar
|
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun NavBarHandler(navController: NavHostController) {
|
|
||||||
val currentRoute = currentRoute(navController)
|
|
||||||
|
|
||||||
NavigationBar(
|
|
||||||
modifier = Modifier,
|
|
||||||
onWorldViewTapped = {
|
|
||||||
if (currentRoute != "mapview") navController.navigate("mapview")
|
|
||||||
},
|
|
||||||
onListViewTapped = {
|
|
||||||
if (currentRoute != "listview") navController.navigate("listview")
|
|
||||||
},
|
|
||||||
//homeState = if (currentRoute == "home") "active" else "inactive",
|
|
||||||
//settingsState = if (currentRoute == "settings") "active" else "inactive",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun currentRoute(navController: NavHostController): String? {
|
|
||||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
|
||||||
return navBackStackEntry?.destination?.route
|
|
||||||
}
|
|
@ -13,6 +13,6 @@ fun ListView(modifier: Modifier = Modifier) {
|
|||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text("Settings Screen")
|
Text("List view")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,6 +13,6 @@ fun MapView(modifier: Modifier = Modifier) {
|
|||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text("Home Screen")
|
Text("Map view")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,3 +9,6 @@ val Pink80 = Color(0xFFEFB8C8)
|
|||||||
val Purple40 = Color(0xFF6650a4)
|
val Purple40 = Color(0xFF6650a4)
|
||||||
val PurpleGrey40 = Color(0xFF625b71)
|
val PurpleGrey40 = Color(0xFF625b71)
|
||||||
val Pink40 = Color(0xFF7D5260)
|
val Pink40 = Color(0xFF7D5260)
|
||||||
|
|
||||||
|
val ActiveNavColor = Color(0xFFDDDDDD)
|
||||||
|
val InactiveNavColor = Color.Transparent
|
@ -5,7 +5,7 @@
|
|||||||
"type": "figma",
|
"type": "figma",
|
||||||
"file": "7RzB5mC9Qj82hGEbAM11GM",
|
"file": "7RzB5mC9Qj82hGEbAM11GM",
|
||||||
"node": "38:3",
|
"node": "38:3",
|
||||||
"version": "2204970891916878617",
|
"version": "2205486309991144776",
|
||||||
"component-id": "915162a5cdf4f7f91ace42d239b4d1faf0d5c6e7"
|
"component-id": "915162a5cdf4f7f91ace42d239b4d1faf0d5c6e7"
|
||||||
},
|
},
|
||||||
"default": "Navigation bar",
|
"default": "Navigation bar",
|
||||||
@ -110,7 +110,6 @@
|
|||||||
"icon-container"
|
"icon-container"
|
||||||
],
|
],
|
||||||
"item-spacing": 4.0,
|
"item-spacing": 4.0,
|
||||||
"background-color": "$world view background color",
|
|
||||||
"clip-content": false
|
"clip-content": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -133,7 +132,6 @@
|
|||||||
"icon-container1"
|
"icon-container1"
|
||||||
],
|
],
|
||||||
"item-spacing": 4.0,
|
"item-spacing": 4.0,
|
||||||
"background-color": "$list view background color",
|
|
||||||
"clip-content": false
|
"clip-content": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -149,13 +147,7 @@
|
|||||||
},
|
},
|
||||||
"children": [
|
"children": [
|
||||||
"state-layer"
|
"state-layer"
|
||||||
],
|
]
|
||||||
"background-color": {
|
|
||||||
"alpha": 1.0,
|
|
||||||
"hue": 0.0,
|
|
||||||
"saturation": 0.0,
|
|
||||||
"value": 1.0
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "state-layer",
|
"id": "state-layer",
|
||||||
@ -179,12 +171,7 @@
|
|||||||
"children": [
|
"children": [
|
||||||
"Frame"
|
"Frame"
|
||||||
],
|
],
|
||||||
"background-color": {
|
"background-color": "$world view background color",
|
||||||
"alpha": 1.0,
|
|
||||||
"hue": 0.0,
|
|
||||||
"saturation": 0.0,
|
|
||||||
"value": 0.8666666666666667
|
|
||||||
},
|
|
||||||
"clip-content": false
|
"clip-content": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -256,6 +243,7 @@
|
|||||||
"children": [
|
"children": [
|
||||||
"Frame1"
|
"Frame1"
|
||||||
],
|
],
|
||||||
|
"background-color": "$list view background color",
|
||||||
"clip-content": false
|
"clip-content": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -300,23 +288,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"world view background color": {
|
|
||||||
"data-type": "color",
|
|
||||||
"required": false,
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
"on world view tapped": {
|
"on world view tapped": {
|
||||||
"data-type": "void-callback",
|
"data-type": "void-callback",
|
||||||
"required": false,
|
"required": false,
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"list view background color": {
|
"on list view tapped": {
|
||||||
|
"data-type": "void-callback",
|
||||||
|
"required": false,
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"world view background color": {
|
||||||
"data-type": "color",
|
"data-type": "color",
|
||||||
"required": false,
|
"required": false,
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"on list view tapped": {
|
"list view background color": {
|
||||||
"data-type": "void-callback",
|
"data-type": "color",
|
||||||
"required": false,
|
"required": false,
|
||||||
"description": ""
|
"description": ""
|
||||||
}
|
}
|
||||||
@ -327,6 +315,14 @@
|
|||||||
"size": {
|
"size": {
|
||||||
"width": 375.0,
|
"width": 375.0,
|
||||||
"height": 76.0
|
"height": 76.0
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"world view background color": {
|
||||||
|
"alpha": 1.0,
|
||||||
|
"hue": 0.0,
|
||||||
|
"saturation": 0.0,
|
||||||
|
"value": 0.8666666666666667
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user