From d389f241bbdd1ced2438480bebe4689a6a378ec2 Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Wed, 18 Sep 2024 16:31:05 +0200 Subject: [PATCH] Apply suggestion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fernando García Lidón --- .../com/telefonica/mistica/list/ListRowView.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/library/src/main/java/com/telefonica/mistica/list/ListRowView.kt b/library/src/main/java/com/telefonica/mistica/list/ListRowView.kt index c8d3bd179..1e7a6dd03 100644 --- a/library/src/main/java/com/telefonica/mistica/list/ListRowView.kt +++ b/library/src/main/java/com/telefonica/mistica/list/ListRowView.kt @@ -238,14 +238,17 @@ open class ListRowView @JvmOverloads constructor( R.styleable.ListRowView_listRowHeadlineLayout, TypedValue.TYPE_NULL ) - setHeadlineLayout( +setHeadlineLayout( layoutRes = headlineResId.takeIf { it != TypedValue.TYPE_NULL } ?: HEADLINE_NONE, contentDescription = styledAttrs.getString(R.styleable.ListRowView_listRowHeadlineContentDescription) - ) - val headlineVisible: Boolean = styledAttrs.getBoolean( - R.styleable.ListRowView_listRowHeadlineVisible, - currentHeadlineLayoutRes != HEADLINE_NONE - ) + ).also { + // Visibility decision depends on the title layout initialization + val headlineVisible: Boolean = styledAttrs.getBoolean( + R.styleable.ListRowView_listRowHeadlineVisible, + currentHeadlineLayoutRes != HEADLINE_NONE + ) + setHeadlineVisible(headlineVisible) + } setHeadlineVisible(headlineVisible) // Subtitle