diff options
author | Sergei Kozelko <KozelkoS@yandex.ru> | 2022-10-22 06:37:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 06:37:31 +0000 |
commit | 5e3eaafe268fc64e8c7d92187e6c2447addc410d (patch) | |
tree | 5f2f1a6aa77d1811083f95e32893d6b27384630d /app/src/main/res/values | |
parent | d11fb884c26c739e9e919ec98c1a0990f0953c93 (diff) | |
download | infinity-for-reddit-5e3eaafe268fc64e8c7d92187e6c2447addc410d.tar infinity-for-reddit-5e3eaafe268fc64e8c7d92187e6c2447addc410d.tar.gz infinity-for-reddit-5e3eaafe268fc64e8c7d92187e6c2447addc410d.tar.bz2 infinity-for-reddit-5e3eaafe268fc64e8c7d92187e6c2447addc410d.tar.lz infinity-for-reddit-5e3eaafe268fc64e8c7d92187e6c2447addc410d.tar.xz infinity-for-reddit-5e3eaafe268fc64e8c7d92187e6c2447addc410d.tar.zst infinity-for-reddit-5e3eaafe268fc64e8c7d92187e6c2447addc410d.zip |
Add view that can lock swipe-to-close gesture (#1140)
Slidr works by adding its own view in the hierarchy and listening to touch
events in `onInterceptTouchEvent`. Once it detects movement in the correct
direction, it returns `true` and handles all the events itself.
Adding scrollable view detection to Slidr would solve the problem, but it is
not possible and would probably have performance impact.
Fortunately Slidr does not intercept the very first event, which is
ACTION_DOWN, and it reaches scrollable view. So the scrollable view itself can
decide if it should disallow the swipe.
This also has a performance benefit over `OnScrollChangedListener` because
the listener is triggered for every scroll of every view even if the child we
are interested in did not scroll. On the other hand `on(Intercept)TouchEvent`
is triggered only when the view is touched.
There is a possibility that swipe won't be unlocked if view never receives
ACTION_UP or ACTION_CANCEL. However the docs say nothing about the probability
of this happening. Anyways, one possible solution is to post a runnable that
will unlock swipe soon after locking.
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions