mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
**Refactor: Convert minimumThresholdForSwipe to a compile-time constant**
This commit is contained in:
parent
7d6a46097c
commit
cb41668cc5
1 changed files with 7 additions and 2 deletions
|
|
@ -21,9 +21,14 @@ abstract class SwipableCardView @JvmOverloads constructor(
|
|||
defStyleAttr: Int = 0
|
||||
) : CardView(context, attrs, defStyleAttr) {
|
||||
|
||||
|
||||
companion object{
|
||||
const val MINIMUM_THRESHOLD_FOR_SWIPE = 100f
|
||||
}
|
||||
|
||||
private var x1 = 0f
|
||||
private var x2 = 0f
|
||||
private val minimumThresholdForSwipe = 100f
|
||||
|
||||
|
||||
init {
|
||||
interceptOnTouchListener()
|
||||
|
|
@ -45,7 +50,7 @@ abstract class SwipableCardView @JvmOverloads constructor(
|
|||
isSwipe = deltaX != 0f
|
||||
}
|
||||
}
|
||||
if (isSwipe && pixelToDp(abs(deltaX)) > minimumThresholdForSwipe) {
|
||||
if (isSwipe && pixelToDp(abs(deltaX)) > MINIMUM_THRESHOLD_FOR_SWIPE) {
|
||||
onSwipe(v)
|
||||
return@setOnTouchListener true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue