Last active
January 25, 2018 05:08
-
-
Save n8ebel/fa980ee2331fccf54d1a9862161746df 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
typealias SnackFinishedListener = () -> Unit | |
typealias SnackActionListener = () -> Unit | |
/** | |
* Representation of [Snackbar] data that can be exposed by a view model, observed, and bound to | |
* the current UI | |
*/ | |
sealed class SnackData | |
/** | |
* Indicates that a [Snackbar] should be hidden | |
*/ | |
object NoSnack : SnackData() | |
/** | |
* Indicates a [Snackbar] that should not be automatically dismissed and is shown | |
* with [Snackbar.LENGTH_INDEFINITE] | |
*/ | |
open class StickySnack( | |
@StringRes val msgId:Int, val dismissListener: SnackFinishedListener = {}, | |
@StringRes val actionMsgId:Int = 0, val actionListener: SnackFinishedListener = {}) : SnackData() | |
/** | |
* Indicates a [Snackbar] that should be shown with [Snackbar.LENGTH_SHORT] | |
*/ | |
data class ShortSnack(@StringRes val msgId:Int, val dismissListener: SnackFinishedListener = {}, | |
@StringRes val actionMsgId:Int = 0, val actionListener: SnackFinishedListener = {}) : SnackData() | |
/** | |
* Indicates a [Snackbar] that should be shown with [Snackbar.LENGTH_LONG] | |
*/ | |
data class LongSnack(@StringRes val msgId:Int, val dismissListener: SnackFinishedListener = {}, | |
@StringRes val actionMsgId:Int = 0, val actionListener: SnackFinishedListener = {}) : SnackData() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment