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
feat(MovieListFragment): 영화 목록 화면 fragment로 변경
  • Loading branch information
EmilyCh0 committed Apr 25, 2023
commit 7026a40da874c8194724d7a63e50bfe8274f77bc
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<<<<<<< HEAD
laco-dev marked this conversation as resolved.
Show resolved Hide resolved
# android-movie-theater
=======
# android-movie-ticket

## domain

Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
implementation("androidx.appcompat:appcompat:1.6.0")
implementation("com.google.android.material:material:1.7.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.fragment:fragment-ktx:1.4.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:name=".view.ReservationActivity"
android:exported="false" />
<activity
android:name=".view.MovieListActivity"
android:name=".view.moviemain.MovieMainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import woowacourse.movie.databinding.ActivityReservationCompletedBinding
import woowacourse.movie.util.DATE_TIME_FORMATTER
import woowacourse.movie.util.getParcelableCompat
import woowacourse.movie.view.model.ReservationUiModel
import woowacourse.movie.view.moviemain.MovieMainActivity
import java.text.DecimalFormat

class ReservationCompletedActivity : AppCompatActivity() {
Expand All @@ -31,7 +32,7 @@ class ReservationCompletedActivity : AppCompatActivity() {
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
val intent =
Intent(this@ReservationCompletedActivity, MovieListActivity::class.java)
Intent(this@ReservationCompletedActivity, MovieMainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
startActivity(intent)
}
Expand All @@ -57,7 +58,7 @@ class ReservationCompletedActivity : AppCompatActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
val intent = Intent(this, MovieListActivity::class.java)
val intent = Intent(this, MovieMainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
startActivity(intent)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package woowacourse.movie.view.moviemain

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.commit
import woowacourse.movie.R
import woowacourse.movie.view.moviemain.movielist.MovieListFragment

class MovieMainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_movie_list)

supportFragmentManager.commit {
setReorderingAllowed(true)
add(R.id.fragment_container_view, MovieListFragment())
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package woowacourse.movie.view
package woowacourse.movie.view.moviemain.movielist

import androidx.recyclerview.widget.RecyclerView
import woowacourse.movie.databinding.MovieAdItemBinding
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package woowacourse.movie.view
package woowacourse.movie.view.moviemain.movielist

import androidx.recyclerview.widget.RecyclerView
import woowacourse.movie.R
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package woowacourse.movie.view
package woowacourse.movie.view.moviemain.movielist

import android.view.LayoutInflater
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
package woowacourse.movie.view
package woowacourse.movie.view.moviemain.movielist

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
import woowacourse.movie.R
import woowacourse.movie.domain.Movie
import woowacourse.movie.repository.MovieMockRepository
import woowacourse.movie.view.ReservationActivity
import woowacourse.movie.view.mapper.toUiModel
import woowacourse.movie.view.model.MovieListModel

class MovieListActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_movie_list)
class MovieListFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_movie_list, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val movies = MovieMockRepository.findAll()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MockRepository 다른 곳도 동일하게 변경 해주세요~

val dataList = generateMovieListData(movies)

val movieAdapter = MovieListAdapter(
dataList = dataList,
onItemClick = object : MovieListAdapter.OnItemClick {
override fun onMovieClick(movie: MovieListModel.MovieUiModel) {
val intent = ReservationActivity.newIntent(this@MovieListActivity, movie)
val intent = ReservationActivity.newIntent(requireContext(), movie)
startActivity(intent)
}

Expand All @@ -33,18 +44,27 @@ class MovieListActivity : AppCompatActivity() {
}
}
)
val movieListView = findViewById<RecyclerView>(R.id.movie_recyclerview)
val movieListView = view.findViewById<RecyclerView>(R.id.movie_recyclerview)
movieListView.adapter = movieAdapter
}

private fun generateMovieListData(movies: List<Movie>): List<MovieListModel> {
val dataList = mutableListOf<MovieListModel>()
val ad = MovieListModel.MovieAdModel(
R.drawable.woowacourse_banner,
"https://woowacourse.github.io/"
)

return mixMovieAdData(movies, ad, AD_POST_INTERVAL)
}

private fun mixMovieAdData(
movies: List<Movie>,
ad: MovieListModel.MovieAdModel,
adPostInterval: Int
): List<MovieListModel> {
val dataList = mutableListOf<MovieListModel>()
movies.forEachIndexed { index, movie ->
if (index % AD_POST_INTERVAL == AD_POST_INTERVAL - 1) {
if (index % adPostInterval == adPostInterval - 1) {
dataList.add(movie.toUiModel())
dataList.add(ad)
return@forEachIndexed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package woowacourse.movie.view
package woowacourse.movie.view.moviemain.movielist

import woowacourse.movie.R

Expand Down
9 changes: 4 additions & 5 deletions app/src/main/res/layout/activity_movie_list.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http:https://schemas.android.com/apk/res/android"
xmlns:app="http:https://schemas.android.com/apk/res-auto"
xmlns:tools="http:https://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".view.MovieListActivity">
tools:context=".view.moviemain.MovieMainActivity">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/movie_recyclerview"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
tools:layout="@layout/fragment_movie_list" />

</androidx.constraintlayout.widget.ConstraintLayout>
16 changes: 16 additions & 0 deletions app/src/main/res/layout/fragment_movie_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http:https://schemas.android.com/apk/res/android"
xmlns:app="http:https://schemas.android.com/apk/res-auto"
xmlns:tools="http:https://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".view.moviemain.movielist.MovieListFragment">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/movie_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/movie_item"/>

</FrameLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
<string name="cancel">취소</string>
<string name="empty_view">empty view</string>
<string name="ad_banner_image">ad banner image</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
4 changes: 2 additions & 2 deletions domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
testImplementation("junit:junit:4.13.2")
Expand Down