Initial support for external sources
This commit is contained in:
@@ -21,10 +21,11 @@ fun View.getCoordinates() = Point((left + right) / 2, (top + bottom) / 2)
|
||||
* @param length the duration of the snack.
|
||||
* @param f a function to execute in the snack, allowing for example to define a custom action.
|
||||
*/
|
||||
inline fun View.snack(message: String, length: Int = Snackbar.LENGTH_LONG, f: Snackbar.() -> Unit) {
|
||||
inline fun View.snack(message: String, length: Int = Snackbar.LENGTH_LONG, f: Snackbar.() -> Unit): Snackbar {
|
||||
val snack = Snackbar.make(this, message, length)
|
||||
val textView = snack.view.findViewById(android.support.design.R.id.snackbar_text) as TextView
|
||||
textView.setTextColor(Color.WHITE)
|
||||
snack.f()
|
||||
snack.show()
|
||||
return snack
|
||||
}
|
||||
Reference in New Issue
Block a user