Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Telefonica/mistica-android into jma…
Browse files Browse the repository at this point in the history
…nrique/ANDROID-11179-enable-detekt-in-mistica-android

# Conflicts:
#	README.md
  • Loading branch information
jmanriquehiberus committed Sep 24, 2024
2 parents ee638a9 + 44d6ab7 commit e93dd76
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.BadgedBox
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -23,7 +22,6 @@ import com.telefonica.mistica.catalog.R
import com.telefonica.mistica.compose.badge.Badge
import com.telefonica.mistica.compose.button.Button

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun Badges() {
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Checkbox
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -40,7 +39,6 @@ import com.telefonica.mistica.compose.tag.Tag
import com.telefonica.mistica.compose.theme.MisticaTheme
import com.telefonica.mistica.compose.theme.brand.MovistarBrand

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun ListRowItem(
modifier: Modifier = Modifier,
Expand All @@ -60,7 +58,7 @@ fun ListRowItem(
) {
ListRowItemImp(
modifier = modifier,
icon = { listRowIcon?.Draw() },
icon = listRowIcon?.let { { listRowIcon.Draw() } },
title = title,
isTitleHeading = isTitleHeading,
subtitle = subtitle,
Expand All @@ -76,7 +74,6 @@ fun ListRowItem(
)
}

@OptIn(ExperimentalMaterialApi::class)
@Composable
@Deprecated(replaceWith = ReplaceWith("ListRowItem"), message = "Use new ListRowItem with ListRowIcon param instead")
fun ListRowItem(
Expand Down Expand Up @@ -113,7 +110,6 @@ fun ListRowItem(
)
}

@ExperimentalMaterialApi
@Composable
@Suppress("LongMethod", "CyclomaticComplexMethod")
private fun ListRowItemImp(
Expand Down Expand Up @@ -287,14 +283,17 @@ object ListRowItemTestTags {
const val LIST_ROW_ITEM_TITLE = "list_row_item_title"
}

@ExperimentalMaterialApi
@Preview(showBackground = true)
@Composable
@Suppress("LongMethod")
fun ListRowItemPreview() {
MisticaTheme(brand = MovistarBrand) {
val checkedState = remember { mutableStateOf(true) }
Column {
ListRowItem(
listRowIcon = null,
title = "Title",
)
ListRowItem(
listRowIcon = null,
headline = Tag("Promo"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
`ListRowItems` are a continuous group of text or images. They are composed of items containing primary and supplemental actions, which are represented by icons and text.
This component is designed to be used inside lists, that in Compose are built using `Column` or `LazyColumn`.

```kotlin
@ExperimentalMaterialApi
```kotlin
@Composable
fun ListRowItem(
modifier: Modifier = Modifier,
Expand Down
16 changes: 9 additions & 7 deletions library/src/main/java/com/telefonica/mistica/list/ListRowView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,17 @@ open class ListRowView @JvmOverloads constructor(
R.styleable.ListRowView_listRowHeadlineLayout,
TypedValue.TYPE_NULL
)
val headlineVisible: Boolean = styledAttrs.getBoolean(
R.styleable.ListRowView_listRowHeadlineVisible,
currentHeadlineLayoutRes != HEADLINE_NONE
)
setHeadlineLayout(
setHeadlineLayout(
layoutRes = headlineResId.takeIf { it != TypedValue.TYPE_NULL } ?: HEADLINE_NONE,
contentDescription = styledAttrs.getString(R.styleable.ListRowView_listRowHeadlineContentDescription)
)
setHeadlineVisible(headlineVisible)
).also {
// Visibility decision depends on the headline layout initialization
val headlineVisible: Boolean = styledAttrs.getBoolean(
R.styleable.ListRowView_listRowHeadlineVisible,
currentHeadlineLayoutRes != HEADLINE_NONE
)
setHeadlineVisible(headlineVisible)
}

// Subtitle
setSubtitleMaxLines(styledAttrs.getInteger(R.styleable.ListRowView_listRowSubtitleMaxLines, -1))
Expand Down

0 comments on commit e93dd76

Please sign in to comment.