* 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>
|
||||
<SelectionState runConfigName="app">
|
||||
<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>
|
||||
</selectionStates>
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class MainActivity : ComponentActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
@Preview(locale = "en-US")
|
||||
@Preview(locale = "en-US", device = "id:pixel_6")
|
||||
@Composable
|
||||
private fun MainContent() {
|
||||
val navController = rememberNavController()
|
||||
|
|
@ -76,7 +76,9 @@ private fun MainContent() {
|
|||
@Composable
|
||||
private fun EmergencyButton() {
|
||||
FloatingActionButton(
|
||||
onClick = {},
|
||||
onClick = {
|
||||
//TODO: Implement function for emergency Button
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.error
|
||||
) {
|
||||
Icon(
|
||||
|
|
|
|||
|
|
@ -19,17 +19,19 @@ import de.cdaut.dbtapp.navigation.BottomNavigationItem
|
|||
fun BottomNavigationBar(navController: NavController) {
|
||||
var context = LocalContext.current
|
||||
//remember the currently selected view
|
||||
//default view is home
|
||||
val homeView = BottomNavigationItem()
|
||||
.bottomNavigationItems()
|
||||
.find { item -> item.label == "Home" }!!.idx
|
||||
var navigationSelectedItem by remember {
|
||||
mutableIntStateOf(
|
||||
//default view is home
|
||||
BottomNavigationItem().bottomNavigationItems(ctx = context)
|
||||
.find { item -> item.label == "Home" }!!.idx
|
||||
homeView
|
||||
)
|
||||
}
|
||||
|
||||
NavigationBar {
|
||||
//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 ->
|
||||
NavigationBarItem(
|
||||
selected = index == navigationSelectedItem,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
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.lazy.grid.GridCells
|
||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.CalendarMonth
|
||||
|
|
@ -61,11 +62,9 @@ import java.time.temporal.WeekFields
|
|||
fun TrackingScreen() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
.fillMaxWidth()
|
||||
.fillMaxHeight()
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
//TODO: Scrolling is fucked up
|
||||
//.verticalScroll(rememberScrollState()),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Column(
|
||||
|
|
@ -133,7 +132,8 @@ fun TrackingScreen() {
|
|||
stringResource(R.string.card_therapy_hw_heading),
|
||||
//cannot eta reduce because
|
||||
//Function References of @Composable functions are not currently supported
|
||||
rows = { assignments -> TherapyAssignmentCardContent(assignments)
|
||||
rows = { assignments ->
|
||||
TherapyAssignmentCardContent(assignments)
|
||||
},
|
||||
addAction = {
|
||||
//TODO: Add Therapy assignment
|
||||
|
|
@ -147,7 +147,7 @@ fun TrackingScreen() {
|
|||
stringResource(R.string.tracker_card_title),
|
||||
//cannot eta reduce because
|
||||
//Function References of @Composable functions are not currently supported
|
||||
rows = { trackers -> OtherTrackersCardContent(trackers = trackers) },
|
||||
rows = { trackers -> OtherTrackersCardContent(trackers = List(4) { _ -> trackers[0] }) },
|
||||
addAction = {
|
||||
//TODO: Add new tracker
|
||||
},
|
||||
|
|
@ -155,7 +155,6 @@ fun TrackingScreen() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -263,10 +262,13 @@ private fun CalendarDaysGrid(selectedDateMut: MutableState<LocalDate>) {
|
|||
}
|
||||
|
||||
// Calendar Grid
|
||||
// FIXME: Something better than a lazy grid would be good because scrolling
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Fixed(7),
|
||||
userScrollEnabled = false,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(320.dp)
|
||||
) {
|
||||
items(days.size) { index ->
|
||||
days[index]?.let { day ->
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
package de.cdaut.dbtapp.navigation
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.MenuBook
|
||||
import androidx.compose.material.icons.filled.CalendarToday
|
||||
import androidx.compose.material.icons.filled.Checklist
|
||||
import androidx.compose.material.icons.filled.Home
|
||||
import androidx.compose.material.icons.outlined.Star
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.core.content.ContextCompat.getString
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import de.cdaut.dbtapp.R
|
||||
|
||||
data class BottomNavigationItem(
|
||||
|
|
@ -17,34 +17,35 @@ data class BottomNavigationItem(
|
|||
val route: String = "",
|
||||
val idx: Int = 0
|
||||
) {
|
||||
fun bottomNavigationItems(ctx: Context): List<BottomNavigationItem> {
|
||||
@Composable
|
||||
fun bottomNavigationItems(): List<BottomNavigationItem> {
|
||||
return listOf(
|
||||
BottomNavigationItem(
|
||||
label = getString(ctx, R.string.label_tracking),
|
||||
label = stringResource(R.string.label_tracking),
|
||||
icon = Icons.Filled.CalendarToday,
|
||||
route = Screens.Tracking.route,
|
||||
idx = 0
|
||||
),
|
||||
BottomNavigationItem(
|
||||
label = getString(ctx, R.string.label_skillslist),
|
||||
label = stringResource(R.string.label_skillslist),
|
||||
icon = Icons.AutoMirrored.Filled.MenuBook,
|
||||
route = Screens.Skillslist.route,
|
||||
idx = 1
|
||||
),
|
||||
BottomNavigationItem(
|
||||
label = getString(ctx, R.string.label_home),
|
||||
label = stringResource(R.string.label_home),
|
||||
icon = Icons.Filled.Home,
|
||||
route = Screens.Home.route,
|
||||
idx = 2
|
||||
),
|
||||
BottomNavigationItem(
|
||||
label = getString(ctx, R.string.label_favourites),
|
||||
label = stringResource(R.string.label_favourites),
|
||||
icon = Icons.Outlined.Star,
|
||||
route = Screens.Favourites.route,
|
||||
idx = 3
|
||||
),
|
||||
BottomNavigationItem(
|
||||
label = getString(ctx, R.string.label_skillschains),
|
||||
label = stringResource(R.string.label_skillschains),
|
||||
icon = Icons.Filled.Checklist,
|
||||
route = Screens.Skillschains.route,
|
||||
idx = 4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue