-
-
Save chrisbanes/8a0b99f0a6b1578be535c4a822df501b to your computer and use it in GitHub Desktop.
blog_DataBinding_customadapter
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
/* 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