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 @@ -14,6 +14,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -36,11 +37,11 @@ fun CalendarButton(onClick: () -> Unit) {
{
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_calendar),
contentDescription = "Change date",
contentDescription = stringResource(R.string.change_date),
modifier = Modifier.size(16.dp)
)

Text("Change date", style = EateryBlueTypography.button)
Text(stringResource(R.string.change_date), style = EateryBlueTypography.button)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.cornellappdev.android.eatery.R
import com.cornellappdev.android.eatery.data.models.Eatery
import com.cornellappdev.android.eatery.ui.theme.EateryBlueTypography
import com.cornellappdev.android.eatery.ui.theme.GrayFive
Expand Down Expand Up @@ -62,13 +64,13 @@ fun EateryHourBottomSheet(
Row {
Icon(
imageVector = Icons.Outlined.Schedule,
contentDescription = "Hours Icon",
contentDescription = null,
tint = Color.Black,
modifier = Modifier.size(32.dp)
)
Spacer(modifier = Modifier.size(ButtonDefaults.IconSpacing))
Text(
text = "Hours",
text = stringResource(R.string.hours_title),
style = EateryBlueTypography.h4,
color = Color.Black
)
Expand All @@ -94,10 +96,11 @@ fun EateryHourBottomSheet(
val openUntil = eatery.getOpenUntil()
Text(
modifier = Modifier.padding(top = 2.dp),
text =
if (openUntil == null) "Closed"
else if (eatery.isClosingSoon()) "Closing at $openUntil"
else ("Open until $openUntil"),
text = when {
openUntil == null -> stringResource(R.string.closed)
eatery.isClosingSoon() -> stringResource(R.string.closing_at, openUntil)
else -> stringResource(R.string.open_until, openUntil)
},
style = TextStyle(
fontWeight = FontWeight.SemiBold, fontSize = 16.sp
),
Expand Down Expand Up @@ -144,7 +147,12 @@ fun EateryHourBottomSheet(
colors = ButtonDefaults.buttonColors(containerColor = GrayZero),
shape = RoundedCornerShape(corner = CornerSize(24.dp)),
) {
Text("Close", color = Color.Black, fontSize = 18.sp, fontWeight = FontWeight.SemiBold)
Text(
stringResource(R.string.close),
color = Color.Black,
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold
)
}

Spacer(modifier = Modifier.height(12.dp))
Expand All @@ -154,7 +162,7 @@ fun EateryHourBottomSheet(
modifier = Modifier.fillMaxWidth()
) {
Text(
"Report an issue",
stringResource(R.string.report_an_issue),
color = Color.Black,
fontSize = 14.sp,
fontWeight = FontWeight.SemiBold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.cornellappdev.android.eatery.R
import com.cornellappdev.android.eatery.data.models.Eatery
import com.cornellappdev.android.eatery.data.models.Event
import com.cornellappdev.android.eatery.data.models.MealTime
Expand Down Expand Up @@ -107,7 +109,7 @@ fun EateryMenusBottomSheet(
modifier = Modifier.weight(1f)
) {
Text(
text = "Menus",
text = stringResource(R.string.menus_title),
style = EateryBlueTypography.h4,
)
}
Expand Down Expand Up @@ -233,7 +235,7 @@ fun EateryMenusBottomSheet(
)
) {
Text(
text = "Show menu",
text = stringResource(R.string.show_menu),
style = EateryBlueTypography.h5
)
}
Expand All @@ -246,7 +248,7 @@ fun EateryMenusBottomSheet(
}
) {
Text(
text = "Reset",
text = stringResource(R.string.reset),
style = TextStyle(
fontSize = 14.sp,
lineHeight = 17.5.sp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.core.net.toUri
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.cornellappdev.android.eatery.R
import com.cornellappdev.android.eatery.ui.components.home.EateryDetailLoadingScreen
import com.cornellappdev.android.eatery.ui.theme.EateryBlue
import com.cornellappdev.android.eatery.ui.theme.EateryBlueTypography
Expand Down Expand Up @@ -76,8 +78,8 @@ private fun AppStoreRatingDialog(navigateToSupport: () -> Unit, onDismiss: () ->
0 -> RatingPrompt(rating, onChangeRating = { rating = it }, onDismiss = onDismiss)

5 -> ActionPrompt(
"Awesome! We'd love to hear more in a review",
"Open PlayStore",
stringResource(R.string.app_store_rating_positive_message),
stringResource(R.string.app_store_rating_positive_button),
onButtonPress = {
try {
context.startActivity(
Expand All @@ -101,8 +103,8 @@ private fun AppStoreRatingDialog(navigateToSupport: () -> Unit, onDismiss: () ->
)

else -> ActionPrompt(
"Sorry to hear that.",
"Visit support",
stringResource(R.string.app_store_rating_negative_message),
stringResource(R.string.app_store_rating_negative_button),
onButtonPress = { navigateToSupport(); onDismiss() },
onDismiss = onDismiss,
)
Expand Down Expand Up @@ -145,7 +147,10 @@ private fun ActionPromptPreview() {
private fun RatingPrompt(rating: Int, onChangeRating: (Int) -> Unit, onDismiss: () -> Unit) {
AppStoreRatingCardBorder(onDismiss = onDismiss) {
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
Text("How is your experience so far?", style = EateryBlueTypography.h4)
Text(
stringResource(R.string.app_store_rating_question),
style = EateryBlueTypography.h4
)
RatingBar(rating, onChangeRating)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.cornellappdev.android.eatery.R
import com.cornellappdev.android.eatery.ui.theme.GrayFive
import com.cornellappdev.android.eatery.ui.theme.Yellow

Expand Down Expand Up @@ -39,6 +41,8 @@ fun FavoriteIcon(isFavorite: Boolean, modifier: Modifier = Modifier) {
imageVector = if (isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline,
tint = if (isFavorite) Yellow else GrayFive,
modifier = modifier,
contentDescription = "favorite: $isFavorite"
contentDescription = stringResource(
if (isFavorite) R.string.favorite_button_remove else R.string.favorite_button_add
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.cornellappdev.android.eatery.R
import com.cornellappdev.android.eatery.ui.theme.GrayZero
import com.cornellappdev.android.eatery.ui.theme.colorInterp

Expand Down Expand Up @@ -62,7 +63,7 @@ fun FilterButton(
onFilterClicked: () -> Unit,
selected: Boolean,
text: String,
icon: ImageVector? = null
hasExpandIcon: Boolean = false
) {
val progress by animateFloatAsState(
targetValue = if (selected) 0f else 1f,
Expand All @@ -82,11 +83,11 @@ fun FilterButton(
)
) {
Text(text)
if (icon != null) {
if (hasExpandIcon) {
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
Icon(
Icons.Default.ExpandMore,
contentDescription = "Favorite",
contentDescription = stringResource(R.string.expand_filters),
modifier = Modifier.size(ButtonDefaults.IconSize)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.cornellappdev.android.eatery.R
import com.cornellappdev.android.eatery.ui.theme.EateryBlue
Expand All @@ -38,7 +39,7 @@ fun NoEateryFound(modifier: Modifier = Modifier, resetFilters: () -> Unit) {
tint = GrayTwo
)
Text(
text = "No eatery found...",
text = stringResource(R.string.no_eatery_found),
style = EateryBlueTypography.h5,
modifier = Modifier.padding(top = 12.dp)
)
Expand All @@ -53,7 +54,7 @@ fun NoEateryFound(modifier: Modifier = Modifier, resetFilters: () -> Unit) {
}
) {
Text(
text = "Reset filters",
text = stringResource(R.string.reset_filters),
color =
Color.White
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.Placeholder
import androidx.compose.ui.text.PlaceholderVerticalAlign
import androidx.compose.ui.text.SpanStyle
Expand All @@ -48,17 +49,18 @@ fun PaymentMethodsAvailable(
hide: () -> Unit
) {
val paymentMethodsAvailableText = buildAnnotatedString {
append("Pay with ")
append(stringResource(R.string.payment_methods_pay_with))
append(" ")
if (selectedPaymentMethods.containsAll(PaymentMethodsAvailable.entries)) {
append("all payment methods")
append(stringResource(R.string.payment_methods_all))
} else {
selectedPaymentMethods.forEachIndexed { index, paymentMethod ->
appendInlineContent(id = paymentMethod.name)
pushStyle(SpanStyle(color = paymentMethod.color))
append(" ${paymentMethod.text}")
append(" ${stringResource(paymentMethod.textRes)}")
pop()
if (index != selectedPaymentMethods.lastIndex) {
append(" or ")
append(" ${stringResource(R.string.payment_methods_or)} ")
}
}
}
Expand Down Expand Up @@ -88,7 +90,7 @@ fun PaymentMethodsAvailable(
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = "Payment Methods",
text = stringResource(R.string.payment_methods_title),
style = EateryBlueTypography.h4,
modifier = Modifier.padding(bottom = 12.dp)
)
Expand All @@ -101,7 +103,11 @@ fun PaymentMethodsAvailable(
.size(40.dp)
.background(color = GrayZero, shape = CircleShape)
) {
Icon(Icons.Default.Close, contentDescription = "Close", tint = Color.Black)
Icon(
Icons.Default.Close,
contentDescription = stringResource(R.string.payment_methods_close),
tint = Color.Black
)
}
}

Expand All @@ -124,7 +130,7 @@ fun PaymentMethodsAvailable(
) {
Icon(
painter = painterResource(id = R.drawable.ic_payment_swipes),
contentDescription = "Swipes",
contentDescription = stringResource(R.string.payment_methods_meal_swipes),
tint = if (selectedPaymentMethods.contains(PaymentMethodsAvailable.SWIPES)) EateryBlue else GrayTwo
)
}
Expand All @@ -143,7 +149,7 @@ fun PaymentMethodsAvailable(
) {
Icon(
painter = painterResource(id = R.drawable.ic_payment_brbs),
contentDescription = "BRBs",
contentDescription = stringResource(R.string.payment_methods_brbs),
tint = if (selectedPaymentMethods.contains(PaymentMethodsAvailable.BRB)) Red else GrayTwo
)
}
Expand All @@ -161,7 +167,7 @@ fun PaymentMethodsAvailable(
) {
Icon(
painter = painterResource(id = R.drawable.ic_payment_cash),
contentDescription = "Cash or card",
contentDescription = stringResource(R.string.payment_methods_cash_or_credit),
tint = if (selectedPaymentMethods.contains(PaymentMethodsAvailable.CASH)) Green else GrayTwo
)
}
Expand Down Expand Up @@ -189,16 +195,24 @@ fun PaymentMethodsAvailable(
)
) {
Text(
text = "Close",
text = stringResource(R.string.payment_methods_close),
style = EateryBlueTypography.h5,
modifier = Modifier.padding(top = 8.dp, bottom = 8.dp)
)
}
}
}

enum class PaymentMethodsAvailable(val drawable: Int, val color: Color, val text: String) {
BRB(drawable = R.drawable.ic_small_brbs, color = Red, text = "BRBs"),
CASH(drawable = R.drawable.ic_small_cash, color = Green, text = "Cash or credit"),
SWIPES(drawable = R.drawable.ic_small_swipes, color = EateryBlue, text = "Meal swipes");
enum class PaymentMethodsAvailable(val drawable: Int, val color: Color, val textRes: Int) {
BRB(drawable = R.drawable.ic_small_brbs, color = Red, textRes = R.string.payment_methods_brbs),
CASH(
drawable = R.drawable.ic_small_cash,
color = Green,
textRes = R.string.payment_methods_cash_or_credit
),
SWIPES(
drawable = R.drawable.ic_small_swipes,
color = EateryBlue,
textRes = R.string.payment_methods_meal_swipes
);
}
Loading
Loading