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

[둘리] 1, 2단계 영화 극장 선택 제출합니다. #4

Merged
merged 32 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e0afc94
영화 티켓 예매 미션
woowahan-pjs Apr 5, 2023
7026a40
feat(MovieListFragment): 영화 목록 화면 fragment로 변경
EmilyCh0 Apr 25, 2023
74deaf3
feat(MovieMainActivity): BottomNavigationView 구현
hyemdooly Apr 25, 2023
b2ef721
feat(ReservationListFragment): 예매 내역 레이아웃 구현
EmilyCh0 Apr 25, 2023
8135b14
feat(ReservationListFragment): RecyclerView 구현
hyemdooly Apr 25, 2023
4f8255a
feat(ReservationListFragment): 클릭 시 예매 내역 상세 화면으로 이동 구현
EmilyCh0 Apr 25, 2023
add9dd3
feat(ReservationListFragment): Data 저장 구현
hyemdooly Apr 25, 2023
40fcc29
refactor(MovieListAdapter): 클릭 이벤트 콜백 하나로 합치기
EmilyCh0 Apr 25, 2023
44bf562
feat(AlarmReceiver): 예매 후 상영 전 시간 푸시 알림 구현
hyemdooly Apr 26, 2023
cca69f7
feat(SettingFragment, AlarmController): 푸시 알림 수신 설정 구현
EmilyCh0 Apr 26, 2023
a508eaa
refactor(AlarmController): 알림 받을 시간 수정
EmilyCh0 Apr 26, 2023
1592c3d
refactor(AlarmController, AlarmReceiver): 코드 정리 및 메서드 분리
EmilyCh0 Apr 27, 2023
f5a9ef9
test(MovieMainActivityTest): 설정 프래그먼트 테스트
hyemdooly Apr 27, 2023
9737d18
refactor(AndroidManifest): 필요없는 권한 삭제
hyemdooly Apr 28, 2023
939d84a
refactor(layout): xml formatting
hyemdooly Apr 28, 2023
76e9b00
test(SettingFragmentTest): 설정 프래그먼트 테스트
hyemdooly Apr 28, 2023
beb0b3a
test(MovieMainActivityTest): Fragment 선택 테스트
hyemdooly Apr 28, 2023
b71eb97
refactor(reservation_item.xml): isFocusable, isClickable 설정 삭제
hyemdooly Apr 28, 2023
7a8b6b9
refactor(SettingFragment): property formatting
hyemdooly Apr 28, 2023
070cce4
refactor(SettingFragment): if문 depth 수정
hyemdooly Apr 28, 2023
8497d53
refactor(Adapter, ViewHolder): click listener 파라미터 고차함수 -> OnItemClic…
hyemdooly Apr 28, 2023
b2ce59d
refactor(MovieListFragment): click listener 분리
hyemdooly Apr 28, 2023
fcd527f
refactor(ReservationListFragment): 변수 분리 가독성 수정
hyemdooly Apr 28, 2023
c9df85d
refactor(ReservationCompletedActivity): 권한 유도 코드 이동
hyemdooly Apr 28, 2023
8eba6d0
refactor(AlarmController): context private 수정
hyemdooly Apr 28, 2023
085e9dd
refactor(AlarmReceiver, AlarmController): ALARM_REQUEST_CODE 상수 이동
hyemdooly Apr 28, 2023
fd3e4d3
refactor(ReservationCompletedActivity): pendingIntent를 리턴하는 함수 생성
hyemdooly Apr 28, 2023
17cafbc
refactor(SeatSelectionActivity): repositoryMock에 직접 접근이 아닌 interface …
hyemdooly Apr 28, 2023
b634aa8
refactor(SettingFragment): defaultSharedPreferences로 변경
hyemdooly Apr 28, 2023
72e7a58
refactor(Fragments): 레이아웃 id 생성자 사용
hyemdooly Apr 28, 2023
00f4a8f
refactor(MovieMainActivity): Fragment 재활용
hyemdooly Apr 28, 2023
923eedd
refactor(ReservationCompletedActivity): 권한 요청 코드 이동
hyemdooly Apr 29, 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(MovieListAdapter): 클릭 이벤트 콜백 하나로 합치기
  • Loading branch information
EmilyCh0 committed Apr 25, 2023
commit 40fcc29b8bfb85a93999ef5c6e74fa0536224fb4
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@ class MovieListAdapter(
private val onItemClick: OnItemClick
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

interface OnItemClick {
fun onMovieClick(movie: MovieUiModel)

fun onAdClick(ad: MovieAdModel)
}

private val onMovieViewClick: (Int) -> Unit = {
onItemClick.onMovieClick(dataList[it] as MovieUiModel)
fun interface OnItemClick {
fun onClick(item: MovieListModel)
}

private val onAdViewClick: (Int) -> Unit = {
onItemClick.onAdClick(dataList[it] as MovieAdModel)
private val onItemViewClick: (Int) -> Unit = {
onItemClick.onClick(dataList[it])
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
Expand All @@ -35,15 +29,15 @@ class MovieListAdapter(
MovieListViewType.MOVIE_ITEM.id, parent, false
)
MovieItemViewHolder(MovieItemBinding.bind(view)) {
onMovieViewClick(it)
onItemViewClick(it)
}
}
MovieListViewType.AD_ITEM -> {
val view = LayoutInflater.from(parent.context).inflate(
MovieListViewType.AD_ITEM.id, parent, false
)
MovieAdViewHolder(MovieAdItemBinding.bind(view)) {
onAdViewClick(it)
onItemViewClick(it)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ class MovieListFragment : Fragment() {
val dataList = generateMovieListData(movies)

val movieAdapter = MovieListAdapter(
dataList = dataList,
onItemClick = object : MovieListAdapter.OnItemClick {
override fun onMovieClick(movie: MovieListModel.MovieUiModel) {
val intent = ReservationActivity.newIntent(requireContext(), movie)
dataList = dataList
) { item ->
when (item) {
is MovieListModel.MovieUiModel -> {
val intent = ReservationActivity.newIntent(requireContext(), item)
startActivity(intent)
}

override fun onAdClick(ad: MovieListModel.MovieAdModel) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(ad.url))
is MovieListModel.MovieAdModel -> {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(item.url))
startActivity(intent)
}
}
)
}
val movieListView = view.findViewById<RecyclerView>(R.id.movie_recyclerview)
movieListView.adapter = movieAdapter
}
Expand Down