Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump androidx.compose:compose-bom from 2024.08.00 to 2024.09.01 #2089

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package net.skyscanner.backpack.demo.compose

import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -53,6 +52,7 @@ import net.skyscanner.backpack.compose.text.BpkText
import net.skyscanner.backpack.compose.theme.BpkTheme
import net.skyscanner.backpack.compose.tokens.BpkSpacing
import net.skyscanner.backpack.compose.tokens.values
import net.skyscanner.backpack.compose.utils.clickableWithRipple
import net.skyscanner.backpack.demo.R
import net.skyscanner.backpack.demo.components.IconComponent
import net.skyscanner.backpack.demo.meta.ComposeStory
Expand Down Expand Up @@ -119,7 +119,7 @@ fun IconsStory(modifier: Modifier = Modifier) {
contentAlignment = Alignment.Center,
modifier = Modifier
.border(Dp.Hairline, BpkTheme.colors.line)
.clickable {
.clickableWithRipple {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed this function and made it public, so we don't need to maintain two versions (one in the app and one in backpack)

clipboardManager.setText(AnnotatedString(icon.name))
BpkToast
.makeText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package net.skyscanner.backpack.demo.ui

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
Expand All @@ -29,6 +28,7 @@ import net.skyscanner.backpack.compose.badge.BpkBadgeType
import net.skyscanner.backpack.compose.text.BpkText
import net.skyscanner.backpack.compose.theme.BpkTheme
import net.skyscanner.backpack.compose.tokens.BpkDimension
import net.skyscanner.backpack.compose.utils.clickableWithRipple

@Composable
fun ComponentsTitle(title: String, modifier: Modifier = Modifier) {
Expand Down Expand Up @@ -56,7 +56,7 @@ fun ComponentItem(
ListItem(
title = title,
modifier = modifier
.clickable { onClick() },
.clickableWithRipple { onClick() },
) {
if (badgeType != null) {
BpkBadge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import net.skyscanner.backpack.compose.text.BpkText
import net.skyscanner.backpack.compose.theme.BpkTheme
import net.skyscanner.backpack.compose.tokens.BpkSpacing
import net.skyscanner.backpack.compose.utils.BpkClickHandleScope
import net.skyscanner.backpack.compose.utils.clickable
import net.skyscanner.backpack.compose.utils.clickableWithRipple

@Composable
internal fun BpkSectionHeading(
Expand Down Expand Up @@ -69,7 +69,7 @@ internal fun BpkSectionHeading(
internal fun BpkSectionItem(item: BpkItem, modifier: Modifier = Modifier, clickHandleScope: BpkClickHandleScope? = null) {
Row(
modifier = modifier
.clickable {
.clickableWithRipple {
item.onItemSelected()
clickHandleScope?.notifyClick()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.Icon
import androidx.compose.material3.Surface
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -124,7 +124,7 @@ private fun RowScope.BottomNavigationItem(
modifier: Modifier = Modifier,
) {

val ripple = rememberRipple(bounded = false, color = BpkTheme.colors.textLink)
val ripple = ripple(bounded = false, color = BpkTheme.colors.textLink)

val contentColor by animateColorAsState(
label = "BottomNavItem content color",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ class BpkBottomSheetState internal constructor(
internal val delegate: SheetState,
) {

constructor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only ever use this with the remember function. there was a breaking change with a new density param, but as we're only using it with the remember function anyways might as well remove it instead

initialValue: BpkBottomSheetValue = BpkBottomSheetValue.Collapsed,
confirmValueChange: (BpkBottomSheetValue) -> Boolean = { true },
) : this(
SheetState(
skipPartiallyExpanded = false,
skipHiddenState = true,
initialValue = initialValue.toBottomSheetValue(),
confirmValueChange = { confirmValueChange(it.toBpkBottomSheetValue()) },
),
)

val currentValue: BpkBottomSheetValue
get() = delegate.currentValue.toBpkBottomSheetValue()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@ class BpkModalBottomSheetState internal constructor(
internal val delegate: SheetState,
) {

constructor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

initialValue: BpkModalBottomSheetValue = BpkModalBottomSheetValue.Hidden,
confirmValueChange: (BpkModalBottomSheetValue) -> Boolean = { true },
) : this(
SheetState(
skipPartiallyExpanded = false,
skipHiddenState = false,
initialValue = initialValue.toBottomSheetValue(),
confirmValueChange = { confirmValueChange(it.toBpkBottomSheetValue()) },
),
)

val currentValue: BpkModalBottomSheetValue
get() = delegate.currentValue.toBpkBottomSheetValue()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalRippleConfiguration
import androidx.compose.material3.RippleConfiguration
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
Expand All @@ -59,7 +58,9 @@ import net.skyscanner.backpack.compose.tokens.BpkBorderRadius
import net.skyscanner.backpack.compose.tokens.BpkSpacing
import net.skyscanner.backpack.compose.utils.applyIf
import net.skyscanner.backpack.compose.utils.hideContentIf
import net.skyscanner.backpack.compose.utils.toRippleAlpha

@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun BpkButtonImpl(
onClick: () -> Unit,
Expand All @@ -74,7 +75,12 @@ internal fun BpkButtonImpl(
) {
val clickable = enabled && !loading

CompositionLocalProvider(LocalRippleTheme provides ButtonRippleTheme(type.rippleColor())) {
CompositionLocalProvider(
LocalRippleConfiguration provides RippleConfiguration(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ripple theme is gone - there's now RippleConfiguration

type.rippleColor(),
type.rippleColor().toRippleAlpha(),
),
) {
Button(
onClick = onClick,
enabled = clickable,
Expand Down Expand Up @@ -168,21 +174,6 @@ internal fun ButtonDrawable(
)
}

private class ButtonRippleTheme(
private val color: Color = Color.Black,
) : RippleTheme {

private val alpha = RippleAlpha(color.alpha, color.alpha, color.alpha, color.alpha)

@Composable
override fun defaultColor(): Color =
color

@Composable
override fun rippleAlpha(): RippleAlpha =
alpha
}

private val ButtonShape = RoundedCornerShape(BpkBorderRadius.Sm)

private fun Modifier.defaultIconSize(size: BpkIconSize): Modifier =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import net.skyscanner.backpack.compose.tokens.BpkSpacing
import net.skyscanner.backpack.compose.tokens.Heart
import net.skyscanner.backpack.compose.tokens.HeartOutline
import net.skyscanner.backpack.compose.tokens.ShareAndroid
import net.skyscanner.backpack.compose.utils.clickable
import net.skyscanner.backpack.compose.utils.clickableWithRipple

private enum class BpkCardButtonState {
Rest,
Expand Down Expand Up @@ -159,7 +159,7 @@ internal fun BpkShareCardButtonImpl(
else -> BpkTheme.colors.textOnDark.copy(alpha = 0.0F)
},
)
.clickable(onClick = onClick),
.clickableWithRipple(onClick = onClick),
contentAlignment = Alignment.Center,
) {
BpkIcon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.selection.triStateToggleable
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalMinimumTouchTargetEnforcement
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.TriStateCheckbox
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand All @@ -38,6 +38,7 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.invisibleToUser
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.state.ToggleableState
import androidx.compose.ui.unit.Dp
import net.skyscanner.backpack.compose.text.BpkText
import net.skyscanner.backpack.compose.theme.BpkTheme
import net.skyscanner.backpack.compose.tokens.BpkSpacing
Expand Down Expand Up @@ -153,7 +154,7 @@ private fun BpkCheckboxImpl(
) {
// our design system isn't designed with the minimum touch target in mind at the moment.
// Disable the enforcement to avoid the extra padding
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
CompositionLocalProvider(LocalMinimumInteractiveComponentSize provides Dp.Unspecified) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has also been changed

TriStateCheckbox(
state = state,
onClick = onClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
Expand All @@ -49,6 +48,7 @@ import net.skyscanner.backpack.compose.icon.BpkIcon
import net.skyscanner.backpack.compose.icon.BpkIconSize
import net.skyscanner.backpack.compose.text.BpkText
import net.skyscanner.backpack.compose.theme.BpkTheme
import net.skyscanner.backpack.compose.theme.bpkRipple
import net.skyscanner.backpack.compose.tokens.BpkBorderRadius
import net.skyscanner.backpack.compose.tokens.BpkBorderSize
import net.skyscanner.backpack.compose.tokens.BpkElevation
Expand Down Expand Up @@ -85,7 +85,7 @@ internal fun BpkChipImpl(
selected = selected,
enabled = enabled,
interactionSource = interactionSource,
indication = rememberRipple(),
indication = bpkRipple(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a new helper function for using the ripple directly

) { onSelectedChange!!.invoke(!selected) }
},
)
Expand All @@ -112,7 +112,7 @@ internal fun BpkDismissibleChipImpl(
clip(ChipShape)
.clickable(
interactionSource = interactionSource,
indication = rememberRipple(),
indication = bpkRipple(),
) { onClick!!.invoke() }
},
)
Expand Down
Loading