Expand filter dialog by default (#6155)
Before, it did not fully show in landscape mode
This commit is contained in:
parent
cac231a461
commit
655b880c46
|
@ -1,24 +1,31 @@
|
||||||
package de.danoeh.antennapod.dialog;
|
package de.danoeh.antennapod.dialog;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
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.bottomsheet.BottomSheetDialogFragment;
|
||||||
import com.google.android.material.button.MaterialButtonToggleGroup;
|
import com.google.android.material.button.MaterialButtonToggleGroup;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.feed.FeedItemFilterGroup;
|
import de.danoeh.antennapod.core.feed.FeedItemFilterGroup;
|
||||||
import de.danoeh.antennapod.databinding.FilterDialogRowBinding;
|
import de.danoeh.antennapod.databinding.FilterDialogRowBinding;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItemFilter;
|
import de.danoeh.antennapod.model.feed.FeedItemFilter;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public abstract class ItemFilterDialog extends BottomSheetDialogFragment {
|
public abstract class ItemFilterDialog extends BottomSheetDialogFragment {
|
||||||
protected static final String ARGUMENT_FILTER = "filter";
|
protected static final String ARGUMENT_FILTER = "filter";
|
||||||
|
|
||||||
|
@ -54,6 +61,27 @@ public abstract class ItemFilterDialog extends BottomSheetDialogFragment {
|
||||||
return layout;
|
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() {
|
protected Set<String> getNewFilterValues() {
|
||||||
final Set<String> newFilterValues = new HashSet<>();
|
final Set<String> newFilterValues = new HashSet<>();
|
||||||
for (int i = 0; i < rows.getChildCount(); i++) {
|
for (int i = 0; i < rows.getChildCount(); i++) {
|
||||||
|
|
Loading…
Reference in New Issue