Last active
March 11, 2023 10:37
-
-
Save saldisobi/2dbfc0eddc9dd6b57d3fc6f210a69294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModelViewModel @Inject constructor( | |
private val myModelRepository: MyModelRepository | |
) : ViewModel(), CommandReceiver { | |
override fun onAddClicked() { | |
viewModelScope.launch { | |
Log.v(TAG, "add command") | |
} | |
} | |
override fun onTextUpdate(newText: String) { | |
viewModelScope.launch { | |
Log.v(TAG, "edit command") | |
} | |
} | |
override fun onDeleteClicked() { | |
viewModelScope.launch { | |
Log.v(TAG, "delete command") | |
} | |
} | |
override fun onListClicked() { | |
viewModelScope.launch { | |
Log.v(TAG, "list command") | |
} | |
} | |
override fun onSaveClicked(text: String) { | |
viewModelScope.launch { | |
myModelRepository.add(text) | |
} | |
} | |
companion object { | |
const val TAG = "MyTag" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment