Conversation
kongwoojin
left a comment
There was a problem hiding this comment.
고생하셨습니다!
몇가지 질문 사항을 남겨뒀으니, 답변 달아주시면 감사하겠습니다 :)
| androidTestImplementation(libs.androidx.espresso.core) | ||
| val fragment_version = "1.8.9" | ||
| implementation("androidx.fragment:fragment-ktx:$fragment_version") | ||
| } No newline at end of file |
| import androidx.recyclerview.widget.LinearLayoutManager | ||
| import androidx.recyclerview.widget.RecyclerView | ||
|
|
||
| data class ListItem(val name: String) |
| val name = editText.text.toString() | ||
| if (name.isNotEmpty()){ | ||
| itemList.add(ListItem(name)) | ||
| adapter.notifyItemInserted(itemList.size -1) |
There was a problem hiding this comment.
itemList.size와 itemList.lastIndex는 무슨 차이일까요?
There was a problem hiding this comment.
itemList.size는 리스트의 전체 요소 개수이며, itemList.lastIndex는 리스트의 마지막 요소의 인덱스입니다
| override fun onBindViewHolder(viewHolder: ViewHolder, position: Int){ | ||
| viewHolder.nameText.text = items[position].name | ||
| viewHolder.rootView.setOnClickListener { | ||
| AlertDialog.Builder(viewHolder.rootView.context) |
There was a problem hiding this comment.
몇가지 질문이 있습니다
- context란 무엇인가요
viewHolder.rootView.context는 어떤 context일까요- 다른 방법으로 context를 받을 수는 없을까요
There was a problem hiding this comment.
그 작업을 어느 activity에서 할건지 알려주는 것이라고 생각합니다
viewHolder.rootView.context는 RecyclerView가 속한 Activity의 Context입니다
현재는 view에서 가져오고 있지만 생성자로 받을 수 있으며 this로 지명할 수 있습니다
| app:layout_constraintTop_toTopOf="parent" /> | ||
|
|
||
| <Button | ||
| android:id="@+id/button_add" |
There was a problem hiding this comment.
naming convention 잘 지키셨네요!
다만 조금 더 명확하게 이름을 짓는다면, button_add_item은 어떨까 싶네요
| androidTestImplementation(libs.androidx.junit) | ||
| androidTestImplementation(libs.androidx.espresso.core) | ||
| val fragment_version = "1.8.9" | ||
| implementation("androidx.fragment:fragment-ktx:$fragment_version") |
There was a problem hiding this comment.
처음에 fragment를 이용하여 풀어보려 했는데 결국엔 사용하지 않았습니다. 그 과정에서 미처 지우지 못했습니다
| material = "1.12.0" | ||
| activity = "1.11.0" | ||
| constraintlayout = "2.2.1" | ||
| fragment_version = "1.8.9" |
KYM-P
left a comment
There was a problem hiding this comment.
트랙장님의 고난도 질문이 많아서 제가 할게 없네요.
다른건
`6.아이템을 길게 누르면 수정 여부를 묻는 AlertDialog가 표시됩니다.
- EditText를 포함해야 합니다.`
의 구현 요소를 빼먹으셨습니다.
| .setMessage(R.string.dialog_message) | ||
| .setPositiveButton(R.string.dialog_positive_message) { dialog, _ -> | ||
| items.removeAt(position) | ||
| notifyItemRemoved(position) |
There was a problem hiding this comment.
질문이 많으니 저도 질문
notifyItemRemoved(position) 을 호출하지 않으면 어떻게 될까요?
There was a problem hiding this comment.
item,removeAt(position)으로 리스트에서 제거는 되지만 내용이 갱신되지 않아 오류가 발생합니다
No description provided.