/*
- * Copyright © 2020 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
}
protected void manageFabOnScroll() {
final MainActivity mainActivity = getMainActivity();
- int triggerPixels = DimensionUtils.dp2px(mainActivity, 30f);
+ int triggerPixels = DimensionUtils.dp2px(mainActivity, 10f);
root.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
private float upAnchor = -1;
- private float downAnchor = -1;
private float lastY;
@Override
public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
- lastY = upAnchor = downAnchor = e.getAxisValue(MotionEvent.AXIS_Y);
+ lastY = upAnchor = e.getAxisValue(MotionEvent.AXIS_Y);
break;
case MotionEvent.ACTION_MOVE:
final float currentY = e.getAxisValue(MotionEvent.AXIS_Y);
}
else {
// swipe up
- downAnchor = lastY;
-
if (currentY < upAnchor - triggerPixels)
mainActivity.fabHide();
}