From 8900fb9f645aa2f6a25dbeb6536e337d2769ad6e Mon Sep 17 00:00:00 2001 From: vipulkumar Date: Fri, 28 Jun 2024 12:39:57 +0530 Subject: [PATCH] Downgrade material3 - Keyboard doesn't let the user change language on search page --- .../bottombar/rail/HomeNavigationRailItemRow.kt | 4 ++-- gradle/libs.versions.toml | 2 +- .../java/org/kafka/common/widgets/IconButton.kt | 4 ++-- .../org/kafka/homepage/components/Carousels.kt | 15 +++++---------- .../main/java/org/kafka/item/detail/ItemDetail.kt | 2 +- .../main/java/com.kafka.search/RecentSearches.kt | 2 +- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/kafka/user/home/bottombar/rail/HomeNavigationRailItemRow.kt b/app/src/main/java/com/kafka/user/home/bottombar/rail/HomeNavigationRailItemRow.kt index 2070189f5..6b86f1337 100644 --- a/app/src/main/java/com/kafka/user/home/bottombar/rail/HomeNavigationRailItemRow.kt +++ b/app/src/main/java/com/kafka/user/home/bottombar/rail/HomeNavigationRailItemRow.kt @@ -14,10 +14,10 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.selection.selectable +import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text -import androidx.compose.material3.ripple import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue @@ -54,7 +54,7 @@ internal fun HomeNavigationRailItemRow( enabled = enabled, role = Role.Tab, interactionSource = interactionSource, - indication = ripple(bounded = true, color = activeColor) + indication = rememberRipple(bounded = true, color = activeColor) ) .padding(horizontal = Dimens.Spacing40, vertical = Dimens.Spacing20) ) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 43b65e0a9..3bc283fa0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ dagger = "2.51.1" icons = "1.0.0" kotlin = "2.0.0" kotlin-immutable = "0.3.7" -material3 = "1.3.0-beta03" +material3 = "1.2.1" media3 = "1.3.1" mixpanel = "7.0.0" okhttp = "4.12.0" diff --git a/ui/common/src/main/java/org/kafka/common/widgets/IconButton.kt b/ui/common/src/main/java/org/kafka/common/widgets/IconButton.kt index 68378ce80..294f22ca8 100644 --- a/ui/common/src/main/java/org/kafka/common/widgets/IconButton.kt +++ b/ui/common/src/main/java/org/kafka/common/widgets/IconButton.kt @@ -5,8 +5,8 @@ import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.size +import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.ripple import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -69,7 +69,7 @@ fun IconButton( role = Role.Button, onClickLabel = onClickLabel, interactionSource = interactionSource, - indication = ripple( + indication = rememberRipple( bounded = false, color = rippleColor, radius = rippleRadius diff --git a/ui/homepage/src/main/java/org/kafka/homepage/components/Carousels.kt b/ui/homepage/src/main/java/org/kafka/homepage/components/Carousels.kt index d6824b5bb..975689497 100644 --- a/ui/homepage/src/main/java/org/kafka/homepage/components/Carousels.kt +++ b/ui/homepage/src/main/java/org/kafka/homepage/components/Carousels.kt @@ -4,12 +4,11 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.carousel.HorizontalMultiBrowseCarousel -import androidx.compose.material3.carousel.rememberCarouselState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp import com.kafka.data.entities.Item import kotlinx.collections.immutable.ImmutableList import org.kafka.ui.components.item.FeaturedItem @@ -23,16 +22,12 @@ internal fun Carousels( modifier: Modifier = Modifier, lazyListState: LazyListState = rememberLazyListState() ) { - val state = rememberCarouselState { carouselItems.size } + val state = rememberPagerState { carouselItems.size } - HorizontalMultiBrowseCarousel( + HorizontalPager( state = state, - preferredItemWidth = 350.dp, - minSmallItemWidth = 56.dp, - maxSmallItemWidth = 72.dp, modifier = modifier.padding(Dimens.Spacing02), contentPadding = PaddingValues(horizontal = Dimens.Spacing12), - itemSpacing = Dimens.Spacing08 ) { index -> carouselItems.getOrNull(index)?.let { item -> FeaturedItem( @@ -40,7 +35,7 @@ internal fun Carousels( label = item.title, imageUrl = images.getOrNull(index), onClick = { onBannerClick(item.itemId) }, - modifier = Modifier.maskClip(shape = RoundedCornerShape(Dimens.Radius20)) + shape = RoundedCornerShape(Dimens.Radius20) ) } } diff --git a/ui/item/src/main/java/org/kafka/item/detail/ItemDetail.kt b/ui/item/src/main/java/org/kafka/item/detail/ItemDetail.kt index a4eb1e824..5dd023cb6 100644 --- a/ui/item/src/main/java/org/kafka/item/detail/ItemDetail.kt +++ b/ui/item/src/main/java/org/kafka/item/detail/ItemDetail.kt @@ -246,7 +246,7 @@ private fun ItemDetail( if (state.isLoading) { item(span = { GridItemSpan(GridItemSpan) }) { - Delayed(modifier = Modifier.animateItem()) { + Delayed(modifier = Modifier.animateItemPlacement()) { InfiniteProgressBar() } } diff --git a/ui/search/src/main/java/com.kafka.search/RecentSearches.kt b/ui/search/src/main/java/com.kafka.search/RecentSearches.kt index 9b134a722..bd8655ffb 100644 --- a/ui/search/src/main/java/com.kafka.search/RecentSearches.kt +++ b/ui/search/src/main/java/com.kafka.search/RecentSearches.kt @@ -45,7 +45,7 @@ fun RecentSearches( recentSearch = recentSearch, onSearchClicked = onSearchClicked, onRemoveSearch = onRemoveSearch, - modifier = Modifier.animateItem() + modifier = Modifier.animateItemPlacement() ) } }