Temporary update before I go to sleep
This commit is contained in:
		
							parent
							
								
									18d8108779
								
							
						
					
					
						commit
						01bb858b9d
					
				
					 3 changed files with 71 additions and 28 deletions
				
			
		|  | @ -1,41 +1,81 @@ | |||
| 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.material.Button | ||||
| import androidx.compose.material.Divider | ||||
| import androidx.compose.material.Icon | ||||
| import androidx.compose.material.Text | ||||
| 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.ui.Modifier | ||||
| import androidx.compose.ui.graphics.vector.ImageVector | ||||
| import androidx.compose.ui.tooling.preview.Preview | ||||
| 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 | ||||
| fun Drawer() { | ||||
|     Column(modifier = Modifier.fillMaxSize()) { | ||||
|         Text(text = "Studeez") | ||||
|         Divider() | ||||
|         Text(text = "Logout") | ||||
|         IconTextButton(icon = Icons.Default.Home, text = "Home") { | ||||
|              | ||||
| 
 | ||||
|         // TODO Currently logged in user | ||||
|         // TODO What kind of user | ||||
| 
 | ||||
|         // 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 | ||||
| fun IconTextButton(icon: ImageVector, text: String, onClick: () -> Unit) { | ||||
|     Button( | ||||
|         onClick = onClick | ||||
| fun DrawerEntry( | ||||
|     icon: ImageVector, | ||||
|     text: String, | ||||
|     onClick: () -> Unit | ||||
| ) { | ||||
|     Row( | ||||
|         horizontalArrangement = Arrangement.Center, | ||||
|         modifier = Modifier | ||||
|             .clickable(onClick = { onClick() }) | ||||
|             .fillMaxWidth() | ||||
|     ) { | ||||
|         Row( | ||||
|             horizontalArrangement = Arrangement.Center | ||||
|         ) { | ||||
|         Box(modifier = Modifier.fillMaxWidth(0.25f)) { | ||||
|             Icon(imageVector = icon, contentDescription = text) | ||||
|             Spacer(modifier = Modifier.width(8.dp)) | ||||
|         } | ||||
|         Box(modifier = Modifier.fillMaxWidth(0.75f)) { | ||||
|             Text(text = text) | ||||
|         } | ||||
|     } | ||||
|  | @ -44,17 +84,7 @@ fun IconTextButton(icon: ImageVector, text: String, onClick: () -> Unit) { | |||
| @Preview | ||||
| @Composable | ||||
| fun DrawerPreview() { | ||||
|     Drawer() | ||||
| } | ||||
| 
 | ||||
| @Preview | ||||
| @Composable | ||||
| fun DrawerEntryPreview() { | ||||
|     IconTextButton( | ||||
|         icon = Icons.Default.Home, | ||||
|         text = "Home", | ||||
|         onClick = { | ||||
|             // Do something when the button is clicked | ||||
|         } | ||||
|     ) | ||||
|     StudeezTheme { | ||||
|         Drawer() | ||||
|     } | ||||
| } | ||||
|  | @ -26,6 +26,7 @@ fun LoginScreen( | |||
| ) { | ||||
|     val uiState by viewModel.uiState | ||||
| 
 | ||||
|     // TODO Make this a separate kind of screen? | ||||
|     SecondaryScreenToolbar(title = resources().getString(AppText.sign_in)) { | ||||
|         Column( | ||||
|             modifier = modifier | ||||
|  |  | |||
|  | @ -27,4 +27,16 @@ | |||
|     <string name="home">Home</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> | ||||
|  |  | |||
		Reference in a new issue