Skip to content

Commit

Permalink
Update QuantityPickerView.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhE authored Mar 19, 2020
1 parent 8b47df3 commit 3da8e5a
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ import kotlin.math.*
@Suppress("unused", "MemberVisibilityCanBePrivate", "SameParameterValue")
class QuantityPickerView : View {

enum class Button {
ADD, REMOVE
}
enum class Button { ADD, REMOVE }

private val defaultMaxWidth = 200
private val defaultMaxAlpha = 255
Expand Down Expand Up @@ -422,8 +420,8 @@ class QuantityPickerView : View {
}

private fun updateButtonsRect() {
removeButtonRect = Rect(btnRemoveXPosition.toInt(), measuredHeight / 2 - btnRemove.height / 2, btnRemove.width, btnRemove.height)
addButtonRect = Rect((btnAddXPosition.toInt()), measuredHeight / 2 - btnAdd.height / 2, measuredWidth, btnAdd.height)
removeButtonRect = Rect(btnRemoveXPosition.toInt(), 0, btnRemove.width, btnRemove.height)
addButtonRect = Rect((btnAddXPosition.toInt()), 0, measuredWidth, btnAdd.height)
}
//endregion animation

Expand Down Expand Up @@ -489,7 +487,7 @@ class QuantityPickerView : View {
canvas.drawBitmap(
btnRemove,
btnRemoveXPosition,
(height / 2 - btnRemove.height / 2).toFloat(),
0f,
btnRemovePaint.apply {
alpha = pickerPaint.alpha
colorFilter = if (!isRippleEnabled && btnRemovePressed) darkenColorFilter else null
Expand All @@ -498,7 +496,7 @@ class QuantityPickerView : View {
canvas.drawBitmap(
btnAdd,
btnAddXPosition,
(height / 2 - btnAdd.height / 2).toFloat(),
0f,
btnAddPaint.apply {
colorFilter = if (!isRippleEnabled && btnAddPressed) darkenColorFilter else null
})
Expand Down

0 comments on commit 3da8e5a

Please sign in to comment.