Browse Source

Change how empty text is positioned for file/folder choosers. Resolves #1614.

Aidan Follestad 6 years ago
parent
commit
4a7ea5a733

+ 0 - 11
files/src/main/java/com/afollestad/materialdialogs/files/DialogFileChooserExt.kt

@@ -13,14 +13,12 @@ import androidx.annotation.StringRes
 import androidx.recyclerview.widget.LinearLayoutManager
 import com.afollestad.materialdialogs.MaterialDialog
 import com.afollestad.materialdialogs.WhichButton.POSITIVE
-import com.afollestad.materialdialogs.actions.hasActionButtons
 import com.afollestad.materialdialogs.actions.setActionButtonEnabled
 import com.afollestad.materialdialogs.customview.customView
 import com.afollestad.materialdialogs.customview.getCustomView
 import com.afollestad.materialdialogs.files.utilext.hasReadStoragePermission
 import com.afollestad.materialdialogs.files.utilext.hasWriteStoragePermission
 import com.afollestad.materialdialogs.files.utilext.maybeSetTextColor
-import com.afollestad.materialdialogs.files.utilext.updatePadding
 import com.afollestad.materialdialogs.input.input
 import com.afollestad.materialdialogs.internal.list.DialogRecyclerView
 import java.io.File
@@ -90,15 +88,6 @@ fun MaterialDialog.fileChooser(
     }
   }
 
-  if (allowFolderCreation) {
-    // Increase empty text top padding to make room for New Folder option
-    emptyText.updatePadding(
-        top = context.resources.getDimensionPixelSize(
-            R.dimen.empty_text_padding_top_larger
-        )
-    )
-  }
-
   return this
 }
 

+ 4 - 3
files/src/main/res/layout/md_file_chooser_base.xml

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:orientation="vertical"
     >
 
   <com.afollestad.materialdialogs.internal.list.DialogRecyclerView
@@ -23,10 +24,10 @@
       android:paddingBottom="@dimen/empty_text_padding"
       android:paddingLeft="@dimen/empty_text_padding"
       android:paddingRight="@dimen/empty_text_padding"
-      android:paddingTop="@dimen/empty_text_padding_top"
+      android:paddingTop="@dimen/empty_text_padding"
       android:textColor="?android:textColorSecondary"
       android:textSize="@dimen/empty_text_size"
       tools:text="No files!"
       />
 
-</FrameLayout>
+</LinearLayout>

+ 1 - 3
files/src/main/res/values/dimens.xml

@@ -1,9 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
   <dimen name="empty_text_size">18sp</dimen>
-  <dimen name="empty_text_padding">48dp</dimen>
-  <dimen name="empty_text_padding_top">72dp</dimen>
-  <dimen name="empty_text_padding_top_larger">132dp</dimen>
+  <dimen name="empty_text_padding">32dp</dimen>
   <dimen name="file_chooser_item_vertical_padding">8dp</dimen>
   <dimen name="file_chooser_item_horizontal_padding">22dp</dimen>
   <dimen name="file_chooser_item_icon_margin_end">12dp</dimen>