Closed paskalito closed 4 years ago
Sure, we are using ItemTouchHelper.onSwiped()
for a consistent UX in android. So we let the framework decide how long one does need to swipe to recognize it as an actual swipe.
I did not see any configuration options (Like Toast.LENGTH_SHORT
/ TOAST.LENGTH_LONG
), so it ended up being the default.
For me personally it always worked great and i deleted an note accidentally maybe once (which was no problem because of undo).
Maybe you have an idea how to optimize this behavior without introducing 400 lines of extra code? A PR would be very welcome :)
The current length depends not only on the actual dragged width but also on the speed and seems to be identical with deleting emails in Mail apps, SMS apps etc.
thanks for your replies! unfortunately i don't know anything about android dev..
i made a video dough (with "touchpoint" enabled) to see how super sensitive it is on my device.
i don't have other apps that use this functionality besides conversations (where it is a lot less sensitive - maybe it is possible to look at that code) and opentasks (where it is actually to hard to swipe something away in my opinion)
conversations seems to import it it at least from a diffrent place
getSwipeThreshold – Here we return the float value. example 0.5f means that a 50 percent swipe on the RecyclerView row would be considered as a swipe.
from here: https://www.journaldev.com/23164/android-recyclerview-swipe-to-delete-undo
https://www.journaldev.com/23164/android-recyclerview-swipe-to-delete-undo
Now this looks interesting! I will investigate this, this might be a solution, indeed!
Okay, the swipe threshold only counts, if one drags lets say 50%, the stop and then release the finger from the display.
But as far as i can tell after trying this, it does not affect the width, if the finger is released from the display within the dragging-movement.
I am currently looking at the getSwipeEscapeVelocity
method, which is also overridden by conversations.
Okay, that's it. I trippled the defaultValue
and it is now way harder to delete a note accidently.
Maybe one of you can check the current master
branch (or wait until 2.4.2
has been build by F-Droid) and give some feedback here?
Just for reference: https://stackoverflow.com/a/53514523
cc @kzar79 check out the last comment, feedback is welcome :)
but i fail in understanding what gesture exactly triggers the motion.. maybe try to multiply the value by 10 ?
in conversations i just checked again you activly/willingly must drag the conversation for about 40% of your display to delete it (and if you swipe out of the element while dragging (in a vertical axis) it still will delete it if you drag it enough in the horiziontal axis.
im on a Galaxy S4 LOS Android 7
And i constantly delete notes in normal operation because the gesture is so sensitive.
I would argue that something like almost half of display with or a third of it should be actively swiped (with finger on the display) before "release animation" gets triggered / file deleted.
just for the fun: it got much worse since https://github.com/stefan-niedermann/nextcloud-notes/issues/661 AND this https://github.com/nextcloud/server/issues/13160 affects me ^^