]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/MobileLedgerListFragment.java
flag initial amount hint as present (still null)
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / MobileLedgerListFragment.java
index 94d54f16b41208063810ad5dbe3da8bc6c649b46..a61f44f6e2417eb2d54654827e8d731c20586ac6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -30,7 +30,7 @@ import net.ktnx.mobileledger.utils.Colors;
 import net.ktnx.mobileledger.utils.DimensionUtils;
 
 public class MobileLedgerListFragment extends Fragment {
-    public SwipeRefreshLayout swiper;
+    public SwipeRefreshLayout refreshLayout;
     public TransactionListAdapter modelAdapter;
     protected RecyclerView root;
     @NonNull
@@ -38,27 +38,26 @@ public class MobileLedgerListFragment extends Fragment {
         return (MainActivity) requireActivity();
     }
     protected void themeChanged(Integer counter) {
-        swiper.setColorSchemeColors(Colors.getSwipeCircleColors());
+        refreshLayout.setColorSchemeColors(Colors.getSwipeCircleColors());
     }
     public void onBackgroundTaskRunningChanged(Boolean isRunning) {
         if (getActivity() == null)
             return;
-        if (swiper == null)
+        if (refreshLayout == null)
             return;
-        swiper.setRefreshing(isRunning);
+        refreshLayout.setRefreshing(isRunning);
     }
     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);
@@ -70,8 +69,6 @@ public class MobileLedgerListFragment extends Fragment {
                         }
                         else {
                             // swipe up
-                            downAnchor = lastY;
-
                             if (currentY < upAnchor - triggerPixels)
                                 mainActivity.fabHide();
                         }