Skip to content

Commit

Permalink
dhonti/ANDROID-15405-postercard: Apply some corrections from PR @jepr…
Browse files Browse the repository at this point in the history
  • Loading branch information
dhonti-axpe committed Dec 2, 2024
1 parent 3ada235 commit f78acfa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ fun PosterCards() {
var inverseDisplay: Boolean by remember { mutableStateOf(true) }
var backgroundType: BackgroundType by remember { mutableStateOf(BackgroundType.IMAGE) }

var topActionsType: TopActionsType by remember { mutableStateOf(TopActionsType.TWO_ACTIONS) }
var topActionsType: TopActionsType by remember { mutableStateOf(TopActionsType.NONE) }

var preTitle: String by remember { mutableStateOf("Pretitle") }
var title: String by remember { mutableStateOf("Title") }
var subtitle: String by remember { mutableStateOf("Subtitle") }
var description: String by remember { mutableStateOf("Description") }

var withAdditionalContent: Boolean by remember { mutableStateOf(true) }
var withAdditionalContent: Boolean by remember { mutableStateOf(false) }


Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import com.telefonica.mistica.compose.theme.MisticaTheme

@Composable
fun PosterCard(
modifier: Modifier = Modifier,
aspectRatio: PosterCardAspectRatio,
backgroundType: PosterCardBackgroundType,
modifier: Modifier = Modifier,
headline: Tag? = null,
preTitle: String? = null,
title: String? = null,
Expand All @@ -51,9 +51,7 @@ fun PosterCard(
max = Dp.Infinity
)
) {
PosterCardBackground(
backgroundType = backgroundType
) {
PosterCardBackground(backgroundType = backgroundType) {
Column(
modifier = Modifier.align(alignment = Alignment.BottomCenter),
verticalArrangement = Arrangement.Bottom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.compose.ui.res.painterResource

@Composable
internal fun PosterCardBackground(
modifier: Modifier = Modifier,
backgroundType: PosterCardBackgroundType,
content: @Composable BoxScope.() -> Unit
) {
Expand All @@ -26,7 +25,6 @@ internal fun PosterCardBackground(
SolidColor(Color.Transparent)
},
)
.then(modifier)
) {
if (backgroundType is PosterCardBackgroundType.Image) {
Image(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.traversalIndex
import androidx.compose.ui.unit.dp
import com.telefonica.mistica.compose.theme.MisticaTheme

Expand All @@ -41,22 +39,19 @@ internal fun PosterCardTopActions(
verticalAlignment = Alignment.CenterVertically
) {
firstTopAction?.let {
TopAction(topActionData = it, modifier = Modifier.semantics { traversalIndex = 7f })
TopAction(topActionData = it)
}
secondTopAction?.let {
if (firstTopAction != null) {
Spacer(modifier = Modifier.width(16.dp))
}
TopAction(topActionData = it, modifier = Modifier.semantics { traversalIndex = 8f })
TopAction(topActionData = it)
}
}
}

@Composable
internal fun TopAction(
modifier: Modifier = Modifier,
topActionData: TopActionData
) {
internal fun TopAction(topActionData: TopActionData) {
with(topActionData) {
Box(
modifier = Modifier
Expand All @@ -72,7 +67,6 @@ internal fun TopAction(
}
)
.wrapContentSize(align = Alignment.Center)
.then(modifier)
) {
Image(
painter = painterResource(id = iconRes),
Expand Down

0 comments on commit f78acfa

Please sign in to comment.