Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…N-ANDROID-KORAILTALK into #23/feat-seatmap-api
  • Loading branch information
imtaejugkim committed Nov 28, 2024
2 parents f51794a + 529c671 commit 47e0053
Show file tree
Hide file tree
Showing 35 changed files with 2,327 additions and 132 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ dependencies {
implementation(libs.retrofit)
implementation(libs.retrofit.kotlin.serialization.converter)
implementation(libs.kotlinx.serialization.json)
// Lottie
implementation(libs.lottie.compose)
}
1 change: 1 addition & 0 deletions app/src/main/assets/and_korail.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.sopt.korailtalk.data.remote.model.response


import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class TrainSearchResponseDto(
@SerialName("timetableId")
val timetableId: Long?,
@SerialName("trainName")
val trainName: String,
@SerialName("departureTime")
val departureTime: String,
@SerialName("arrivalTime")
val arrivalTime: String,
@SerialName("standardPrice")
val standardPrice: Int,
@SerialName("premiumPrice")
val premiumPrice: Int,
@SerialName("isStandardSold")
val isStandardSold: Boolean,
@SerialName("isPremiumSold")
val isPremiumSold: Boolean,
@SerialName("travelTime")
val travelTime: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.sopt.korailtalk.domain.model

data class TrainInformation(
val timetableId: Long,
val trainName: String,
val departureTime: String,
val arrivalTime: String,
val standardPrice: Int,
val premiumPrice: Int,
val isStandardSold: Boolean,
val isPremiumSold: Boolean,
val travelTime: Int,
)
12 changes: 12 additions & 0 deletions app/src/main/java/com/sopt/korailtalk/domain/type/CarType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.sopt.korailtalk.domain.type

enum class CarType (
val text: String,
){
BASIC(
text = "일반실"
),
SPECIAL(
text = "특/우등"
)
}
27 changes: 27 additions & 0 deletions app/src/main/java/com/sopt/korailtalk/domain/type/SearchCarType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.sopt.korailtalk.domain.type

enum class SearchCarType (
val text: String,
){
BASIC(
text = "일반석"
),
TODDLER(
text = "유아동반"
),
WHEELCHAIR(
text = "휠체어"
),
AUTUWHEELCHAIR(
text = "전동휠체어"
),
SECOND_FLOOR(
text = "2층석"
),
BICYCLE(
text = "자전거"
),
HELPER(
text = "대피도우미"
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.sopt.korailtalk.domain.type

enum class SearchTrainStateType {
ACTIVE,
SALE,
SOLD_OUT
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.sopt.korailtalk.domain.type

enum class SearchTrainType (
val trainType: String,
val text: String,
){
ALL(
trainType = "모든열차"
text = "모든열차"
),
KTX(
trainType = "KTX"
text = "KTX"
),
ITX(
trainType = "ITX"
text = "ITX"
),
MUGUNGHWA(
trainType = "무궁화"
text = "무궁화"
)
}
12 changes: 12 additions & 0 deletions app/src/main/java/com/sopt/korailtalk/domain/type/SearchWayType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.sopt.korailtalk.domain.type

enum class SearchWayType (
val text: String,
){
DIRECT(
text = "직통"
),
TRANSFER(
text = "환승"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fun KorailBottomSheet(
shape = RoundedCornerShape(topStart = 0.dp, topEnd = 0.dp),
containerColor = KorailTalkTheme.colors.white,
contentColor = KorailTalkTheme.colors.blue02,
scrimColor = KorailTalkTheme.colors.transparentBlack50,
dragHandle = null
) {
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.sopt.korailtalk.R
import com.sopt.korailtalk.domain.type.SearchCarType
import com.sopt.korailtalk.domain.type.SearchTrainType
import com.sopt.korailtalk.domain.type.SearchWayType
import com.sopt.korailtalk.presentation.util.clickableWithoutRipple
import com.sopt.korailtalk.ui.theme.COLLAVORATIONANDROIDKORAILTALKTheme
import com.sopt.korailtalk.ui.theme.KorailTalkTheme
Expand Down Expand Up @@ -76,13 +78,51 @@ fun KorailOptionBottomSheetItem(

@Composable
fun TrainSelectContent() {
var activeIndex by remember { mutableIntStateOf(-1) }
var activeIndex by remember { mutableIntStateOf(0) }

val options = SearchTrainType.entries.toTypedArray()

options.forEachIndexed { index, option ->
KorailOptionBottomSheetItem(
option = option.trainType,
option = option.text,
isActive = activeIndex == index,
activeBgColor = KorailTalkTheme.colors.blue07,
activeContentColor = KorailTalkTheme.colors.blue02,
onClick = {
activeIndex = if (activeIndex == index) -1 else index
}
)
}
}

@Composable
fun SeatSelectContent() {
var activeIndex by remember { mutableIntStateOf(0) }

val options = SearchCarType.entries.toTypedArray()

options.forEachIndexed { index, option ->
KorailOptionBottomSheetItem(
option = option.text,
isActive = activeIndex == index,
activeBgColor = KorailTalkTheme.colors.blue07,
activeContentColor = KorailTalkTheme.colors.blue02,
onClick = {
activeIndex = if (activeIndex == index) -1 else index
}
)
}
}

@Composable
fun WaySelectContent() {
var activeIndex by remember { mutableIntStateOf(0) }

val options = SearchWayType.entries.toTypedArray()

options.forEachIndexed { index, option ->
KorailOptionBottomSheetItem(
option = option.text,
isActive = activeIndex == index,
activeBgColor = KorailTalkTheme.colors.blue07,
activeContentColor = KorailTalkTheme.colors.blue02,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ fun KorailWayInfoWithTime(
arrivalPlace: String,
departureTime: String,
arrivalTime: String,
modifier: Modifier = Modifier
) {
Row(modifier = Modifier
Row(modifier = modifier
.fillMaxWidth()
.background(color = KorailTalkTheme.colors.white)
.padding(23.dp),
Expand Down
Loading

0 comments on commit 47e0053

Please sign in to comment.