-
Notifications
You must be signed in to change notification settings - Fork 3
Chapter2 #6
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
base: junieberry-chapter1
Are you sure you want to change the base?
Chapter2 #6
Conversation
| } | ||
|
|
||
| companion object { | ||
| lateinit var instance: App |
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.
이런 접근 방식은 좋지 못해요 전역에서 사용하는건데 safe하지 않습니다!
잘 생각해보면 DI로 ViewModel init할때 넣으면 좋을 것 같네요
| holder.bind(movies[position]) | ||
| holder.itemView.setOnClickListener{movieClickListener(movies[position])} | ||
| holder.itemView.setOnClickListener { movieClickListener(movies[position]) } |
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.
binding 내부로 click listener를 넣어서 사용하는게 더 깔끔해보여요!
| )[MainViewModel::class.java] | ||
|
|
||
|
|
||
| if (intent.getStringExtra("title") != null) { |
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.
스코프 함수를 써서 해보세요!
|
|
||
| @BindingAdapter("bind_history_list") | ||
| fun setHistory(recyclerView: RecyclerView, histories: ArrayList<String>?) { | ||
| if (histories != null) { |
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 (empty) { | ||
| textView.visibility = View.VISIBLE | ||
| } | ||
| else { | ||
| textView.visibility = View.GONE | ||
| } |
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.
삼항 연산을 쓰는게 더 깔끔할거같아요
| import org.w3c.dom.Text | ||
|
|
||
| @BindingAdapter("bind_visible_if") | ||
| fun setVisibility(textView:TextView, empty:Boolean) { |
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.
view 다음에 들어오는 데이터는 nullable하게 받아줘야 합니다!
| } | ||
| } | ||
| override fun onFailure(call: Call<MovieResponse>, t: Throwable) { | ||
| Toast.makeText(App.instance.applicationContext, "검색 도중 오류가 발생했습니다.", Toast.LENGTH_SHORT).show() |
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.
viewModel은 명령을 내리는 곳이지 ui에 직접 관여하면 안됩니다!
dim처리는 더 공부해보고 추가해보겠습니다..!
검색 기록 화면

검색 기록에서 검색 기록 항목 누른 화면

검색 결과 없는 화면

검색 오류가 발생한 화면
