Improve dialog layouts

Improve the dialog layouts so that only the recyclerview scrolls when it cannot fit instead of the entire layout being forced to scroll.
This commit is contained in:
OxygenCobalt
2021-03-26 15:24:04 -06:00
parent 076d2b3d7e
commit 53ec1aa8a5
8 changed files with 85 additions and 82 deletions
@@ -107,7 +107,9 @@ class BlacklistDialog : LifecycleDialog() {
blacklistModel.loadDatabasePaths()
}
private fun addDocTreePath(uri: Uri) {
private fun addDocTreePath(uri: Uri?) {
uri ?: return
val path = parseDocTreePath(uri)
if (path != null) {
@@ -126,10 +128,8 @@ class BlacklistDialog : LifecycleDialog() {
// Turn it into a semi-usable path
val typeAndPath = DocumentsContract.getTreeDocumentId(docUri).split(":")
// We only support the main drive since that's all we can get from MediaColumns.DATA.
// We also check if this directory actually has multiple parts, if it isn't, then its
// the root directory and it shouldn't be supported.
if (typeAndPath[0] == "primary" && typeAndPath.size == 2) {
// Only the main drive is supported, since thats all we can get from MediaColumns.DATA
if (typeAndPath[0] == "primary") {
return getRootPath() + "/" + typeAndPath.last()
}
@@ -11,7 +11,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
* [DialogFragment] that replicates the Fragment lifecycle in regards to [AlertDialog], which
* doesn't seem to set the view from onCreateView correctly.
*/
abstract class LifecycleDialog() : DialogFragment() {
abstract class LifecycleDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return MaterialAlertDialogBuilder(requireActivity(), theme).create()
}