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
18 changes: 15 additions & 3 deletions app/src/main/java/com/cornellappdev/transit/models/Place.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.cornellappdev.transit.models

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import kotlinx.serialization.Serializable


Expand All @@ -22,7 +21,19 @@ enum class PlaceType {
BUS_STOP,

@Json(name = "applePlace")
APPLE_PLACE
APPLE_PLACE,

@Json(name = "eatery")
EATERY,

@Json(name = "library")
LIBRARY,

@Json(name = "gym")
GYM,

@Json(name = "printer")
PRINTER
}

/**
Expand All @@ -36,6 +47,7 @@ data class Place(
@Json(name = "detail") val detail: String?,
@Json(name = "type") var type: PlaceType
) {
//TODO: sublabel for bus stop should be the current distance away
val subLabel
get() = if (type == PlaceType.BUS_STOP) "Bus Stop" else detail.toString()
get() = if (type == PlaceType.BUS_STOP) "Bus Stop" else detail.orEmpty()
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ data class Eatery(
longitude = this.longitude ?: 0.0,
name = this.name,
detail = this.location,
type = PlaceType.APPLE_PLACE
type = PlaceType.EATERY
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ data class Printer(
longitude = this.longitude,
name = this.location,
detail = this.description,
type = PlaceType.APPLE_PLACE
type = PlaceType.PRINTER
)
}

Expand All @@ -55,6 +55,6 @@ data class Library(
longitude = this.longitude,
name = this.location,
detail = this.address,
type = PlaceType.APPLE_PLACE
type = PlaceType.LIBRARY
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ data class UpliftGym(
longitude = this.longitude,
name = this.name,
detail = getGymLocationString(this.name),
type = PlaceType.APPLE_PLACE
type = PlaceType.GYM
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fun MenuItem(type: PlaceType, label: String, sublabel: String, onClick: () -> Un
.clickable(onClick = onClick),
verticalAlignment = Alignment.CenterVertically
) {
//TODO: Add icons for each ecosystem type
if (type == PlaceType.APPLE_PLACE) {
Image(
painterResource(R.drawable.location_pin_gray),
Expand Down Expand Up @@ -69,8 +70,14 @@ fun MenuItem(type: PlaceType, label: String, sublabel: String, onClick: () -> Un
}


@Preview
@Preview(showBackground = true)
@Composable
fun PreviewMenuItem() {
private fun PreviewMenuItemBusStop() {
MenuItem(PlaceType.BUS_STOP, "Ithaca Commons", "Ithaca, NY", {})
}

@Preview(showBackground = true)
@Composable
private fun PreviewMenuItemApplePlace() {
MenuItem(PlaceType.APPLE_PLACE, "Apple Place", "Ithaca, NY", {})
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@ package com.cornellappdev.transit.ui.components.home

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
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.text.PlatformTextStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.cornellappdev.transit.ui.theme.PrimaryText
import com.cornellappdev.transit.ui.theme.SecondaryText
import com.cornellappdev.transit.ui.theme.Style

/**
Expand All @@ -25,41 +27,45 @@ import com.cornellappdev.transit.ui.theme.Style
fun BottomSheetLocationCard(
title: String,
subtitle1: String,
subtitle2: String = "",
isFavorite: Boolean,
onFavoriteClick: () -> Unit,
onClick: () -> Unit
) {
Column(
modifier = Modifier
.clickable {
onClick()
}
.fillMaxWidth()
.background(Color.White, shape = RoundedCornerShape(12.dp))
.clickable(onClick = onClick)
) {
Column(
Box(
modifier = Modifier
.fillMaxWidth()
.height(90.dp)
.background(color = Color.White, shape = RoundedCornerShape(12.dp))
.padding(16.dp)
) {
Text(
text = title,
style = Style.cardH1,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
text = subtitle1,
style = TextStyle(platformStyle = PlatformTextStyle(includeFontPadding = false)),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
text = subtitle2,
style = TextStyle(platformStyle = PlatformTextStyle(includeFontPadding = false)),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Column(
verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterVertically)
) {
Text(
text = title,
style = Style.cardH1,
color = PrimaryText,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(end = 32.dp)
)
Text(
text = subtitle1,
style = Style.heading3,
color = SecondaryText,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(end = 32.dp)
)
}

FavoritesStar(onFavoriteClick = onFavoriteClick, isFavorite = isFavorite)
}

}
}

Expand All @@ -68,7 +74,8 @@ fun BottomSheetLocationCard(
private fun PreviewBottomSheetLocationCard() {
BottomSheetLocationCard(
title = "Uris Hall",
subtitle1 = "Cornell University",
subtitle2 = "Open until 10:00 PM"
subtitle1 = "Bus Stop",
isFavorite = true,
onFavoriteClick = {}
) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion.BottomEnd
import androidx.compose.ui.Alignment.Companion.TopEnd
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.style.TextOverflow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.cornellappdev.transit.R
import com.cornellappdev.transit.models.ecosystem.Eatery
import com.cornellappdev.transit.ui.theme.DividerGray
Expand Down
Loading