From 0b431a331128bfcf7af3a6512623df74e38b5776 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 22 Apr 2022 20:53:29 +0200 Subject: Update filter dialog to Fragment --- .../de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ui/common') diff --git a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java index 94ef73ffc..578208be4 100644 --- a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/RecursiveRadioGroup.java @@ -6,6 +6,9 @@ import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.RadioButton; +import android.widget.RadioGroup; +import androidx.annotation.Nullable; + import java.util.ArrayList; /** @@ -15,6 +18,8 @@ import java.util.ArrayList; public class RecursiveRadioGroup extends LinearLayout { private final ArrayList radioButtons = new ArrayList<>(); private RadioButton checkedButton = null; + @Nullable + private RadioGroup.OnCheckedChangeListener checkedChangeListener; public RecursiveRadioGroup(Context context) { super(context); @@ -34,6 +39,10 @@ public class RecursiveRadioGroup extends LinearLayout { parseChild(child); } + public void setOnCheckedChangeListener(@Nullable RadioGroup.OnCheckedChangeListener listener) { + checkedChangeListener = listener; + } + public void parseChild(final View child) { if (child instanceof RadioButton) { RadioButton button = (RadioButton) child; @@ -43,6 +52,9 @@ public class RecursiveRadioGroup extends LinearLayout { return; } checkedButton = (RadioButton) buttonView; + if (checkedChangeListener != null) { + checkedChangeListener.onCheckedChanged(null, checkedButton.getId()); + } for (RadioButton view : radioButtons) { if (view != buttonView) { -- cgit v1.2.3