-
-
Save chrisbanes/4a248905c5fcbdf9d5f5b4fcb33a9142 to your computer and use it in GitHub Desktop.
blog_DataBinding_1
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("showTitle") | |
fun showTitle(view: TextView, show: TiviShow) { | |
view.text = buildSpannedString { | |
inSpans(...) { | |
append(show.title) | |
} | |
if (show.firstAired != null) { | |
append(" ") | |
inSpans(...) { | |
append("(") | |
append(show.firstAired.year) | |
append(")") | |
} | |
} | |
} | |
} |
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 --> | |
<TextView | |
app:showTitle="@{viewState.show}" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment