Skip to content

[김예란_Android] 7주차 과제 제출#7

Open
yeran27 wants to merge 2 commits intoBCSDLab-Edu:mainfrom
yeran27:assignment07
Open

[김예란_Android] 7주차 과제 제출#7
yeran27 wants to merge 2 commits intoBCSDLab-Edu:mainfrom
yeran27:assignment07

Conversation

@yeran27
Copy link

@yeran27 yeran27 commented Dec 26, 2025

No description provided.


override fun onEditButtonClick(word: WordEntity) {
val intent = Intent(this@MainActivity, SecondActivity::class.java)
intent.putExtra("WORD_ID", word.id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

key <=> constant


adapter.setOnWordItemClickListener(object : WordAdapter.OnWordItemClickListener{
override fun onWordItemClick(position: Int, word: WordEntity) {
adapter.moveToTop(position)
Copy link
Collaborator

Choose a reason for hiding this comment

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

오... 단어 클릭 시 단어 리스트에서 최상단으로 가는 게 아닌
해당 단어를 최상단에 존재하는 선택된 단어 표시 view 에 보여달라는 의미 입니다.

wordViewModel = ViewModelProvider(this)[WordViewModel::class.java]

wordId = intent.getIntExtra("WORD_ID", -1)
if (wordId == -1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

-1 이 곧 없음인데 굳이 null 로 한번 더 바꿀 필요는 없다고 생각합니다.

val existingWord = intent.getStringExtra("WORD")
val existingMeaning = intent.getStringExtra("MEANING")

if (wordId != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

wordId?.let {} 의 방법도 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants