From 822290eea6efaaa10d0649464db5f9f4fb36936f Mon Sep 17 00:00:00 2001 From: "burak.ozturk1" Date: Tue, 7 Jan 2025 09:05:16 +0300 Subject: [PATCH] loading info passed add button --- .../uicomponents/quantitypicker/QuantityAddIcon.kt | 7 ++++--- .../trendyol/uicomponents/quantitypicker/QuantityPicker.kt | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityAddIcon.kt b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityAddIcon.kt index 6cb5d15..7782065 100644 --- a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityAddIcon.kt +++ b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityAddIcon.kt @@ -26,7 +26,8 @@ import kotlinx.coroutines.launch internal fun QuantityAddIcon( icons: QuantityIcons, quantityData: QuantityPickerViewData, - onAddClick: (() -> Unit)? + onAddClick: (() -> Unit)?, + showLoading: Boolean ) { val coroutineScope = rememberCoroutineScope() var targetBackgroundColor by remember { @@ -51,8 +52,8 @@ internal fun QuantityAddIcon( } } - LaunchedEffect(key1 = quantityData.currentQuantity) { - if (lastQuantityCount != quantityData.currentQuantity) { + LaunchedEffect(key1 = quantityData.currentQuantity, showLoading) { + if (lastQuantityCount != quantityData.currentQuantity && showLoading.not()) { lastQuantityCount = quantityData.currentQuantity iconTintColor = quantityData.getAddIconColor(icons, quantityData.currentQuantity) setTargetBackgroundColor.invoke(quantityData.getBackgroundColor(icons)) diff --git a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt index 5ead80b..9a90a69 100644 --- a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt +++ b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt @@ -86,7 +86,8 @@ internal fun VerticalQuantityPicker( QuantityAddIcon( icons = icons, quantityData = quantityData, - onAddClick = onAddClick + onAddClick = onAddClick, + showLoading = showLoading ) AnimatedVisibility(visible = quantityData.currentQuantity > 0 || showLoading) { @@ -158,6 +159,7 @@ internal fun HorizontalQuantityPicker( icons = icons, quantityData = quantityData, onAddClick = onAddClick, + showLoading = showLoading, ) } }