]> git.ktnx.net Git - mobile-ledger.git/commitdiff
merge two drawer listeners
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 10 Jun 2020 19:45:59 +0000 (19:45 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 10 Jun 2020 19:45:59 +0000 (19:45 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index 360f3006a19c0c096f14474fa002ab5a964248b7..b44c30f270ef6c2b3c77943c6172d48d67388863 100644 (file)
@@ -185,24 +185,6 @@ public class MainActivity extends ProfileThemedActivity {
             drawer.addDrawerListener(barDrawerToggle);
         }
         barDrawerToggle.syncState();
-        drawer.addDrawerListener(new DrawerLayout.DrawerListener() {
-            @Override
-            public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
-                if (slideOffset > 0.2)
-                    fabHide();
-            }
-            @Override
-            public void onDrawerOpened(@NonNull View drawerView) {
-                fabHide();
-            }
-            @Override
-            public void onDrawerClosed(@NonNull View drawerView) {
-                fabShouldShow();
-            }
-            @Override
-            public void onDrawerStateChanged(int newState) {}
-        });
-
 
         try {
             PackageInfo pi = getApplicationContext().getPackageManager()
@@ -312,16 +294,25 @@ public class MainActivity extends ProfileThemedActivity {
                 (v) -> mProfileListAdapter.flipEditingProfiles());
         if (drawerListener == null) {
             drawerListener = new DrawerLayout.SimpleDrawerListener() {
+                @Override
+                public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
+                    if (slideOffset > 0.2)
+                        fabHide();
+                }
                 @Override
                 public void onDrawerClosed(View drawerView) {
                     super.onDrawerClosed(drawerView);
                     mProfileListAdapter.setAnimationsEnabled(false);
                     mProfileListAdapter.editingProfiles.setValue(false);
+                    Data.drawerOpen.setValue(false);
+                    fabShouldShow();
                 }
                 @Override
                 public void onDrawerOpened(View drawerView) {
                     super.onDrawerOpened(drawerView);
                     mProfileListAdapter.setAnimationsEnabled(true);
+                    Data.drawerOpen.setValue(true);
+                    fabHide();
                 }
             };
             drawer.addDrawerListener(drawerListener);