Skip to content

Instantly share code, notes, and snippets.

@manuelvicnt
Last active May 31, 2022 12:27
Show Gist options
  • Save manuelvicnt/98162c0e30c6b26f4fc0a44126770f78 to your computer and use it in GitHub Desktop.
Save manuelvicnt/98162c0e30c6b26f4fc0a44126770f78 to your computer and use it in GitHub Desktop.
/* Copyright 2022 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
class AddEditTaskViewModel(
private val tasksRepository: TasksRepository
) : ViewModel() {
- private val _snackbarText = MutableLiveData<Event<Int>>()
- val snackbarText: LiveData<Event<Int>> = _snackbarText
+ private val _snackbarText = MutableLiveData<Int?>()
+ val snackbarText: LiveData<Int?> = _snackbarText
+ fun snackbarMessageShown() {
+ _snackbarText.value = null
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment