hide FAB in copy/move folder chooser
authorAndy Scherzinger <info@andy-scherzinger.de>
Tue, 27 Oct 2015 12:39:50 +0000 (13:39 +0100)
committerAndy Scherzinger <info@andy-scherzinger.de>
Tue, 27 Oct 2015 12:39:50 +0000 (13:39 +0100)
res/layout/list_fragment.xml
src/com/owncloud/android/ui/activity/FolderPickerActivity.java
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

index a4791b4..ac28fcf 100644 (file)
@@ -97,7 +97,8 @@
         fab:fab_labelStyle="@style/menu_labels_style"
         android:layout_marginBottom="@dimen/standard_margin"
         android:layout_marginRight="@dimen/standard_margin"
-        android:layout_marginEnd="@dimen/standard_margin">
+        android:layout_marginEnd="@dimen/standard_margin"
+        android:visibility="gone">
 
         <com.getbase.floatingactionbutton.FloatingActionButton
             android:id="@+id/fab_upload"
index 574050f..c3b96da 100644 (file)
@@ -155,6 +155,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         Bundle args = new Bundle();
         args.putBoolean(OCFileListFragment.ARG_JUST_FOLDERS, true);
         args.putBoolean(OCFileListFragment.ARG_ALLOW_CONTEXTUAL_ACTIONS, false);
+        args.putBoolean(OCFileListFragment.ARG_HIDE_FAB, true);
         listOfFiles.setArguments(args);
         FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
         transaction.add(R.id.fragment_container, listOfFiles, TAG_LIST_OF_FOLDERS);
index a7c7a5d..613b5c8 100644 (file)
@@ -80,6 +80,7 @@ public class OCFileListFragment extends ExtendedListFragment implements FileActi
 
     public final static String ARG_JUST_FOLDERS = MY_PACKAGE + ".JUST_FOLDERS";
     public final static String ARG_ALLOW_CONTEXTUAL_ACTIONS = MY_PACKAGE + ".ALLOW_CONTEXTUAL";
+    public final static String ARG_HIDE_FAB = MY_PACKAGE + ".HIDE_FAB";
 
     private static final String KEY_FILE = MY_PACKAGE + ".extra.FILE";
     private static final String KEY_FAB_EVER_CLICKED = "FAB_EVER_CLICKED";
@@ -155,19 +156,26 @@ public class OCFileListFragment extends ExtendedListFragment implements FileActi
         setListAdapter(mAdapter);
 
         registerLongClickListener();
-        registerFabListeners();
 
-        // detect if a mini FAB has ever been clicked
-        final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
-        if(prefs.getLong(KEY_FAB_EVER_CLICKED, 0) > 0) {
-            miniFabClicked = true;
-        }
-
-        // add labels to the min FABs when none of them has ever been clicked on
-        if(!miniFabClicked) {
-            setFabLabels();
+        boolean hideFab = (args != null) && args.getBoolean(ARG_HIDE_FAB, false);
+        if (hideFab) {
+            setFabEnabled(false);
         } else {
-            removeFabLabels();
+            setFabEnabled(true);
+            registerFabListeners();
+
+            // detect if a mini FAB has ever been clicked
+            final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
+            if(prefs.getLong(KEY_FAB_EVER_CLICKED, 0) > 0) {
+                miniFabClicked = true;
+            }
+
+            // add labels to the min FABs when none of them has ever been clicked on
+            if(!miniFabClicked) {
+                setFabLabels();
+            } else {
+                removeFabLabels();
+            }
         }
   }