Skip to content

Commit

Permalink
Merge pull request #91 from Trendyol/quantityPickerView/AddIconAndBac…
Browse files Browse the repository at this point in the history
…kgroundSetters

Quantity picker view/add icon and background setters
  • Loading branch information
bilgehankalkan authored Nov 1, 2022
2 parents c301c1b + 67927dd commit 4e46796
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/ComponentVersions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object ComponentVersions {
const val phoneNumberVersion = "1.0.2"
const val dialogsVersion = "1.4.0"
const val cardInputViewVersion = "1.2.3"
const val quantityPickerViewVersion = "1.2.5"
const val quantityPickerViewVersion = "1.2.8"
const val timelineViewVersion = "1.0.1"
const val touchDelegatorVersion = "1.0.0"
const val fitOptionMessageView = "1.0.0"
Expand Down
1 change: 1 addition & 0 deletions libraries/quantity-picker-view/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ 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. |
| 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.trendyol.uicomponents.quantitypickerview

import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import android.util.AttributeSet
import android.view.LayoutInflater
Expand Down Expand Up @@ -166,6 +167,10 @@ class QuantityPickerView : ConstraintLayout {
fun setMinQuantity(minQuantity: Int) =
setQuantityPickerViewState(binding.viewState?.getWithMinQuantity(minQuantity))

fun setBackgroundImageDrawable(background: Drawable){
setQuantityPickerViewState(binding.viewState?.getWithBackgroundDrawable(background))
}

fun stopLoading() = setQuantityPickerViewState(binding.viewState?.stopLoading())

fun reset() = setQuantityPickerViewState(binding.viewState?.reset())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ data class QuantityPickerViewState(
return copy(minQuantity = minQuantity, showLoading = false)
}

internal fun getWithBackgroundDrawable(background: Drawable): QuantityPickerViewState {
return copy(backgroundDrawable = background)
}

internal fun stopLoading(): QuantityPickerViewState =
copy(showLoading = false, expansionState = expansionState.expand())

Expand Down

0 comments on commit 4e46796

Please sign in to comment.