Skip to content

How to get the swiped card direction, whether it's swiped left or right ? #2

@aliraza96

Description

@aliraza96

How to get the swiped card direction, whether it's swiped left or right ?

There's no method to get the swipe direction. Only method available is this

binding.stackLayout.onChangeListener = object : OnChangeListener {
override fun onChange(remainingCardsCount: Int, totalCardsCount: Int) {
//Log.d("StackView", "remainingCardsCount :: $remainingCardsCount, totalCardsCount :: $totalCardsCount")
if (remainingCardsCount < totalCardsCount) {

                // Get the item that was just swiped
                val swipedItem = allPhotos[currentItemIndex]

                // Print the swiped item
                Toast.makeText(this@PhotoSwipeActivity, "The currently swiped item is: ${swipedItem.name}", Toast.LENGTH_SHORT).show()

                // Increment the counter to track the next item
                currentItemIndex++
            }
        }
    }

No way to figure out the swiped direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions