diff options
author | Lukmannudin <32972299+Lukmannudin@users.noreply.github.com> | 2022-10-23 17:15:57 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-23 12:15:57 +0200 |
commit | 655b880c464094d7147ae079a8d206f71eb31e42 (patch) | |
tree | 8fc3ccbb4105918443d910ba2780414fb09e0644 | |
parent | cac231a461c11f64eae3284553d6b69f6f65a052 (diff) | |
download | AntennaPod-655b880c464094d7147ae079a8d206f71eb31e42.zip |
Expand filter dialog by default (#6155)
Before, it did not fully show in landscape mode
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java index 0118eb74e..a122a7cec 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ItemFilterDialog.java @@ -1,24 +1,31 @@ package de.danoeh.antennapod.dialog; +import android.app.Dialog; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.FrameLayout; import android.widget.LinearLayout; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; + +import com.google.android.material.bottomsheet.BottomSheetBehavior; +import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.button.MaterialButtonToggleGroup; + +import java.util.HashSet; +import java.util.Set; + import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.FeedItemFilterGroup; import de.danoeh.antennapod.databinding.FilterDialogRowBinding; import de.danoeh.antennapod.model.feed.FeedItemFilter; -import java.util.HashSet; -import java.util.Set; - public abstract class ItemFilterDialog extends BottomSheetDialogFragment { protected static final String ARGUMENT_FILTER = "filter"; @@ -54,6 +61,27 @@ public abstract class ItemFilterDialog extends BottomSheetDialogFragment { return layout; } + @NonNull + @Override + public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { + Dialog dialog = super.onCreateDialog(savedInstanceState); + dialog.setOnShowListener(dialogInterface -> { + BottomSheetDialog bottomSheetDialog = (BottomSheetDialog) dialogInterface; + setupFullHeight(bottomSheetDialog); + }); + return dialog; + } + + private void setupFullHeight(BottomSheetDialog bottomSheetDialog) { + FrameLayout bottomSheet = (FrameLayout) bottomSheetDialog.findViewById(R.id.design_bottom_sheet); + if (bottomSheet != null) { + BottomSheetBehavior<FrameLayout> behavior = BottomSheetBehavior.from(bottomSheet); + ViewGroup.LayoutParams layoutParams = bottomSheet.getLayoutParams(); + bottomSheet.setLayoutParams(layoutParams); + behavior.setState(BottomSheetBehavior.STATE_EXPANDED); + } + } + protected Set<String> getNewFilterValues() { final Set<String> newFilterValues = new HashSet<>(); for (int i = 0; i < rows.getChildCount(); i++) { |