Эх сурвалжийг харах

FileActionsBottomSheet: make scrollable in case full list doesn't fit in screen

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Álvaro Brey 2 жил өмнө
parent
commit
e7ff6df581

+ 1 - 2
app/src/main/java/com/nextcloud/ui/fileactions/FileActionsBottomSheet.kt

@@ -42,9 +42,8 @@ import javax.inject.Inject
 // TODO add file name
 // TODO add lock info (see FileLockingMenuCustomization)
 // TODO give events back
-// TODO drag handle
+// TODO drag handle (needs material 1.7.0)
 // TODO theming
-// TODO scrollable (for small screens)
 class FileActionsBottomSheet private constructor() : BottomSheetDialogFragment(), Injectable {
 
     lateinit var componentsGetter: ComponentsGetter

+ 3 - 0
app/src/main/java/com/owncloud/android/files/FileMenuFilter.java

@@ -50,6 +50,7 @@ import java.util.List;
 import javax.inject.Inject;
 
 import androidx.annotation.IdRes;
+import androidx.annotation.VisibleForTesting;
 
 /**
  * Filters out the file actions available in a given {@link Menu} for a given {@link OCFile}
@@ -151,6 +152,8 @@ public class FileMenuFilter {
      * @param menu                 Options or context menu to filter.
      * @param inSingleFileFragment True if this is not listing, but single file fragment, like preview or details.
      */
+    @Deprecated
+    @VisibleForTesting // TODO remove this, we only need toHide now
     public void filter(Menu menu, boolean inSingleFileFragment) {
         if (files == null || files.isEmpty()) {
             MenuUtils.hideAll(menu);

+ 8 - 6
app/src/main/res/layout/file_actions_bottom_sheet.xml

@@ -30,13 +30,15 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
-
-        <LinearLayout
-            android:id="@+id/file_actions_list"
+        <androidx.core.widget.NestedScrollView
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical">
-        </LinearLayout>
+            android:layout_height="wrap_content">
+            <LinearLayout
+                android:id="@+id/file_actions_list"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"/>
+        </androidx.core.widget.NestedScrollView>
     </FrameLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>