Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[둘리] 3, 4 단계 영화 티켓 예매 제출합니다. #47

Merged
merged 47 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
afc8cca
test: PriceCalculatorTest 생성
hyemdooly Apr 18, 2023
4ca2988
test: TicketTest 수정
hyemdooly Apr 18, 2023
aaace58
refactor: fold를 사용하여 코드 단축
hyemdooly Apr 18, 2023
067af6b
refactor: PlayingDateTimes로 클래스명과 코드 수정
hyemdooly Apr 18, 2023
f5c4730
refactor: package 이동으로 인한 수정
hyemdooly Apr 18, 2023
eeaeb22
refactor: 필요없는 주석 삭제
hyemdooly Apr 18, 2023
d8f91d8
refactor: TicketResultActivity View 세팅 코드 분리
hyemdooly Apr 18, 2023
417aca7
feat: SeatSelectActivity xml 작성
hyemdooly Apr 20, 2023
d9672f2
refactor: DateSpinnerListener 삭제, findViewById 한번만 하도록 수정
hyemdooly Apr 20, 2023
e174e3d
refactor: MovieListItemListener 분리
hyemdooly Apr 20, 2023
debeaca
fix: onItemClickListener -> SelectedListener 수정
hyemdooly Apr 20, 2023
76c0a90
feat: SeatView 구현
hyemdooly Apr 20, 2023
3738630
refactor: Ticket Model 구조 변경
hyemdooly Apr 20, 2023
e892f4b
feat: 좌석 선택 페이지로 넘어가도록 수정
hyemdooly Apr 20, 2023
2c8cc14
feat: 좌석 Grade 클래스 추가
hyemdooly Apr 20, 2023
21c892b
feat: TheaterInfo 생성
hyemdooly Apr 21, 2023
61f7022
feat: SeatSelectSystem 생성
hyemdooly Apr 21, 2023
09e0766
feat: SelectResult Success sead class 생성
hyemdooly Apr 21, 2023
cf52062
refactor: PriceCalculator 리팩토링
hyemdooly Apr 21, 2023
8291de2
feat: PriceSystem 생성
hyemdooly Apr 21, 2023
f4d6e7c
refactor: JUnit4 버전 수정
hyemdooly Apr 21, 2023
cd9c49e
feat: Seat 클래스 생성, seats custom getter 생성
hyemdooly Apr 21, 2023
e351227
refactor: 패키지명 수정
hyemdooly Apr 21, 2023
7ff59f2
feat: 좌석 선택 액티비티 구현
hyemdooly Apr 21, 2023
55df55c
feat: Listener 수정, 자리 선택 액티비티 구현 완료
hyemdooly Apr 21, 2023
025733a
refactor: Ticket 액티비티에서 자리 순서대로 출력하도록 수정
hyemdooly Apr 21, 2023
61c6a5f
refactor: count max값 추가
hyemdooly Apr 21, 2023
29d7245
refactor: PriceModel 구현 및 수정
hyemdooly Apr 22, 2023
a410609
feat: Dialog 구현
hyemdooly Apr 22, 2023
1e294bc
feat: Dialog NegativeButton Listener 추가
hyemdooly Apr 22, 2023
371ec72
refactor: UI 변경 사항 수정
hyemdooly Apr 22, 2023
9c41ac5
test: MovieDetailActivity, SeatSelectActivity UI Test 추가
hyemdooly Apr 22, 2023
21c60b1
test: TicketResultActivity UI Test 추가
hyemdooly Apr 22, 2023
04b076e
feat: ListView -> RecyclerView로 변경
hyemdooly Apr 22, 2023
74fbd10
feat: RecyclerView Ad View 추가
hyemdooly Apr 22, 2023
cc1abcc
refactor: ViewHolder property private 수정
hyemdooly Apr 22, 2023
3b89b78
test: MovieListActivityTest 추가
hyemdooly Apr 22, 2023
ea36840
docs: Update README.md
hyemdooly Apr 22, 2023
aa5050c
refactor: MovieDetailActivityTest 수정
hyemdooly Apr 24, 2023
8a3b1df
refactor: MovieDetailActivityTest 수정
hyemdooly Apr 24, 2023
55c309b
refactor: Listener interface 삭제
hyemdooly Apr 24, 2023
27c24b4
refactor: layoutManager xml에서 지정, View에서 Bundle이 아닌 Data 주입
hyemdooly Apr 24, 2023
03d294e
refactor: ReserveInfoModel 추가 및 수정
hyemdooly Apr 24, 2023
bb03b6a
refactor: sealed class view holder, view type enum class 생성, item들 xm…
hyemdooly Apr 24, 2023
0522cc9
Merge remote-tracking branch 'origin/step4' into step4
hyemdooly Apr 24, 2023
8f35ee7
refactor: 코드 변경에 따른 테스트 수정, 패키지 변경
hyemdooly Apr 24, 2023
9f09fcd
refactor: Log 삭제
hyemdooly Apr 24, 2023
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
Prev Previous commit
Next Next commit
refactor: PriceModel 구현 및 수정
  • Loading branch information
hyemdooly committed Apr 22, 2023
commit 29d7245d72982bd41cf3508e658c98ed4b6b6964
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class MovieDetailActivity : AppCompatActivity() {
return
}
MovieDetailView(findViewById(R.id.layout_detail_info)).set(movie)
ReservationInfoView(findViewById(R.id.layout_reservation_info)).set(savedInstanceState, movie)
ReservationInfoView(findViewById(R.id.layout_reservation_info)).set(
savedInstanceState,
movie,
)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package woowacourse.movie.activity.seatselect

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import woowacourse.movie.R
Expand Down Expand Up @@ -33,25 +34,33 @@ class SeatSelectActivity : AppCompatActivity(), InjectedModelListener<TicketMode
val seatSelectSystem = SeatSelectSystem(Theater.info, count)
val priceSystem = PriceSystem(PriceCalculator(Theater.policies), dateTime!!)
val seatView =
SeatSelectView(findViewById(R.id.layout_select_seat), seatSelectSystem, priceSystem, this)
SeatSelectView(
findViewById(R.id.layout_select_seat),
seatSelectSystem,
priceSystem,
this,
)

seatView.set(title!!, dateTime)

Log.d("hyem", seatSelectSystem.seats.toString())
}

private fun isDataNull(title: String?, dateTime: LocalDateTime?, count: Int): Boolean {
return title == null || dateTime == null || count == -1
}

override fun onClick(model: TicketModel) {
val intent = Intent(this, TicketResultActivity::class.java)
intent.putExtra(TicketResultActivity.INFO_KEY, model)
startActivity(intent)
}

companion object {
private const val DATA_LOADING_ERROR_MESSAGE = "데이터가 로딩되지 않았습니다. 다시 시도해주세요."
private const val PRICE_KEY = "PRICE"
const val TITLE_KEY = "TITLE"
const val DATETIME_KEY = "DATETIME"
const val COUNT_KEY = "COUNT"
}

override fun onClick(model: TicketModel) {
val intent = Intent(this, TicketResultActivity::class.java)
intent.putExtra(TicketResultActivity.INFO_KEY, model)
startActivity(intent)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import woowacourse.movie.domain.system.PriceSystem
import woowacourse.movie.domain.system.SeatSelectSystem
import woowacourse.movie.domain.system.SelectResult
import woowacourse.movie.domain.ticket.Ticket
import woowacourse.movie.model.PriceModel
import woowacourse.movie.model.TicketModel
import woowacourse.movie.model.toPresentation
import woowacourse.movie.util.Theater
import java.text.DecimalFormat
import java.time.LocalDateTime

class SeatSelectView(
Expand Down Expand Up @@ -55,11 +55,8 @@ class SeatSelectView(
}
}

private fun setPrice(price: Int) {
priceView.text = viewGroup.context.getString(
R.string.price,
DecimalFormat(viewGroup.context.getString(R.string.decimal_format)).format(price),
)
private fun setPrice(price: PriceModel) {
priceView.text = viewGroup.context.getString(R.string.price, price.price)
}

private fun setSeatViews() {
Expand All @@ -77,7 +74,7 @@ class SeatSelectView(
is SelectResult.Success.Deselection -> {
textView.setBackgroundColor(textView.context.getColor(R.color.white))
nextButton.isEnabled = false
setPrice(result.seatPrice.price)
setPrice(result.seatPrice.toPresentation())
}
is SelectResult.MaxSelection -> {
Toast.makeText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.widget.TextView
import woowacourse.movie.R
import woowacourse.movie.model.SeatModel
import woowacourse.movie.model.TicketModel
import java.text.DecimalFormat
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

Expand All @@ -14,7 +13,7 @@ class TicketView(private val viewGroup: ViewGroup) {
initTitle(ticket.title)
initPlayingDate(ticket.playingDateTime)
initCountSeats(ticket.count, ticket.seats)
initPricePayment(ticket.price)
initPricePayment(ticket.price.price)
}

private fun initTitle(title: String) {
Expand All @@ -37,11 +36,11 @@ class TicketView(private val viewGroup: ViewGroup) {
viewGroup.context.getString(R.string.normal_count_seat, count, convertSeats)
}

private fun initPricePayment(price: Int) {
private fun initPricePayment(price: String) {
viewGroup.findViewById<TextView>(R.id.text_price_payment).text =
viewGroup.context.getString(
R.string.price_payment,
DecimalFormat(viewGroup.context.getString(R.string.decimal_format)).format(price),
price,
)
}
}
5 changes: 3 additions & 2 deletions app/src/main/java/woowacourse/movie/model/PriceMapper.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package woowacourse.movie.model

import woowacourse.movie.domain.price.Price
import java.text.DecimalFormat

fun Price.toPresentation(): Int {
return price
fun Price.toPresentation(): PriceModel {
return PriceModel(DecimalFormat("#,###").format(price))
}
3 changes: 3 additions & 0 deletions app/src/main/java/woowacourse/movie/model/PriceModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package woowacourse.movie.model

data class PriceModel(val price: String) : java.io.Serializable
2 changes: 1 addition & 1 deletion app/src/main/java/woowacourse/movie/model/TicketModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ data class TicketModel(
val playingDateTime: LocalDateTime,
val count: Int,
val seats: List<SeatModel>,
val price: Int
val price: PriceModel
) : java.io.Serializable