Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SignInKtTest : TestCase() {

// Scroll to make sure components are visible on smaller screens
composeTestRule.onNodeWithTag("loginTitle").performScrollTo().assertIsDisplayed()
composeTestRule.onNodeWithTag("loginTitle").assertTextEquals("Welcome to the Cosmos")
composeTestRule.onNodeWithTag("loginTitle").assertTextEquals("Explore the Cosmos")

composeTestRule.onNodeWithTag("loginButton").performScrollTo().assertIsDisplayed()
composeTestRule.onNodeWithTag("loginButton").assertHasClickAction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,30 +122,78 @@ class ProfileInformationScreenTest {
}

@Test
fun deleteButtonWorks() {
fun deleteButtonShowsConfirmationDialog() {
composeTestRule.setContent { ProfileInformationScreen(profileViewModel, navigationActions) }

// Assert: Save button is initially disabled
composeTestRule.onNodeWithTag("profileSaveButton").assertIsNotEnabled()
// Fill in the fields to enable the delete button
composeTestRule.onNodeWithTag("editProfileUsername").performTextInput("JohnDoe")
composeTestRule.onNodeWithTag("editProfileEmail").performTextInput("john.doe@example.com")
composeTestRule.onNodeWithTag("editProfileBio").performTextInput("This is a bio")

// Act: Fill in only the username
// Click delete button
composeTestRule.onNodeWithTag("profileDelete").performScrollTo().performClick()

// Verify dialog appears
composeTestRule.onNodeWithTag("deleteConfirmationDialog").assertExists()
}

@Test
fun deleteConfirmationDialogCancelWorks() {
composeTestRule.setContent { ProfileInformationScreen(profileViewModel, navigationActions) }

// Fill in the fields to enable the delete button
composeTestRule.onNodeWithTag("editProfileUsername").performTextInput("JohnDoe")
// Assert: Save button is still disabled
composeTestRule.onNodeWithTag("profileSaveButton").assertIsNotEnabled()
composeTestRule.onNodeWithTag("editProfileEmail").performTextInput("john.doe@example.com")
composeTestRule.onNodeWithTag("editProfileBio").performTextInput("This is a bio")

// Act: Fill in email
// Click delete button
composeTestRule.onNodeWithTag("profileDelete").performScrollTo().performClick()

// Click cancel button
composeTestRule.onNodeWithTag("cancelDeleteButton").performClick()

// Verify dialog disappears
composeTestRule.onNodeWithTag("deleteConfirmationDialog").assertDoesNotExist()
}

@Test
fun deleteConfirmationDialogConfirmWorks() {
composeTestRule.setContent { ProfileInformationScreen(profileViewModel, navigationActions) }

// Fill in the fields to enable the delete button
composeTestRule.onNodeWithTag("editProfileUsername").performTextInput("JohnDoe")
composeTestRule.onNodeWithTag("editProfileEmail").performTextInput("john.doe@example.com")
// Assert: Save button is still disabled because bio is empty
composeTestRule.onNodeWithTag("profileSaveButton").assertIsNotEnabled()
composeTestRule.onNodeWithTag("editProfileBio").performTextInput("This is a bio")

// Act: Fill in the bio
// Click delete button
composeTestRule.onNodeWithTag("profileDelete").performScrollTo().performClick()

// Click confirm button
composeTestRule.onNodeWithTag("confirmDeleteButton").performClick()

// Verify navigation to menu screen
verify(navigationActions).navigateTo(Screen.MENU)
}

@Test
fun deleteButtonWorks() {
composeTestRule.setContent { ProfileInformationScreen(profileViewModel, navigationActions) }

// Fill in the fields
composeTestRule.onNodeWithTag("editProfileUsername").performTextInput("JohnDoe")
composeTestRule.onNodeWithTag("editProfileEmail").performTextInput("john.doe@example.com")
composeTestRule.onNodeWithTag("editProfileBio").performTextInput("This is a bio")
composeTestRule.onNodeWithTag("profileSaveButton").performClick()
verify(navigationActions).navigateTo(Screen.PROFILE)
// Assert: Save button should now be enabled
composeTestRule.onNodeWithTag("profileDelete").assertIsEnabled()
// Scroll to the delete button if it's off-screen, then click it

// Click delete button
composeTestRule.onNodeWithTag("profileDelete").performScrollTo().performClick()

// Verify dialog appears
composeTestRule.onNodeWithTag("deleteConfirmationDialog").assertExists()

// Click confirm button
composeTestRule.onNodeWithTag("confirmDeleteButton").performClick()

// Verify navigation to menu screen
verify(navigationActions).navigateTo(Screen.MENU)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ import androidx.compose.ui.unit.sp
import com.github.lookupgroup27.lookup.R
import com.github.lookupgroup27.lookup.ui.navigation.NavigationActions
import com.github.lookupgroup27.lookup.ui.navigation.Screen
import com.github.lookupgroup27.lookup.ui.theme.CosmosPurple
import com.github.lookupgroup27.lookup.ui.theme.LightPurple
import com.github.lookupgroup27.lookup.ui.theme.PurpleBlue
import com.github.lookupgroup27.lookup.ui.theme.StarLightWhite
import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.android.gms.common.api.ApiException
Expand Down Expand Up @@ -80,7 +84,7 @@ fun SignInScreen(navigationActions: NavigationActions) {

Scaffold(
modifier = Modifier.fillMaxSize().testTag("auth_screen"),
containerColor = Color.Black,
containerColor = PurpleBlue,
topBar = {
TopAppBar(
title = {},
Expand All @@ -94,7 +98,7 @@ fun SignInScreen(navigationActions: NavigationActions) {
tint = Color.White)
}
},
colors = TopAppBarDefaults.topAppBarColors(containerColor = Color.Black))
colors = TopAppBarDefaults.topAppBarColors(containerColor = PurpleBlue))
},
content = { padding ->
Column(
Expand All @@ -104,27 +108,25 @@ fun SignInScreen(navigationActions: NavigationActions) {
.verticalScroll(
rememberScrollState()), // Enable vertical scrolling in all orientations
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center) {
Spacer(modifier = Modifier.height(16.dp))
verticalArrangement = Arrangement.Top) {
Spacer(modifier = Modifier.height(70.dp))

Image(
painter = painterResource(id = R.drawable.app_logo),
contentDescription = "App Logo",
modifier = Modifier.size(250.dp))
modifier = Modifier.size(200.dp))

Spacer(modifier = Modifier.height(16.dp))
Spacer(modifier = Modifier.height(30.dp))

Text(
modifier = Modifier.testTag("loginTitle"),
text = "Welcome to the Cosmos",
style =
MaterialTheme.typography.headlineMedium.copy(
fontSize = 42.sp, lineHeight = 50.sp, letterSpacing = 1.5.sp),
text = "Explore the Cosmos",
style = MaterialTheme.typography.displaySmall,
fontWeight = FontWeight.SemiBold,
textAlign = TextAlign.Center,
color = Color(0xFF8A9BB7))
color = StarLightWhite)

Spacer(modifier = Modifier.height(48.dp))
Spacer(modifier = Modifier.height(38.dp))

GoogleSignInButton(
onSignInClick = {
Expand All @@ -137,13 +139,14 @@ fun SignInScreen(navigationActions: NavigationActions) {
launcher.launch(googleSignInClient.signInIntent)
})

Spacer(modifier = Modifier.height(16.dp))
Spacer(modifier = Modifier.height(30.dp))

// Register Button
Button(
onClick = { navigationActions.navigateTo(Screen.REGISTER) },
modifier = Modifier.fillMaxWidth(0.8f).height(44.dp),
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF1A1A2E))) {
colors = ButtonDefaults.buttonColors(containerColor = LightPurple),
border = BorderStroke(1.dp, StarLightWhite)) {
Text("Register", color = Color.White)
}

Expand All @@ -153,7 +156,8 @@ fun SignInScreen(navigationActions: NavigationActions) {
Button(
onClick = { navigationActions.navigateTo(Screen.LOGIN) },
modifier = Modifier.fillMaxWidth(0.8f).height(44.dp),
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF1A1A2E))) {
colors = ButtonDefaults.buttonColors(containerColor = LightPurple),
border = BorderStroke(1.dp, StarLightWhite)) {
Text("Login", color = Color.White)
}
}
Expand All @@ -168,11 +172,11 @@ fun GoogleSignInButton(onSignInClick: () -> Unit) {
// Set dimensions based on orientation
val buttonHeight = if (isLandscape) 40.dp else 48.dp
val buttonWidthModifier =
if (isLandscape) Modifier.fillMaxWidth(0.7f) else Modifier.fillMaxWidth()
if (isLandscape) Modifier.fillMaxWidth(0.7f) else Modifier.fillMaxWidth(0.5f)

Button(
onClick = onSignInClick,
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFF1A1A2E)),
colors = ButtonDefaults.buttonColors(containerColor = CosmosPurple),
shape = RoundedCornerShape(50),
border = BorderStroke(1.dp, Color(0xFF9DACE6)),
modifier =
Expand All @@ -193,7 +197,7 @@ fun GoogleSignInButton(onSignInClick: () -> Unit) {

Text(
text = "Sign in with Google",
color = Color.White,
color = StarLightWhite,
fontSize = 14.sp, // Slightly smaller font in landscape
fontWeight = FontWeight.Medium)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.blur
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
Expand Down Expand Up @@ -164,10 +165,10 @@ fun FeedScreen(
Color.Black.copy(alpha = 0.6f))))
}) {
Image(
painter = painterResource(R.drawable.background_blurred),
painter = painterResource(R.drawable.landscape_background),
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize())
modifier = Modifier.fillMaxSize().blur(20.dp))

Scaffold(
containerColor = Color.Transparent,
Expand Down
19 changes: 13 additions & 6 deletions app/src/main/java/com/github/lookupgroup27/lookup/ui/map/Map.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import android.content.pm.PackageManager
import android.util.Log
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand All @@ -32,9 +34,12 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.blur
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
Expand All @@ -49,9 +54,9 @@ import com.github.lookupgroup27.lookup.ui.navigation.BottomNavigationMenu
import com.github.lookupgroup27.lookup.ui.navigation.LIST_TOP_LEVEL_DESTINATION
import com.github.lookupgroup27.lookup.ui.navigation.NavigationActions
import com.github.lookupgroup27.lookup.ui.navigation.Route
import com.github.lookupgroup27.lookup.ui.theme.DarkPurple
import com.github.lookupgroup27.lookup.ui.theme.LightPurple
import com.github.lookupgroup27.lookup.ui.theme.StarLightWhite
import com.google.firebase.auth.FirebaseAuth
import components.BackgroundImage

private const val LOCATION_PERMISSION_REQUEST_CODE: Int = 1001

Expand Down Expand Up @@ -164,10 +169,11 @@ fun MapScreen(navigationActions: NavigationActions, mapViewModel: MapViewModel)
Box(
modifier = Modifier.fillMaxSize().padding(innerPadding).testTag("map_screen"),
contentAlignment = Alignment.Center) {
BackgroundImage(
painterResId = R.drawable.background_blurred,
Image(
painter = painterResource(R.drawable.landscape_background),
contentDescription = stringResource(R.string.background_description),
testTag = "background_test_tag")
modifier = Modifier.fillMaxSize().testTag("background_test_tag").blur(20.dp),
contentScale = ContentScale.Crop)

Column(
horizontalAlignment = Alignment.CenterHorizontally,
Expand All @@ -183,7 +189,8 @@ fun MapScreen(navigationActions: NavigationActions, mapViewModel: MapViewModel)
onClick = { refreshKey++ },
colors =
androidx.compose.material3.ButtonDefaults.buttonColors(
containerColor = DarkPurple, contentColor = Color.White),
containerColor = LightPurple, contentColor = StarLightWhite),
border = BorderStroke(0.7.dp, StarLightWhite),
modifier = Modifier.testTag("refresh_button")) {
Text("Refresh")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun BottomNavigationMenu(
val context = LocalContext.current
val isOnline = remember { mutableStateOf(NetworkUtils.isNetworkAvailable(context)) }
NavigationBar(
modifier = Modifier.fillMaxWidth().height(60.dp).testTag("bottomNavigationMenu"),
modifier = Modifier.fillMaxWidth().height(80.dp).testTag("bottomNavigationMenu"),
containerColor = Color(0xFF0D1023),
content = {
tabList.forEach { tab ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.navigation.compose.rememberNavController
import com.github.lookupgroup27.lookup.R
import com.github.lookupgroup27.lookup.ui.navigation.NavigationActions
import com.github.lookupgroup27.lookup.ui.navigation.Screen
import com.github.lookupgroup27.lookup.ui.theme.StarLightWhite
import com.github.lookupgroup27.lookup.util.NetworkUtils
import com.github.lookupgroup27.lookup.util.ToastHelper
import components.BackgroundImage
Expand Down Expand Up @@ -64,7 +65,7 @@ fun LandingScreen(
}) {
// Background Image
BackgroundImage(
painterResId = R.drawable.landing_screen_bckgrnd,
painterResId = R.drawable.landscape_background,
contentDescription = stringResource(R.string.background_description),
)

Expand All @@ -77,19 +78,20 @@ fun LandingScreen(
.padding(16.dp),
verticalArrangement = Arrangement.SpaceBetween,
horizontalAlignment = Alignment.CenterHorizontally) {
Spacer(modifier = Modifier.height(25.dp))
// Top Prompt Text
Text(
text = "Click for full map view",
fontSize = 18.sp,
fontWeight = FontWeight.Bold,
color = Color.White,
fontWeight = FontWeight.Normal,
color = StarLightWhite,
modifier = Modifier.padding(top = 32.dp))

// Centered Logo Image
Image(
painter = painterResource(id = R.drawable.app_logo),
contentDescription = "Look Up Logo",
modifier = Modifier.size(250.dp).align(Alignment.CenterHorizontally),
modifier = Modifier.size(250.dp),
contentScale = ContentScale.Fit)

// Bottom Home Button
Expand Down
Loading
Loading