Instantly share code, notes, and snippets.

@chrisbanes chrisbanes/code.kt Secret
Last active Dec 31, 2018

Embed
What would you like to do?
blog_DataBinding_customadapter
/* Copyright 2018 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
@BindingAdapter("maxLinesToggle")
fun maxLinesClickListener(view: TextView, collapsedMaxLines: Int) {
// Default to the collapsed number of max lines
view.maxLines = collapsedMaxLines
// Now set click listener which toggles between this and MAX_INT
view.setOnClickListener(MaxLinesToggleClickListener(...))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment