Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting setEnabledSwipe(false) from adapter is not actually disabling the swipe #15

Open
vraj-s-shah opened this issue Aug 1, 2023 · 0 comments · May be fixed by #18
Open

Setting setEnabledSwipe(false) from adapter is not actually disabling the swipe #15

vraj-s-shah opened this issue Aug 1, 2023 · 0 comments · May be fixed by #18

Comments

@vraj-s-shah
Copy link

I have some conditions where I just want specific users to get the swipe functionality but somehow it is enabling swipe for everyone

(binding as? ItemRoomMemberBinding)?.apply {
    if (!isSwipeEnabled || loggedInUserId == data.userId) {
        swipeLayout.isEnabledSwipe = false
        return
    }
    swipeLayout.setOnActionsListener(object : SwipeLayout.SwipeActionsListener {
        override fun onOpen(direction: Int, isContinuous: Boolean) {
            currentlyOpenedSwipeLayout?.close(true)
            currentlyOpenedSwipeLayout = swipeLayout
        }

        override fun onClose() {
            //NO-OP
        }
    })
    ivAddMember.setOnClickListener {
        swipeLayout.close(true)
    }
    ivRemoveMember.setOnClickListener {
        swipeLayout.close(true)
    }
}

Here isSwipeEnabled is set from outside based on some condition. Even if I pass false to isSwipeEnabled and let the code swipeLayout.isEnabledSwipe = false run, it still let the user swipe instead of disabling.

@PhilKes PhilKes linked a pull request Sep 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant