diff options
author | Daniel <dk.mailbox@gmx.net> | 2018-11-18 23:45:45 +0300 |
---|---|---|
committer | Daniel <dk.mailbox@gmx.net> | 2018-11-18 23:45:45 +0300 |
commit | 3b1f8d1702bce18392169d7b3bac1c093d7174b5 (patch) | |
tree | cf31c156b03ebdb3bd90b7688e989730f5d09586 | |
parent | 5c616d4a3e2180df31d6f1fcbb8f4ff304011168 (diff) |
590 - another option, only mark read if swipe starts at window bottom
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java index c11a55d1..e6757a95 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java @@ -460,16 +460,18 @@ public class NewsReaderDetailFragment extends Fragment { private class RecyclerViewOnGestureListener extends GestureDetector.SimpleOnGestureListener { - // div by negative number to make comparison below more natural - private int minMarkReadDistance = Resources.getSystem().getDisplayMetrics().heightPixels/-4; + private int minBottomDistance = 100; @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - // check for scroll-up (distance < 0) larger than a third of screen height - if (mMarkAsReadWhileScrollingEnabled && (e2.getY() - e1.getY()) < minMarkReadDistance) { + if (mMarkAsReadWhileScrollingEnabled && + e1.getY() > recyclerView.getBottom()-minBottomDistance && // only if gesture started at screen bottom + (e2.getY() - e1.getY()) < 0) { // and if swipe direction is upwards handleMarkAsReadScrollEvent(); + return true; } - return super.onScroll(e1, e2, distanceX, distanceY); + return false; + //return super.onScroll(e1, e2, distanceX, distanceY); } } |