* fixed scrolling issue
* fixed preview of main screen
This commit is contained in:
parent
c236507045
commit
6092c8f5e3
5 changed files with 40 additions and 22 deletions
11
DBTApp/.idea/deploymentTargetSelector.xml
generated
11
DBTApp/.idea/deploymentTargetSelector.xml
generated
|
|
@ -4,6 +4,17 @@
|
||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
<DropdownSelection timestamp="2025-06-04T17:57:13.134457158Z">
|
||||||
|
<Target type="DEFAULT_BOOT">
|
||||||
|
<handle>
|
||||||
|
<DeviceId pluginId="LocalEmulator" identifier="path=/home/clara/.android/avd/Pixel_6.avd" />
|
||||||
|
</handle>
|
||||||
|
</Target>
|
||||||
|
</DropdownSelection>
|
||||||
|
<DialogSelection />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="MainContent">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class MainActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview(locale = "en-US")
|
@Preview(locale = "en-US", device = "id:pixel_6")
|
||||||
@Composable
|
@Composable
|
||||||
private fun MainContent() {
|
private fun MainContent() {
|
||||||
val navController = rememberNavController()
|
val navController = rememberNavController()
|
||||||
|
|
@ -76,7 +76,9 @@ private fun MainContent() {
|
||||||
@Composable
|
@Composable
|
||||||
private fun EmergencyButton() {
|
private fun EmergencyButton() {
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
onClick = {},
|
onClick = {
|
||||||
|
//TODO: Implement function for emergency Button
|
||||||
|
},
|
||||||
containerColor = MaterialTheme.colorScheme.error
|
containerColor = MaterialTheme.colorScheme.error
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,19 @@ import de.cdaut.dbtapp.navigation.BottomNavigationItem
|
||||||
fun BottomNavigationBar(navController: NavController) {
|
fun BottomNavigationBar(navController: NavController) {
|
||||||
var context = LocalContext.current
|
var context = LocalContext.current
|
||||||
//remember the currently selected view
|
//remember the currently selected view
|
||||||
|
//default view is home
|
||||||
|
val homeView = BottomNavigationItem()
|
||||||
|
.bottomNavigationItems()
|
||||||
|
.find { item -> item.label == "Home" }!!.idx
|
||||||
var navigationSelectedItem by remember {
|
var navigationSelectedItem by remember {
|
||||||
mutableIntStateOf(
|
mutableIntStateOf(
|
||||||
//default view is home
|
homeView
|
||||||
BottomNavigationItem().bottomNavigationItems(ctx = context)
|
|
||||||
.find { item -> item.label == "Home" }!!.idx
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationBar {
|
NavigationBar {
|
||||||
//Create an entry in the bottom bar for each view
|
//Create an entry in the bottom bar for each view
|
||||||
BottomNavigationItem().bottomNavigationItems(ctx = context).sortedBy { item -> item.idx }
|
BottomNavigationItem().bottomNavigationItems().sortedBy { item -> item.idx }
|
||||||
.forEachIndexed { index, item ->
|
.forEachIndexed { index, item ->
|
||||||
NavigationBarItem(
|
NavigationBarItem(
|
||||||
selected = index == navigationSelectedItem,
|
selected = index == navigationSelectedItem,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
|
@ -17,7 +16,9 @@ import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.grid.GridCells
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.CalendarMonth
|
import androidx.compose.material.icons.filled.CalendarMonth
|
||||||
|
|
@ -61,11 +62,9 @@ import java.time.temporal.WeekFields
|
||||||
fun TrackingScreen() {
|
fun TrackingScreen() {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.fillMaxHeight()
|
|
||||||
.background(MaterialTheme.colorScheme.background),
|
.background(MaterialTheme.colorScheme.background),
|
||||||
//TODO: Scrolling is fucked up
|
|
||||||
//.verticalScroll(rememberScrollState()),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
|
|
@ -133,7 +132,8 @@ fun TrackingScreen() {
|
||||||
stringResource(R.string.card_therapy_hw_heading),
|
stringResource(R.string.card_therapy_hw_heading),
|
||||||
//cannot eta reduce because
|
//cannot eta reduce because
|
||||||
//Function References of @Composable functions are not currently supported
|
//Function References of @Composable functions are not currently supported
|
||||||
rows = { assignments -> TherapyAssignmentCardContent(assignments)
|
rows = { assignments ->
|
||||||
|
TherapyAssignmentCardContent(assignments)
|
||||||
},
|
},
|
||||||
addAction = {
|
addAction = {
|
||||||
//TODO: Add Therapy assignment
|
//TODO: Add Therapy assignment
|
||||||
|
|
@ -147,7 +147,7 @@ fun TrackingScreen() {
|
||||||
stringResource(R.string.tracker_card_title),
|
stringResource(R.string.tracker_card_title),
|
||||||
//cannot eta reduce because
|
//cannot eta reduce because
|
||||||
//Function References of @Composable functions are not currently supported
|
//Function References of @Composable functions are not currently supported
|
||||||
rows = { trackers -> OtherTrackersCardContent(trackers = trackers) },
|
rows = { trackers -> OtherTrackersCardContent(trackers = List(4) { _ -> trackers[0] }) },
|
||||||
addAction = {
|
addAction = {
|
||||||
//TODO: Add new tracker
|
//TODO: Add new tracker
|
||||||
},
|
},
|
||||||
|
|
@ -155,7 +155,6 @@ fun TrackingScreen() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -263,10 +262,13 @@ private fun CalendarDaysGrid(selectedDateMut: MutableState<LocalDate>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calendar Grid
|
// Calendar Grid
|
||||||
|
// FIXME: Something better than a lazy grid would be good because scrolling
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
columns = GridCells.Fixed(7),
|
columns = GridCells.Fixed(7),
|
||||||
userScrollEnabled = false,
|
userScrollEnabled = false,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(320.dp)
|
||||||
) {
|
) {
|
||||||
items(days.size) { index ->
|
items(days.size) { index ->
|
||||||
days[index]?.let { day ->
|
days[index]?.let { day ->
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package de.cdaut.dbtapp.navigation
|
package de.cdaut.dbtapp.navigation
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.MenuBook
|
import androidx.compose.material.icons.automirrored.filled.MenuBook
|
||||||
import androidx.compose.material.icons.filled.CalendarToday
|
import androidx.compose.material.icons.filled.CalendarToday
|
||||||
import androidx.compose.material.icons.filled.Checklist
|
import androidx.compose.material.icons.filled.Checklist
|
||||||
import androidx.compose.material.icons.filled.Home
|
import androidx.compose.material.icons.filled.Home
|
||||||
import androidx.compose.material.icons.outlined.Star
|
import androidx.compose.material.icons.outlined.Star
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.core.content.ContextCompat.getString
|
import androidx.compose.ui.res.stringResource
|
||||||
import de.cdaut.dbtapp.R
|
import de.cdaut.dbtapp.R
|
||||||
|
|
||||||
data class BottomNavigationItem(
|
data class BottomNavigationItem(
|
||||||
|
|
@ -17,34 +17,35 @@ data class BottomNavigationItem(
|
||||||
val route: String = "",
|
val route: String = "",
|
||||||
val idx: Int = 0
|
val idx: Int = 0
|
||||||
) {
|
) {
|
||||||
fun bottomNavigationItems(ctx: Context): List<BottomNavigationItem> {
|
@Composable
|
||||||
|
fun bottomNavigationItems(): List<BottomNavigationItem> {
|
||||||
return listOf(
|
return listOf(
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
label = getString(ctx, R.string.label_tracking),
|
label = stringResource(R.string.label_tracking),
|
||||||
icon = Icons.Filled.CalendarToday,
|
icon = Icons.Filled.CalendarToday,
|
||||||
route = Screens.Tracking.route,
|
route = Screens.Tracking.route,
|
||||||
idx = 0
|
idx = 0
|
||||||
),
|
),
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
label = getString(ctx, R.string.label_skillslist),
|
label = stringResource(R.string.label_skillslist),
|
||||||
icon = Icons.AutoMirrored.Filled.MenuBook,
|
icon = Icons.AutoMirrored.Filled.MenuBook,
|
||||||
route = Screens.Skillslist.route,
|
route = Screens.Skillslist.route,
|
||||||
idx = 1
|
idx = 1
|
||||||
),
|
),
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
label = getString(ctx, R.string.label_home),
|
label = stringResource(R.string.label_home),
|
||||||
icon = Icons.Filled.Home,
|
icon = Icons.Filled.Home,
|
||||||
route = Screens.Home.route,
|
route = Screens.Home.route,
|
||||||
idx = 2
|
idx = 2
|
||||||
),
|
),
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
label = getString(ctx, R.string.label_favourites),
|
label = stringResource(R.string.label_favourites),
|
||||||
icon = Icons.Outlined.Star,
|
icon = Icons.Outlined.Star,
|
||||||
route = Screens.Favourites.route,
|
route = Screens.Favourites.route,
|
||||||
idx = 3
|
idx = 3
|
||||||
),
|
),
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
label = getString(ctx, R.string.label_skillschains),
|
label = stringResource(R.string.label_skillschains),
|
||||||
icon = Icons.Filled.Checklist,
|
icon = Icons.Filled.Checklist,
|
||||||
route = Screens.Skillschains.route,
|
route = Screens.Skillschains.route,
|
||||||
idx = 4
|
idx = 4
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue