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
feat: SeatView 구현
  • Loading branch information
hyemdooly committed Apr 21, 2023
commit 76c0a90aacea286bbd3755977329d42b06180976
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ class SeatSelectActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_seat_select)
val seatView = SeatView(findViewById(R.id.layout_seat_area))
seatView.set()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package woowacourse.movie.activity.seatselect

import android.view.ViewGroup
import android.widget.TableLayout
import android.widget.TableRow
import android.widget.TextView
import androidx.core.view.children
import woowacourse.movie.R

class SeatView(viewGroup: ViewGroup) {
private val _selectSeats = mutableListOf<String>()
val selectSeats: List<String>
get() = _selectSeats.toList()

private val seatViews: List<TextView> = viewGroup.findViewById<TableLayout>(R.id.layout_seats)
.children
.filterIsInstance<TableRow>()
.flatMap { it.children }
.filterIsInstance<TextView>().toList()

fun set() {
setSeatViews()
}

private fun setSeatViews() {
seatViews.forEach { textView ->
textView.setOnClickListener {
val seatId = textView.text.toString()
if (_selectSeats.contains(seatId)) {
textView.setBackgroundColor(textView.context.getColor(R.color.white))
_selectSeats.remove(seatId)
return@setOnClickListener
}
textView.setBackgroundColor(textView.context.getColor(R.color.select_seat))
_selectSeats.add(seatId)
}
}
}
}
95 changes: 63 additions & 32 deletions app/src/main/res/layout/activity_seat_select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
android:layout_height="match_parent"
android:background="#EAEAEA"
tools:context=".activity.seatselect.SeatSelectActivity">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_seat_area"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/layout_price_info"
android:paddingBottom="96dp"
android:paddingHorizontal="34dp">

<TextView
android:id="@+id/text_screen"
android:layout_width="0dp"
Expand All @@ -25,18 +28,19 @@
android:textSize="22sp"
android:gravity="center"
android:background="#494949"
android:textColor="@color/white"
/>
android:textColor="@color/white" />

<TableLayout
android:id="@+id/layout_seats"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toBottomOf="@id/text_screen"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="56dp"
>
android:layout_marginTop="56dp">

<TableRow android:layout_weight="1">

<TextView
android:id="@+id/seat_a1"
android:layout_width="0dp"
Expand All @@ -47,7 +51,8 @@
android:textSize="22sp"
android:text="@string/a1"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_a2"
android:layout_width="0dp"
Expand All @@ -58,7 +63,8 @@
android:textSize="22sp"
android:text="@string/a2"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_a3"
android:layout_width="0dp"
Expand All @@ -69,7 +75,8 @@
android:textSize="22sp"
android:text="@string/a3"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_a4"
android:layout_width="0dp"
Expand All @@ -80,9 +87,11 @@
android:textSize="22sp"
android:text="@string/a4"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />
</TableRow>

<TableRow android:layout_weight="1">

<TextView
android:id="@+id/seat_b1"
android:layout_width="0dp"
Expand All @@ -93,7 +102,8 @@
android:textSize="22sp"
android:text="@string/b1"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_b2"
android:layout_width="0dp"
Expand All @@ -104,7 +114,8 @@
android:textSize="22sp"
android:text="@string/b2"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_b3"
android:layout_width="0dp"
Expand All @@ -115,7 +126,8 @@
android:textSize="22sp"
android:text="@string/b3"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_b4"
android:layout_width="0dp"
Expand All @@ -126,9 +138,11 @@
android:textSize="22sp"
android:text="@string/b4"
android:textColor="@color/seat_rank_b"
android:background="@color/white"/>
android:background="@color/white" />
</TableRow>

<TableRow android:layout_weight="1">

<TextView
android:id="@+id/seat_c1"
android:layout_width="0dp"
Expand All @@ -139,7 +153,8 @@
android:textSize="22sp"
android:text="@string/c1"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_c2"
android:layout_width="0dp"
Expand All @@ -150,7 +165,8 @@
android:textSize="22sp"
android:text="@string/c2"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_c3"
android:layout_width="0dp"
Expand All @@ -161,7 +177,8 @@
android:textSize="22sp"
android:text="@string/c3"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_c4"
android:layout_width="0dp"
Expand All @@ -172,9 +189,11 @@
android:textSize="22sp"
android:text="@string/c4"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />
</TableRow>

<TableRow android:layout_weight="1">

<TextView
android:id="@+id/seat_d1"
android:layout_width="0dp"
Expand All @@ -185,7 +204,8 @@
android:textSize="22sp"
android:text="@string/d1"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_d2"
android:layout_width="0dp"
Expand All @@ -196,7 +216,8 @@
android:textSize="22sp"
android:text="@string/d2"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_d3"
android:layout_width="0dp"
Expand All @@ -207,7 +228,8 @@
android:textSize="22sp"
android:text="@string/d3"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_d4"
android:layout_width="0dp"
Expand All @@ -218,9 +240,11 @@
android:textSize="22sp"
android:text="@string/d4"
android:textColor="@color/seat_rank_s"
android:background="@color/white"/>
android:background="@color/white" />
</TableRow>

<TableRow android:layout_weight="1">

<TextView
android:id="@+id/seat_e1"
android:layout_width="0dp"
Expand All @@ -231,7 +255,8 @@
android:textSize="22sp"
android:text="@string/e1"
android:textColor="@color/seat_rank_a"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_e2"
android:layout_width="0dp"
Expand All @@ -242,7 +267,8 @@
android:textSize="22sp"
android:text="@string/e2"
android:textColor="@color/seat_rank_a"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_e3"
android:layout_width="0dp"
Expand All @@ -253,7 +279,8 @@
android:textSize="22sp"
android:text="@string/e3"
android:textColor="@color/seat_rank_a"
android:background="@color/white"/>
android:background="@color/white" />

<TextView
android:id="@+id/seat_e4"
android:layout_width="0dp"
Expand All @@ -264,19 +291,20 @@
android:textSize="22sp"
android:text="@string/e4"
android:textColor="@color/seat_rank_a"
android:background="@color/white"/>
android:background="@color/white" />
</TableRow>

</TableLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_price_info"
android:layout_width="match_parent"
android:layout_height="78dp"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/white"
>
android:background="@color/white">

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand All @@ -285,29 +313,33 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:paddingHorizontal="20dp"
app:layout_constraintEnd_toStartOf="@id/btn_okay"
>
app:layout_constraintEnd_toStartOf="@id/btn_okay">

<TextView
android:id="@+id/text_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="해리 포터와 마법사의 돌"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="18sp" />

<TextView
android:id="@+id/text_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="0원"
android:textSize="18sp"
android:textColor="@color/price"
/>
android:textColor="@color/price" />
</LinearLayout>
<TextView

<Button
android:id="@+id/btn_okay"
android:layout_width="88dp"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:enabled="false"
android:background="@color/disabled_click"
android:text="@string/okay"
android:textStyle="bold"
Expand All @@ -318,5 +350,4 @@
</androidx.constraintlayout.widget.ConstraintLayout>



</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
<color name="seat_rank_a">#1B48E9</color>
<color name="price">#727272</color>
<color name="disabled_click">#B7B7B7</color>
<color name="select_seat">#FAFF00</color>
</resources>