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
HW-1 네이버 영화 검색 앱 #510
HW-1 네이버 영화 검색 앱 #510
Conversation
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
movieCall.cancel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
movieCall이 초기화되지 않았을 경우에 대한 예외처리를 추가해주세요.
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
movieCall?.cancel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스택오버플로우 답변 참조 movieCall이 lateinit var로 선언되어 있어서 ?이 의미가 없어요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
감사합니다. 확인해보겠습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtjin 네 이것만 처리되면 approve할게요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했는데 movieCall을 lateinit말고 ?= null 로 해놓는게 더 낫나요?
fb3830f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtjin lateinit을 쓸지 Nullable을 쓸지에 대해선 제 생각에는 개인 취향일 것 같아요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sooakim 넵 리뷰 감사합니다~
val newRequest = request().newBuilder().run { | ||
addHeader("X-Naver-Client-Id", "33chRuAiqlSn5hn8tIme") | ||
addHeader("X-Naver-Client-Secret", "fyfwt9PCUN") | ||
build() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builder pattern이기 때문에 run으로 하지 않아도 됩니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run코드 제거했습니다.
87f2a2e
interface ItemClickListener { | ||
fun onItemClick(movie: Movie) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface말고 kotlin higher-order function으로 처리해보세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
higher-order function로 처리하였습니다.
15bb680
fun setItems(items: List<Movie>) { | ||
this.items.addAll(items) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notify를 함수 내부에서 호출 하도록 해주세요
아래 clear도 동일하게 해주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다.
f82dc00
|
||
fun bind(movie: Movie) { | ||
with(movie) { | ||
Glide.with(itemView).load(image).placeholder(R.drawable.ic_default).into(ivPoster!!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load부터 개행해서 한 함수당 한 라인씩 나오도록 해주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다.
35d017a
initListener() | ||
} | ||
|
||
fun initView() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private 추가해주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가했습니다.
if (isSuccessful && body() != null) { | ||
body()?.movies?.let { it -> movieAdapter.setItems(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if에서 body()가 null이 아닌걸 검사했는데 내부에서 ?로 사용하고 있네요
이거는 이렇게 수정하시면 됩니다.
val body = body()
if (isSuccessful && body != null) {
body.movies.let { movieAdapter.setItems(it) }
movieAdapter.notifyDataSetChanged()
} else {
onToastMessage("불러오는데 실패 했습니다.")
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다.
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
if(this::movieCall.isInitialized){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if와 ( 사이에 공백 추가해주세요
reformat code 하시면 됩니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
레트로핏 onResponse() 쪽 수정할때 같이 수정하여 커밋했습니다.
e0b3a4a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✊ ✌️ 👋
HW-1 네이버 검색 영화앱
rxjava와 interceptor 사용이 처음인 점 양해 부탁드립니다.