Temporary update before I go to sleep

This commit is contained in:
Tibo De Peuter 2023-04-11 23:26:50 +02:00
parent 18d8108779
commit 01bb858b9d
3 changed files with 71 additions and 28 deletions

View file

@ -1,41 +1,81 @@
package be.ugent.sel.studeez.common.composable package be.ugent.sel.studeez.common.composable
import android.graphics.drawable.Icon import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.Button import androidx.compose.material.Button
import androidx.compose.material.Divider
import androidx.compose.material.Icon import androidx.compose.material.Icon
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import be.ugent.sel.studeez.R
import be.ugent.sel.studeez.resources
import be.ugent.sel.studeez.ui.theme.StudeezTheme
@Composable @Composable
fun Drawer() { fun Drawer() {
Column(modifier = Modifier.fillMaxSize()) { Column(modifier = Modifier.fillMaxSize()) {
Text(text = "Studeez")
Divider() // TODO Currently logged in user
Text(text = "Logout") // TODO What kind of user
IconTextButton(icon = Icons.Default.Home, text = "Home") {
// TODO Divider
DrawerEntry(
icon = Icons.Default.Home,
text = resources().getString(R.string.home)
) {
// TODO Go to home
}
DrawerEntry(
icon = Icons.Default.LocationOn, // TODO Fix icon
text = resources().getString(R.string.timers)
) {
// TODO Go to timers
}
DrawerEntry(
icon = Icons.Default.Settings,
text = resources().getString(R.string.settings)
) {
// TODO Go to settings
}
DrawerEntry(
icon = Icons.Default.AccountBox, // TODO Fix icon
text = resources().getString(R.string.log_out)
) {
// TODO Log out
}
DrawerEntry(
icon = Icons.Default.Info,
text = resources().getString(R.string.about)
) {
// TODO Go to about
} }
} }
} }
@Composable @Composable
fun IconTextButton(icon: ImageVector, text: String, onClick: () -> Unit) { fun DrawerEntry(
Button( icon: ImageVector,
onClick = onClick text: String,
onClick: () -> Unit
) {
Row(
horizontalArrangement = Arrangement.Center,
modifier = Modifier
.clickable(onClick = { onClick() })
.fillMaxWidth()
) { ) {
Row( Box(modifier = Modifier.fillMaxWidth(0.25f)) {
horizontalArrangement = Arrangement.Center
) {
Icon(imageVector = icon, contentDescription = text) Icon(imageVector = icon, contentDescription = text)
Spacer(modifier = Modifier.width(8.dp)) }
Box(modifier = Modifier.fillMaxWidth(0.75f)) {
Text(text = text) Text(text = text)
} }
} }
@ -44,17 +84,7 @@ fun IconTextButton(icon: ImageVector, text: String, onClick: () -> Unit) {
@Preview @Preview
@Composable @Composable
fun DrawerPreview() { fun DrawerPreview() {
Drawer() StudeezTheme {
} Drawer()
}
@Preview
@Composable
fun DrawerEntryPreview() {
IconTextButton(
icon = Icons.Default.Home,
text = "Home",
onClick = {
// Do something when the button is clicked
}
)
} }

View file

@ -26,6 +26,7 @@ fun LoginScreen(
) { ) {
val uiState by viewModel.uiState val uiState by viewModel.uiState
// TODO Make this a separate kind of screen?
SecondaryScreenToolbar(title = resources().getString(AppText.sign_in)) { SecondaryScreenToolbar(title = resources().getString(AppText.sign_in)) {
Column( Column(
modifier = modifier modifier = modifier

View file

@ -27,4 +27,16 @@
<string name="home">Home</string> <string name="home">Home</string>
<string name="start_session">Start session</string> <string name="start_session">Start session</string>
<!-- Drawer / SideMenu -->
<string name="log_out">Log out</string>
<!-- Timers -->
<string name="timers">Timers</string>
<!-- Settings -->
<string name="settings">Settings</string>
<!-- About -->
<string name="about">About Studeez</string>
</resources> </resources>