-
Notifications
You must be signed in to change notification settings - Fork 116
Description
Hello. I am a Korean fan who is studying hard through your Android Kotlin tutorial. First of all, I want to say thank you so much. Your lessons are very unique compared to other Android tutorials. So I also became very interested in the MVVM blah blah pattern you suggested. I'm trying to create a note app using your pattern, but I'm running into a problem. It wasn't much different from SpaceNote, so I thought it would be easy to implement, but I got stuck in this process and couldn't get any help. So I decided to leave a direct message like this. I'm really sorry for bothering you.
viewmodel handle event and viewmodel observe also work properly. Please pay attention to the NoteDetailEvent.OnDoneClick() process when the save button is pressed in line 74 of Activity.
The text of the EditText can be easily passed, but the problem is passing the colorCode of the view or the file path of the image.
At least I figured out how to get the colorCode from the View and passed it like that, but I don't know how to get the file path from ImageView. The file path is temporarily placed in a global variable and the value is changed each time an event occurs. It works fine, but I'm worried that if I do this, something is going against the pattern you suggested. (Of course, I know that I should never access it directly like viewmodel.changedNoteImage!! ;-) )
And I have one more question. How about passing the note object directly to Note Detail Event.OnNodeClick? I think it looks much better with the reduced arguments of ViewModel updateNote(), but I don't know how to write updateNote(). Unlike Note and RoomNote in the SpaceNote example, I am using noteId with @PrimaryKey(autoGenerate=true) instead of creationDate.