diff --git a/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt b/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt
index fb3aeb2..29f0761 100644
--- a/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt
+++ b/app/src/main/java/be/ugent/sel/studeez/StudeezApp.kt
@@ -20,6 +20,7 @@ import be.ugent.sel.studeez.common.snackbar.SnackbarManager
import be.ugent.sel.studeez.navigation.StudeezDestinations
import be.ugent.sel.studeez.screens.home.HomeScreen
import be.ugent.sel.studeez.screens.log_in.LoginScreen
+import be.ugent.sel.studeez.screens.profile.EditProfileScreen
import be.ugent.sel.studeez.screens.profile.ProfileScreen
import be.ugent.sel.studeez.screens.sign_up.SignUpScreen
import be.ugent.sel.studeez.screens.splash.SplashScreen
@@ -77,12 +78,16 @@ fun resources(): Resources {
fun NavGraphBuilder.studeezGraph(appState: StudeezAppstate) {
- val openAndPopUp: (String, String) -> Unit = {
- route, popUp -> appState.navigateAndPopUp(route, popUp)
+ val goBack: () -> Unit = {
+ appState.popUp()
}
val open: (String) -> Unit = {
- route -> appState.navigate(route)
+ route -> appState.navigate(route)
+ }
+
+ val openAndPopUp: (String, String) -> Unit = {
+ route, popUp -> appState.navigateAndPopUp(route, popUp)
}
composable(StudeezDestinations.SPLASH_SCREEN) {
@@ -110,4 +115,9 @@ fun NavGraphBuilder.studeezGraph(appState: StudeezAppstate) {
// TODO Timers screen
// TODO Settings screen
+
+ // Edit screens
+ composable(StudeezDestinations.EDIT_PROFILE_SCREEN) {
+ EditProfileScreen(goBack)
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/be/ugent/sel/studeez/navigation/StudeezDestinations.kt b/app/src/main/java/be/ugent/sel/studeez/navigation/StudeezDestinations.kt
index a042da1..7b606ca 100644
--- a/app/src/main/java/be/ugent/sel/studeez/navigation/StudeezDestinations.kt
+++ b/app/src/main/java/be/ugent/sel/studeez/navigation/StudeezDestinations.kt
@@ -12,4 +12,7 @@ object StudeezDestinations {
// const val TIMERS_SCREEN = "timers"
// const val SETTINGS_SCREEN = "settings"
+
+ // Edit screens
+ const val EDIT_PROFILE_SCREEN = "edit_profile"
}
\ No newline at end of file
diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarViewModel.kt b/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarViewModel.kt
index 1814d84..75613d5 100644
--- a/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarViewModel.kt
+++ b/app/src/main/java/be/ugent/sel/studeez/screens/navbar/NavigationBarViewModel.kt
@@ -2,7 +2,6 @@ package be.ugent.sel.studeez.screens.navbar
import be.ugent.sel.studeez.domain.AccountDAO
import be.ugent.sel.studeez.domain.LogService
-import be.ugent.sel.studeez.navigation.StudeezDestinations
import be.ugent.sel.studeez.navigation.StudeezDestinations.HOME_SCREEN
import be.ugent.sel.studeez.navigation.StudeezDestinations.PROFILE_SCREEN
import be.ugent.sel.studeez.screens.StudeezViewModel
diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileEditScreen.kt b/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileEditScreen.kt
new file mode 100644
index 0000000..41fe91e
--- /dev/null
+++ b/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileEditScreen.kt
@@ -0,0 +1,31 @@
+package be.ugent.sel.studeez.screens.profile
+
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.tooling.preview.Preview
+import be.ugent.sel.studeez.R
+import be.ugent.sel.studeez.common.composable.SecondaryScreenTemplate
+import be.ugent.sel.studeez.resources
+import be.ugent.sel.studeez.ui.theme.StudeezTheme
+
+@Composable
+fun EditProfileScreen(
+ goBack: () -> Unit
+) {
+ SecondaryScreenTemplate(
+ title = resources().getString(R.string.editing_profile),
+ popUp = goBack
+ ) {
+ Text(text = "TODO")
+ }
+}
+
+@Preview
+@Composable
+fun EditProfileScreenComposable() {
+ StudeezTheme {
+ EditProfileScreen {
+ {}
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileScreen.kt b/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileScreen.kt
index 05cf490..6ec4a01 100644
--- a/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileScreen.kt
+++ b/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileScreen.kt
@@ -27,15 +27,17 @@ fun ProfileScreen(
title = resources().getString(AppText.profile),
open = open,
openAndPopUp = openAndPopUp,
- action = { EditAction() }
+ action = { EditAction { viewModel.onEditProfileClick(open) } }
) {
Headline(text = (username ?: resources().getString(R.string.no_username)))
}
}
@Composable
-fun EditAction() {
- IconButton(onClick = { /*TODO*/ }) {
+fun EditAction(
+ onClick: () -> Unit
+) {
+ IconButton(onClick = onClick) {
Icon(
imageVector = Icons.Default.Edit,
contentDescription = resources().getString(AppText.edit_profile)
diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileViewModel.kt b/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileViewModel.kt
index 1f6b1a2..e24defd 100644
--- a/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileViewModel.kt
+++ b/app/src/main/java/be/ugent/sel/studeez/screens/profile/ProfileViewModel.kt
@@ -1,20 +1,10 @@
package be.ugent.sel.studeez.screens.profile
-import androidx.compose.runtime.rememberCoroutineScope
-import androidx.lifecycle.viewModelScope
-import be.ugent.sel.studeez.R
import be.ugent.sel.studeez.domain.LogService
import be.ugent.sel.studeez.domain.UserDAO
-import be.ugent.sel.studeez.resources
+import be.ugent.sel.studeez.navigation.StudeezDestinations
import be.ugent.sel.studeez.screens.StudeezViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.coroutineScope
-import kotlinx.coroutines.flow.SharingStarted
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.map
-import kotlinx.coroutines.flow.stateIn
-
import javax.inject.Inject
@HiltViewModel
@@ -27,4 +17,8 @@ class ProfileViewModel @Inject constructor(
return userDAO.getUsername()
}
+ fun onEditProfileClick(open: (String) -> Unit) {
+ open(StudeezDestinations.EDIT_PROFILE_SCREEN)
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f189ea6..5edd3b1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -40,6 +40,7 @@
Profile
Unknown username
Edit profile
+ Editing profile
Friends