Skip to content

Commit 7d0ba95

Browse files
Changed color usage to themes, added helvetica bold font and adjusted typographies, adjusted color schemes, added dynamicColor to false for theme to apply properly, used predefined typography for some text
1 parent 010c21a commit 7d0ba95

File tree

8 files changed

+71
-46
lines changed

8 files changed

+71
-46
lines changed

app/src/main/java/com/cornellappdev/hustle/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class MainActivity : ComponentActivity() {
2424

2525
enableEdgeToEdge()
2626
setContent {
27-
HustleTheme {
27+
HustleTheme(dynamicColor = false) {
2828
val rootUiState = rootViewModel.collectUiStateValue()
2929
if (!rootUiState.isLoading) {
3030
HustleApp(isSignedIn = rootUiState.isSignedIn)
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.cornellappdev.hustle.ui.components.onboarding
22

3+
import androidx.compose.animation.animateContentSize
34
import androidx.compose.foundation.layout.Arrangement
45
import androidx.compose.foundation.layout.PaddingValues
56
import androidx.compose.foundation.layout.Row
@@ -9,17 +10,15 @@ import androidx.compose.foundation.shape.RoundedCornerShape
910
import androidx.compose.material3.Button
1011
import androidx.compose.material3.ButtonDefaults
1112
import androidx.compose.material3.CircularProgressIndicator
13+
import androidx.compose.material3.MaterialTheme
1214
import androidx.compose.material3.Text
1315
import androidx.compose.runtime.Composable
1416
import androidx.compose.ui.Alignment
1517
import androidx.compose.ui.Modifier
16-
import androidx.compose.ui.text.font.FontWeight
1718
import androidx.compose.ui.tooling.preview.Preview
1819
import androidx.compose.ui.unit.dp
19-
import androidx.compose.ui.unit.sp
20-
import com.cornellappdev.hustle.ui.theme.HelveticaNeue
21-
import com.cornellappdev.hustle.ui.theme.HustleColors
2220
import com.cornellappdev.hustle.ui.theme.HustleSpacing
21+
import com.cornellappdev.hustle.ui.theme.HustleTheme
2322

2423
@Composable
2524
fun SignInButton(
@@ -32,10 +31,10 @@ fun SignInButton(
3231
enabled = !isLoading,
3332
modifier = modifier.fillMaxWidth(),
3433
colors = ButtonDefaults.buttonColors(
35-
containerColor = HustleColors.accentGreen,
36-
contentColor = HustleColors.hustleGreen,
37-
disabledContainerColor = HustleColors.accentGreen,
38-
disabledContentColor = HustleColors.hustleGreen
34+
containerColor = MaterialTheme.colorScheme.secondary,
35+
contentColor = MaterialTheme.colorScheme.onSecondary,
36+
disabledContainerColor = MaterialTheme.colorScheme.secondary,
37+
disabledContentColor = MaterialTheme.colorScheme.onSecondary
3938
),
4039
contentPadding = PaddingValues(
4140
vertical = HustleSpacing.medium
@@ -44,19 +43,18 @@ fun SignInButton(
4443
) {
4544
Row(
4645
verticalAlignment = Alignment.CenterVertically,
47-
horizontalArrangement = Arrangement.spacedBy(HustleSpacing.small)
46+
horizontalArrangement = Arrangement.spacedBy(HustleSpacing.small),
47+
modifier = Modifier.animateContentSize()
4848
) {
4949
if (isLoading) {
5050
CircularProgressIndicator(
51-
color = HustleColors.hustleGreen,
51+
color = MaterialTheme.colorScheme.onSecondary,
5252
modifier = Modifier.size(24.dp)
5353
)
5454
}
5555
Text(
5656
text = if (isLoading) "Signing in..." else "Log in with NetID",
57-
fontFamily = HelveticaNeue,
58-
fontSize = 24.sp,
59-
fontWeight = FontWeight.Bold
57+
style = MaterialTheme.typography.titleLarge
6058
)
6159
}
6260

@@ -66,5 +64,7 @@ fun SignInButton(
6664
@Preview(showBackground = true)
6765
@Composable
6866
private fun SignInButtonPreview() {
69-
SignInButton(onClick = {}, isLoading = true)
67+
HustleTheme(dynamicColor = false) {
68+
SignInButton(onClick = {}, isLoading = true)
69+
}
7070
}

app/src/main/java/com/cornellappdev/hustle/ui/navigation/HustleNavigation.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.cornellappdev.hustle.ui.navigation
22

33
import androidx.compose.foundation.layout.padding
4+
import androidx.compose.material3.MaterialTheme
45
import androidx.compose.material3.Scaffold
56
import androidx.compose.runtime.Composable
67
import androidx.compose.ui.Modifier
@@ -10,7 +11,6 @@ import com.cornellappdev.hustle.ui.navigation.navgraphs.homeNavGraph
1011
import com.cornellappdev.hustle.ui.navigation.navgraphs.messagesNavGraph
1112
import com.cornellappdev.hustle.ui.navigation.navgraphs.onboardingNavGraph
1213
import com.cornellappdev.hustle.ui.navigation.navgraphs.profileNavGraph
13-
import com.cornellappdev.hustle.ui.theme.HustleColors
1414

1515
@Composable
1616
fun HustleNavigation(
@@ -25,7 +25,7 @@ fun HustleNavigation(
2525
BottomNavigationBar(navController = navController)
2626
}
2727
},
28-
containerColor = if (!isSignedIn) HustleColors.hustleGreen else HustleColors.white
28+
containerColor = if (!isSignedIn) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.background
2929
) { innerPadding ->
3030
NavHost(
3131
navController = navController,

app/src/main/java/com/cornellappdev/hustle/ui/screens/onboarding/SignInScreen.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Column
77
import androidx.compose.foundation.layout.fillMaxSize
88
import androidx.compose.foundation.layout.padding
99
import androidx.compose.material3.Icon
10+
import androidx.compose.material3.MaterialTheme
1011
import androidx.compose.material3.Text
1112
import androidx.compose.runtime.Composable
1213
import androidx.compose.runtime.LaunchedEffect
@@ -30,6 +31,7 @@ import com.cornellappdev.hustle.ui.components.general.ErrorMessage
3031
import com.cornellappdev.hustle.ui.components.onboarding.SignInButton
3132
import com.cornellappdev.hustle.ui.theme.HustleColors
3233
import com.cornellappdev.hustle.ui.theme.HustleSpacing
34+
import com.cornellappdev.hustle.ui.theme.HustleTheme
3335
import com.cornellappdev.hustle.ui.theme.InstrumentSans
3436
import com.cornellappdev.hustle.ui.viewmodels.ActionState
3537
import com.cornellappdev.hustle.ui.viewmodels.onboarding.SignInScreenViewModel
@@ -144,9 +146,7 @@ private fun WelcomeText() {
144146
Text(
145147
text = "Browse. Buy. Book.",
146148
color = HustleColors.white,
147-
fontFamily = InstrumentSans,
148-
fontSize = 24.sp,
149-
fontWeight = FontWeight.Medium
149+
style = MaterialTheme.typography.headlineMedium
150150
)
151151
}
152152
}
@@ -163,9 +163,11 @@ class SignInErrorMessageProvider : PreviewParameterProvider<String?> {
163163
private fun SignInScreenPreview(
164164
@PreviewParameter(SignInErrorMessageProvider::class) errorMessage: String?
165165
) {
166-
SignInScreenContent(
167-
onGoogleSignInButtonClick = {},
168-
isSignInLoading = false,
169-
errorMessage = errorMessage,
170-
onDismissError = {})
166+
HustleTheme(dynamicColor = false) {
167+
SignInScreenContent(
168+
onGoogleSignInButtonClick = {},
169+
isSignInLoading = false,
170+
errorMessage = errorMessage,
171+
onDismissError = {})
172+
}
171173
}

app/src/main/java/com/cornellappdev/hustle/ui/theme/Color.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import androidx.compose.ui.graphics.Color
55
object HustleColors {
66
val hustleGreen = Color(0xFF004346)
77
val accentGreen = Color(0xFFD5EFB4)
8-
val primary = Color(0xFF000000)
9-
val tertiary = Color(0xFF2D2D2D)
10-
val secondary = Color(0xFF7D8288)
8+
val primaryBlack = Color(0xFF000000)
9+
val tertiaryGray = Color(0xFF2D2D2D)
10+
val secondaryGray = Color(0xFF7D8288)
1111
val iconInactive = Color(0xFFBEBEBE)
1212
val stroke = Color(0xFFD6D6D6)
1313
val wash = Color(0xFFF5F5F5)

app/src/main/java/com/cornellappdev/hustle/ui/theme/Theme.kt

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,37 @@ import androidx.compose.ui.platform.LocalContext
1212

1313
// TODO: Replace with dark mode colors when decided
1414
private val DarkColorScheme = darkColorScheme(
15-
primary = HustleColors.primary,
16-
secondary = HustleColors.secondary,
17-
tertiary = HustleColors.tertiary
15+
primary = HustleColors.hustleGreen,
16+
onPrimary = HustleColors.white,
17+
secondary = HustleColors.accentGreen,
18+
onSecondary = HustleColors.hustleGreen,
19+
surface = HustleColors.white,
20+
onSurface = HustleColors.primaryBlack,
21+
onSurfaceVariant = HustleColors.secondaryGray,
22+
surfaceVariant = HustleColors.wash,
23+
surfaceContainer = HustleColors.wash,
24+
surfaceContainerHigh = HustleColors.stroke,
25+
background = HustleColors.white,
26+
onBackground = HustleColors.primaryBlack,
27+
outline = HustleColors.stroke,
28+
outlineVariant = HustleColors.iconInactive
1829
)
1930

2031
private val LightColorScheme = lightColorScheme(
21-
primary = HustleColors.primary,
22-
secondary = HustleColors.secondary,
23-
tertiary = HustleColors.tertiary
32+
primary = HustleColors.hustleGreen,
33+
onPrimary = HustleColors.white,
34+
secondary = HustleColors.accentGreen,
35+
onSecondary = HustleColors.hustleGreen,
36+
surface = HustleColors.white,
37+
onSurface = HustleColors.primaryBlack,
38+
onSurfaceVariant = HustleColors.secondaryGray,
39+
surfaceVariant = HustleColors.wash,
40+
surfaceContainer = HustleColors.wash,
41+
surfaceContainerHigh = HustleColors.stroke,
42+
background = HustleColors.white,
43+
onBackground = HustleColors.primaryBlack,
44+
outline = HustleColors.stroke,
45+
outlineVariant = HustleColors.iconInactive
2446

2547
/* Other default colors to override
2648
background = Color(0xFFFFFBFE),

app/src/main/java/com/cornellappdev/hustle/ui/theme/Type.kt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.cornellappdev.hustle.R
1212
val InstrumentSans = FontFamily(
1313
Font(R.font.instrument_sans_regular, FontWeight.Normal),
1414
Font(R.font.instrument_sans_medium, FontWeight.Medium),
15+
Font(R.font.instrument_sans_bold, FontWeight.Bold),
1516
Font(R.font.instrument_sans_bold_italic, FontWeight.Bold, FontStyle.Italic)
1617
)
1718

@@ -21,20 +22,25 @@ val HelveticaNeue = FontFamily(
2122
Font(R.font.helvetica_neue_bold, FontWeight.Bold)
2223
)
2324
val HustleTypography = Typography(
25+
displayLarge = TextStyle(
26+
fontFamily = InstrumentSans,
27+
fontWeight = FontWeight.Bold,
28+
fontSize = 64.sp
29+
),
2430
headlineLarge = TextStyle(
2531
fontFamily = InstrumentSans,
2632
fontWeight = FontWeight.Medium,
27-
fontSize = 32.sp
33+
fontSize = 36.sp
2834
),
2935
headlineMedium = TextStyle(
3036
fontFamily = InstrumentSans,
3137
fontWeight = FontWeight.Medium,
32-
fontSize = 22.sp
38+
fontSize = 24.sp
3339
),
3440
headlineSmall = TextStyle(
3541
fontFamily = InstrumentSans,
36-
fontWeight = FontWeight.Medium,
37-
fontSize = 20.sp
42+
fontWeight = FontWeight.Bold,
43+
fontSize = 18.sp
3844
),
3945
bodyLarge = TextStyle(
4046
fontFamily = InstrumentSans,
@@ -48,8 +54,8 @@ val HustleTypography = Typography(
4854
),
4955
titleLarge = TextStyle(
5056
fontFamily = HelveticaNeue,
51-
fontWeight = FontWeight.Medium,
52-
fontSize = 18.sp
57+
fontWeight = FontWeight.Bold,
58+
fontSize = 24.sp
5359
),
5460
titleMedium = TextStyle(
5561
fontFamily = HelveticaNeue,
@@ -70,10 +76,5 @@ val HustleTypography = Typography(
7076
fontFamily = HelveticaNeue,
7177
fontWeight = FontWeight.Normal,
7278
fontSize = 12.sp
73-
),
74-
labelSmall = TextStyle(
75-
fontFamily = InstrumentSans,
76-
fontWeight = FontWeight.Normal,
77-
fontSize = 14.sp
78-
),
79+
)
7980
)
66.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)