Skip to content

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

Description

@vraj-s-shah

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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