diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt index 160e0148da..0f2f4b0523 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/TopAppBarButton.kt @@ -13,6 +13,7 @@ import com.tangem.core.ui.res.TangemTheme @Composable fun TopAppBarButton(button: TopAppBarButtonUM, tint: Color, modifier: Modifier = Modifier) { IconButton( + enabled = button.enabled, modifier = modifier.size(TangemTheme.dimens.size32), onClick = button.onIconClicked, ) { diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt index 61e3f25d39..7104e25cf9 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/appbar/models/TopAppBarButtonUM.kt @@ -6,14 +6,18 @@ import com.tangem.core.ui.R data class TopAppBarButtonUM( @DrawableRes val iconRes: Int, val onIconClicked: () -> Unit, + val enabled: Boolean = true, ) { @Suppress("FunctionName") companion object { - fun Back(onBackClicked: () -> Unit) = TopAppBarButtonUM( + fun Back(onBackClicked: () -> Unit) = Back(true, onBackClicked) + + fun Back(enabled: Boolean = true, onBackClicked: () -> Unit) = TopAppBarButtonUM( iconRes = R.drawable.ic_back_24, onIconClicked = onBackClicked, + enabled = enabled, ) } } \ No newline at end of file diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt index 681d36de1b..2628335d48 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/DefaultMarketsTokenDetailsComponent.kt @@ -110,11 +110,8 @@ internal class DefaultMarketsTokenDetailsComponent @AssistedInject constructor( backgroundColor = LocalMainBottomSheetColor.current.value, addTopBarStatusBarPadding = false, state = state, - onBackClick = { - if (bsState == BottomSheetState.EXPANDED) { - navigateBack() - } - }, + onBackClick = ::navigateBack, + backButtonEnabled = bsState == BottomSheetState.EXPANDED, onHeaderSizeChange = onHeaderSizeChange, portfolioBlock = portfolioComponent?.let { component -> { blockModifier -> @@ -145,6 +142,7 @@ internal class DefaultMarketsTokenDetailsComponent @AssistedInject constructor( addTopBarStatusBarPadding = true, state = state, onBackClick = ::navigateBack, + backButtonEnabled = true, onHeaderSizeChange = {}, portfolioBlock = portfolioComponent?.let { component -> { blockModifier -> diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt index bce07d98c0..26639bd472 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/details/impl/ui/MarketsTokenDetailsContent.kt @@ -52,6 +52,7 @@ internal fun MarketsTokenDetailsContent( addTopBarStatusBarPadding: Boolean, onBackClick: () -> Unit, onHeaderSizeChange: (Dp) -> Unit, + backButtonEnabled: Boolean, portfolioBlock: @Composable ((Modifier) -> Unit)?, modifier: Modifier = Modifier, ) { @@ -61,6 +62,7 @@ internal fun MarketsTokenDetailsContent( state = state, onBackClick = onBackClick, onHeaderSizeChange = onHeaderSizeChange, + backButtonEnabled = backButtonEnabled, portfolioBlock = portfolioBlock, addTopBarStatusBarInsets = addTopBarStatusBarPadding, ) @@ -76,6 +78,7 @@ private fun Content( addTopBarStatusBarInsets: Boolean, onBackClick: () -> Unit, onHeaderSizeChange: (Dp) -> Unit, + backButtonEnabled: Boolean, portfolioBlock: @Composable ((Modifier) -> Unit)?, modifier: Modifier = Modifier, ) { @@ -98,7 +101,10 @@ private fun Content( } }, title = state.tokenName, - startButton = TopAppBarButtonUM.Back(onBackClick), + startButton = TopAppBarButtonUM.Back( + onBackClicked = onBackClick, + enabled = backButtonEnabled, + ), ) SpacerH4() @@ -305,6 +311,7 @@ private fun Preview() { onBackClick = {}, backgroundColor = TangemTheme.colors.background.tertiary, portfolioBlock = {}, + backButtonEnabled = true, addTopBarStatusBarPadding = false, ) } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt index aff4cf252f..d131e8e482 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt @@ -8,6 +8,7 @@ import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.slideIn import androidx.compose.foundation.Canvas +import androidx.compose.foundation.clickable import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn @@ -425,8 +426,17 @@ private inline fun BaseScaffoldWithMarkets( modifier = Modifier.sizeIn(maxHeight = maxHeight - statusBarHeight), ) { Hand(Modifier.drawBehind { drawRect(backgroundColor.value) }) + Box( modifier = Modifier + // expand bottom sheet when clicked on the header + .clickable( + enabled = bottomSheetState.currentValue == TangemSheetValue.PartiallyExpanded, + indication = null, + interactionSource = null, + ) { + coroutineScope.launch { bottomSheetState.expand() } + } .onFocusChanged { isSearchFieldFocused = it.isFocused },