-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implemented bottom navigation bar and added profile button in menu
- added a bottom navigation bar to the menu screen with navigation to the map screen (and menu) - added a profile button to the menu screen to access the profile - wrote tests for the ProfileScreen and additional tests for the MenuScreen to ensure functionality
- Loading branch information
1 parent
69498f7
commit e2ed3b5
Showing
10 changed files
with
134 additions
and
52 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
...oup27/lookup/screen/CalendarScreenTest.kt → .../lookup/ui/overview/CalendarScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...up27/lookup/overview/LandingScreenTest.kt → ...7/lookup/ui/overview/LandingScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pgroup27/lookup/overview/MapScreenTest.kt → ...oup27/lookup/ui/overview/MapScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...group27/lookup/overview/QuizScreenTest.kt → ...up27/lookup/ui/overview/QuizScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/androidTest/java/com/github/lookupgroup27/lookup/ui/profile/ProfileScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.github.lookupgroup27.lookup.ui.profile | ||
|
||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithTag | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import com.github.lookupgroup27.lookup.ui.navigation.NavigationActions | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.mockito.kotlin.mock | ||
import org.mockito.kotlin.verify | ||
|
||
class ProfileScreenTest { | ||
|
||
@get:Rule val composeTestRule = createComposeRule() | ||
|
||
private val mockNavigationActions: NavigationActions = mock() | ||
|
||
@Test | ||
fun profileScreen_displaysProfileTextAndBackButton() { | ||
composeTestRule.setContent { ProfileScreen(navigationActions = mockNavigationActions) } | ||
|
||
// Verify that the profile screen text is displayed | ||
composeTestRule.onNodeWithText("Profile Screen").assertIsDisplayed() | ||
|
||
// Verify that the back button is displayed | ||
composeTestRule.onNodeWithTag("go_back_button_profile").assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun profileScreen_clickBackButton_navigatesBack() { | ||
composeTestRule.setContent { ProfileScreen(navigationActions = mockNavigationActions) } | ||
|
||
// Click on back button | ||
composeTestRule.onNodeWithTag("go_back_button_profile").performClick() | ||
|
||
// Verify that the navigation back action is triggered | ||
verify(mockNavigationActions).goBack() | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
...oup27/lookup/overview/SkyTrackerScreen.kt → .../lookup/ui/skytracker/SkyTrackerScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 61 additions & 37 deletions
98
app/src/main/java/com/github/lookupgroup27/lookup/ui/overview/Menu.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,80 @@ | ||
package com.github.lookupgroup27.lookup.ui.overview | ||
|
||
import androidx.compose.foundation.background | ||
import android.annotation.SuppressLint | ||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.AccountCircle | ||
import androidx.compose.material.icons.filled.ArrowBack | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.* | ||
import androidx.compose.ui.draw.blur | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.platform.testTag | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import com.github.lookupgroup27.lookup.ui.map.MapScreen | ||
import com.github.lookupgroup27.lookup.R | ||
import com.github.lookupgroup27.lookup.ui.navigation.* | ||
|
||
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") | ||
@Composable | ||
fun MenuScreen(navigationActions: NavigationActions) { | ||
Box(modifier = Modifier.fillMaxSize().testTag("menu_screen")) { | ||
// Blurred map screen as the background | ||
MapScreen(navigationActions) // Empty function since the back button isn't needed in the blurred | ||
// background | ||
Spacer( | ||
modifier = | ||
Modifier.fillMaxSize() | ||
.background(Color.Black.copy(alpha = 0.5f)) | ||
.blur(70.dp) // Adjust blur strength here | ||
) | ||
IconButton( | ||
onClick = { navigationActions.goBack() }, | ||
modifier = Modifier.padding(16.dp).align(Alignment.TopStart).testTag("back_button")) { | ||
Icon( | ||
imageVector = Icons.Default.ArrowBack, | ||
contentDescription = "Back", | ||
tint = Color.White) | ||
} | ||
Scaffold( | ||
bottomBar = { | ||
BottomNavigationMenu( | ||
onTabSelect = { destination -> navigationActions.navigateTo(destination) }, | ||
tabList = LIST_TOP_LEVEL_DESTINATION, | ||
selectedItem = Route.MENU) | ||
}, | ||
modifier = Modifier.testTag("menu_screen")) { paddingValues -> | ||
Box(modifier = Modifier.fillMaxSize().padding(paddingValues)) { | ||
// Blurred map screen as the background | ||
Image( | ||
painter = | ||
painterResource(id = R.drawable.landing_screen_bckgrnd), // Import your image | ||
contentDescription = "Background", | ||
modifier = Modifier.fillMaxSize().testTag("background_image").blur(20.dp), | ||
contentScale = ContentScale.Crop) | ||
|
||
// Buttons in the foreground | ||
Column( | ||
modifier = Modifier.align(Alignment.Center).padding(horizontal = 32.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(16.dp)) { | ||
Text( | ||
text = "Welcome !", | ||
color = Color.White, | ||
style = MaterialTheme.typography.displaySmall) | ||
Button(onClick = { navigationActions.navigateTo(Screen.QUIZ) }) { Text(text = "Quizzes") } | ||
Button(onClick = { navigationActions.navigateTo(Screen.CALENDAR) }) { | ||
Text(text = "Calendar") | ||
} | ||
Button(onClick = { navigationActions.navigateTo(Screen.SKY_TRACKER) }) { | ||
Text(text = "Sky Tracker") | ||
} | ||
IconButton( | ||
onClick = { navigationActions.goBack() }, | ||
modifier = Modifier.padding(16.dp).align(Alignment.TopStart).testTag("back_button")) { | ||
Icon( | ||
imageVector = Icons.Default.ArrowBack, | ||
contentDescription = "Back", | ||
tint = Color.White) | ||
} | ||
IconButton( | ||
onClick = { navigationActions.navigateTo(Screen.PROFILE) }, | ||
modifier = | ||
Modifier.padding(16.dp).align(Alignment.TopEnd).testTag("profile_button")) { | ||
Icon( | ||
modifier = Modifier.size(56.dp), | ||
imageVector = Icons.Default.AccountCircle, | ||
contentDescription = "Profile", | ||
tint = Color.White) | ||
} | ||
// Buttons in the foreground | ||
Column( | ||
modifier = Modifier.align(Alignment.Center).padding(horizontal = 32.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(16.dp)) { | ||
Text( | ||
text = "Welcome !", | ||
color = Color.White, | ||
style = MaterialTheme.typography.displaySmall) | ||
Button(onClick = { navigationActions.navigateTo(Screen.QUIZ) }) { | ||
Text(text = "Quizzes") | ||
} | ||
Button(onClick = { navigationActions.navigateTo(Screen.CALENDAR) }) { | ||
Text(text = "Calendar") | ||
} | ||
Button(onClick = { navigationActions.navigateTo(Screen.SKY_TRACKER) }) { | ||
Text(text = "Sky Tracker") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters