diff --git a/buildSrc/src/main/kotlin/ComponentVersions.kt b/buildSrc/src/main/kotlin/ComponentVersions.kt index d1f97881..3e4c1b3a 100644 --- a/buildSrc/src/main/kotlin/ComponentVersions.kt +++ b/buildSrc/src/main/kotlin/ComponentVersions.kt @@ -7,7 +7,7 @@ object ComponentVersions { const val phoneNumberVersion = "1.0.2" const val dialogsVersion = "1.2.8" const val cardInputViewVersion = "1.1.3" - const val quantityPickerViewVersion = "1.2.6" + const val quantityPickerViewVersion = "1.2.7" const val timelineViewVersion = "1.0.0" const val touchDelegatorVersion = "1.0.0" const val fitOptionMessageView = "1.0.0" diff --git a/libraries/quantity-picker-view/README.md b/libraries/quantity-picker-view/README.md index 70238ce9..7a39f959 100644 --- a/libraries/quantity-picker-view/README.md +++ b/libraries/quantity-picker-view/README.md @@ -66,6 +66,7 @@ To set programmatically, you can call `QuantityPickerView.setQuantityPickerViewS | setMinQuantity | minQuantity: Int | To set minQuantity immediately. | | setAddIconDrawable | icon: Drawable | To set addIconDrawable immediately. | | setBackgroundImageDrawable | background: Drawable | To set backgroundImageDrawable immediately. | +| setAddButtonEnabled | enable: Boolean | To set enable to addButton immediately | | stopLoading | | To stop current loading.| | reset | | To stop loading and set currentQuantity to 0. | | incrementQuantityBy | quantity | increments current total quantity by quantity parameter diff --git a/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerView.kt b/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerView.kt index 31fefee9..595b7838 100644 --- a/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerView.kt +++ b/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerView.kt @@ -177,6 +177,10 @@ class QuantityPickerView : ConstraintLayout { setQuantityPickerViewState(binding.viewState?.getBackgroundDrawable(background)) } + fun setAddButtonEnabled(enable: Boolean) { + setQuantityPickerViewState(binding.viewState?.getAddButtonEnabled(enable)) + } + fun stopLoading() = setQuantityPickerViewState(binding.viewState?.stopLoading()) fun reset() = setQuantityPickerViewState(binding.viewState?.reset()) @@ -250,7 +254,6 @@ class QuantityPickerView : ConstraintLayout { ) val quantityTextStyle = it.getInt(R.styleable.QuantityPickerView_qpv_quantityTextStyle, 0) - val addButtonEnabled = it.getBoolean(R.styleable.QuantityPickerView_qpv_addButtonEnabled, true) val currentQuantity = it.getInt(R.styleable.QuantityPickerView_qpv_currentQuantity, 0) val maxQuantity = it.getInt(R.styleable.QuantityPickerView_qpv_maxQuantity, -1) val minQuantity = it.getInt(R.styleable.QuantityPickerView_qpv_minQuantity, -1) @@ -317,7 +320,6 @@ class QuantityPickerView : ConstraintLayout { quantityTextColor = quantityTextColor, quantityTextSize = quantityTextSize, quantityTextStyle = quantityTextStyle, - addButtonEnabled = addButtonEnabled, currentQuantity = currentQuantity, backgroundDrawable = background, progressTintColor = progressTintColor, diff --git a/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerViewState.kt b/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerViewState.kt index c1c7a9f3..7c84707a 100644 --- a/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerViewState.kt +++ b/libraries/quantity-picker-view/src/main/java/com/trendyol/uicomponents/quantitypickerview/QuantityPickerViewState.kt @@ -167,6 +167,10 @@ data class QuantityPickerViewState( return copy(backgroundDrawable = background) } + internal fun getAddButtonEnabled(enable: Boolean): QuantityPickerViewState { + return copy(addButtonEnabled = enable) + } + internal fun stopLoading(): QuantityPickerViewState = copy(showLoading = false, expansionState = expansionState.expand()) diff --git a/libraries/quantity-picker-view/src/main/res/values/attrs.xml b/libraries/quantity-picker-view/src/main/res/values/attrs.xml index df70a296..95b21b1b 100644 --- a/libraries/quantity-picker-view/src/main/res/values/attrs.xml +++ b/libraries/quantity-picker-view/src/main/res/values/attrs.xml @@ -17,7 +17,6 @@ -