began implementing calendar

This commit is contained in:
Clara Dautermann 2025-05-29 15:04:11 +02:00
parent 5c653f5dce
commit a1d0e46bfe
Signed by: clara
GPG key ID: 223391B52FAD4463
4 changed files with 132 additions and 2 deletions

View file

@ -1,5 +1,40 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" module="true" />
<package name="android" withSubpackages="true" static="true" />
<package name="androidx" withSubpackages="true" static="true" />
<package name="com" withSubpackages="true" static="true" />
<package name="junit" withSubpackages="true" static="true" />
<package name="net" withSubpackages="true" static="true" />
<package name="org" withSubpackages="true" static="true" />
<package name="java" withSubpackages="true" static="true" />
<package name="javax" withSubpackages="true" static="true" />
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="android" withSubpackages="true" static="false" />
<emptyLine />
<package name="androidx" withSubpackages="true" static="false" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="junit" withSubpackages="true" static="false" />
<emptyLine />
<package name="net" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
<emptyLine />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>

View file

@ -22,6 +22,7 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import de.cdaut.dbtapp.components.BottomNavigationBar
import de.cdaut.dbtapp.components.SkillsScreen
import de.cdaut.dbtapp.components.TrackingScreen
import de.cdaut.dbtapp.navigation.Screens
class MainActivity : ComponentActivity() {
@ -49,7 +50,7 @@ private fun MainContent() {
modifier = Modifier.padding(paddingValues = paddingValues)
) {
composable(Screens.Tracking.route) {
Text("Tracking")
TrackingScreen()
}
composable(Screens.Skillslist.route) {
SkillsScreen()
@ -70,7 +71,6 @@ private fun MainContent() {
}
}
@Preview
@Composable
private fun EmergencyButton() {
FloatingActionButton(

View file

@ -0,0 +1,79 @@
package de.cdaut.dbtapp.components
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ChevronLeft
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material3.DatePicker
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.rememberDatePickerState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import de.cdaut.dbtapp.util.WeekdayListByLocale
@Composable
fun TrackingScreen() {
TopCalendar()
}
@OptIn(ExperimentalMaterial3Api::class)
@Preview
@Composable
private fun DatePickerPreview() {
val datePickerState = rememberDatePickerState()
DatePicker(datePickerState)
}
@Preview
@Composable
private fun TopCalendarPrev() {
Box(Modifier.background(Color.White)) {
TopCalendar()
}
}
@Composable
private fun TopCalendar() {
Column {
//Top Navigation and display items
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(text = "currentDate")
Row {
Icon(
modifier = Modifier.clickable(onClick = {}),
imageVector = Icons.Filled.ChevronLeft,
contentDescription = "TODO: Provide"
)
Icon(
modifier = Modifier.clickable(onClick = {}),
imageVector = Icons.Filled.ChevronRight,
contentDescription = "TODO: Provide"
)
}
}
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
for (label in WeekdayListByLocale()) {
Text(text = label)
}
}
}
}

View file

@ -0,0 +1,16 @@
package de.cdaut.dbtapp.util
import java.time.DayOfWeek
import java.time.format.TextStyle
import java.time.temporal.WeekFields
import java.util.Locale
fun WeekdayListByLocale(): List<String> {
val locale = Locale.getDefault()
val listOfDayNames = DayOfWeek.entries.map { it.getDisplayName(TextStyle.NARROW, locale).substring(0, 1) }
val firstDayOfWeek = WeekFields.of(locale).firstDayOfWeek.ordinal
val orderedListOfDayNames =
listOfDayNames.subList(firstDayOfWeek, 7) + listOfDayNames.subList(0, firstDayOfWeek)
return orderedListOfDayNames
}