diff --git a/libraries/quantity-picker-view/README.md b/libraries/quantity-picker-view/README.md
index 40ea4b8e..70238ce9 100644
--- a/libraries/quantity-picker-view/README.md
+++ b/libraries/quantity-picker-view/README.md
@@ -64,6 +64,8 @@ To set programmatically, you can call `QuantityPickerView.setQuantityPickerViewS
| setQuantity | quantity: Int | To set quantity immediately. |
| setMaxQuantity | maxQuantity: Int | To set maxQuantity immediately. |
| setMinQuantity | minQuantity: Int | To set minQuantity immediately. |
+| setAddIconDrawable | icon: Drawable | To set addIconDrawable immediately. |
+| setBackgroundImageDrawable | background: Drawable | To set backgroundImageDrawable 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 58f1a186..31fefee9 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
@@ -103,13 +103,15 @@ class QuantityPickerView : ConstraintLayout {
imageAdd.setOnClickListener {
if (viewState?.isLoading() == true) return@setOnClickListener
- setQuantityPickerViewState(
- if (onAddClicked?.invoke(viewState?.currentQuantity ?: 0) == true) {
- viewState?.getWithLoading()
- } else {
- viewState?.getWithAddValue()
- }
- )
+ if (viewState?.addButtonEnabled == true) {
+ setQuantityPickerViewState(
+ if (onAddClicked?.invoke(viewState?.currentQuantity ?: 0) == true) {
+ viewState?.getWithLoading()
+ } else {
+ viewState?.getWithAddValue()
+ }
+ )
+ }
}
}
@@ -248,6 +250,7 @@ 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)
@@ -314,6 +317,7 @@ 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 77260aac..c1c7a9f3 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
@@ -13,6 +13,7 @@ data class QuantityPickerViewState(
@ColorInt private val quantityTextColor: Int,
private val quantityTextSize: Int,
private val quantityTextStyle: Int = 0,
+ val addButtonEnabled: Boolean = true,
val currentQuantity: Int = 0,
val backgroundDrawable: Drawable,
@ColorInt val progressTintColor: Int,
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 95b21b1b..df70a296 100644
--- a/libraries/quantity-picker-view/src/main/res/values/attrs.xml
+++ b/libraries/quantity-picker-view/src/main/res/values/attrs.xml
@@ -17,6 +17,7 @@
+