diff options
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java | 14 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java | 11 | ||||
-rw-r--r-- | app/src/main/res/layout/filter_dialog.xml | 24 | ||||
-rw-r--r-- | app/src/main/res/layout/filter_dialog_row.xml | 6 | ||||
-rw-r--r-- | core/src/main/res/drawable-v21/ic_filter_close.xml | 55 | ||||
-rw-r--r-- | core/src/main/res/drawable/ic_filter_close.xml | 8 | ||||
-rw-r--r-- | core/src/main/res/values/attrs.xml | 2 | ||||
-rw-r--r-- | core/src/main/res/values/styles.xml | 5 |
8 files changed, 96 insertions, 29 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java index 82010637f..80df87891 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/FilterDialog.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.dialog; import android.content.Context; import android.text.TextUtils; import android.view.LayoutInflater; +import android.view.View; import android.widget.LinearLayout; import android.widget.RadioButton; @@ -34,18 +35,19 @@ public abstract class FilterDialog { builder.setTitle(R.string.filter); LayoutInflater inflater = LayoutInflater.from(this.context); - LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.filter_dialog, null, false); + View layout = inflater.inflate(R.layout.filter_dialog, null, false); + LinearLayout rows = layout.findViewById(R.id.filter_rows); builder.setView(layout); for (FeedItemFilterGroup item : FeedItemFilterGroup.values()) { - RecursiveRadioGroup row = (RecursiveRadioGroup) inflater.inflate(R.layout.filter_dialog_row, null); + RecursiveRadioGroup row = (RecursiveRadioGroup) inflater.inflate(R.layout.filter_dialog_row, null, false); RadioButton filter1 = row.findViewById(R.id.filter_dialog_radioButton1); RadioButton filter2 = row.findViewById(R.id.filter_dialog_radioButton2); filter1.setText(item.values[0].displayName); filter1.setTag(item.values[0].filterId); filter2.setText(item.values[1].displayName); filter2.setTag(item.values[1].filterId); - layout.addView(row); + rows.addView(row); } for (String filterId : filterValues) { @@ -56,11 +58,11 @@ public abstract class FilterDialog { builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { filterValues.clear(); - for (int i = 0; i < layout.getChildCount(); i++) { - if (!(layout.getChildAt(i) instanceof RecursiveRadioGroup)) { + for (int i = 0; i < rows.getChildCount(); i++) { + if (!(rows.getChildAt(i) instanceof RecursiveRadioGroup)) { continue; } - RecursiveRadioGroup group = (RecursiveRadioGroup) layout.getChildAt(i); + RecursiveRadioGroup group = (RecursiveRadioGroup) rows.getChildAt(i); if (group.getCheckedButton() != null) { String tag = (String) group.getCheckedButton().getTag(); if (tag != null) { // Clear buttons use no tag diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java index a8915480c..8a87fef25 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SubscriptionsFilterDialog.java @@ -30,7 +30,8 @@ public class SubscriptionsFilterDialog { builder.setTitle(context.getString(R.string.pref_filter_feed_title)); LayoutInflater inflater = LayoutInflater.from(context); - LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.filter_dialog, null, false); + View layout = inflater.inflate(R.layout.filter_dialog, null, false); + LinearLayout rows = layout.findViewById(R.id.filter_rows); builder.setView(layout); for (SubscriptionsFilterGroup item : SubscriptionsFilterGroup.values()) { @@ -45,7 +46,7 @@ public class SubscriptionsFilterDialog { } else { filter2.setVisibility(View.GONE); } - layout.addView(row); + rows.addView(row); } for (String filterId : filterValues) { @@ -56,11 +57,11 @@ public class SubscriptionsFilterDialog { builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { filterValues.clear(); - for (int i = 0; i < layout.getChildCount(); i++) { - if (!(layout.getChildAt(i) instanceof RecursiveRadioGroup)) { + for (int i = 0; i < rows.getChildCount(); i++) { + if (!(rows.getChildAt(i) instanceof RecursiveRadioGroup)) { continue; } - RecursiveRadioGroup group = (RecursiveRadioGroup) layout.getChildAt(i); + RecursiveRadioGroup group = (RecursiveRadioGroup) rows.getChildAt(i); if (group.getCheckedButton() != null) { String tag = (String) group.getCheckedButton().getTag(); if (tag != null) { // Clear buttons use no tag diff --git a/app/src/main/res/layout/filter_dialog.xml b/app/src/main/res/layout/filter_dialog.xml index 39e9258d9..d700f0365 100644 --- a/app/src/main/res/layout/filter_dialog.xml +++ b/app/src/main/res/layout/filter_dialog.xml @@ -1,11 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:paddingLeft="24dp" - android:paddingTop="24dp" - android:paddingRight="24dp" - android:paddingBottom="8dp"> - -</LinearLayout>
\ No newline at end of file +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <LinearLayout + android:id="@+id/filter_rows" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="24dp" + android:paddingTop="24dp" + android:paddingRight="24dp" + android:paddingBottom="8dp"> + </LinearLayout> +</ScrollView> diff --git a/app/src/main/res/layout/filter_dialog_row.xml b/app/src/main/res/layout/filter_dialog_row.xml index 0863997b3..5011812d9 100644 --- a/app/src/main/res/layout/filter_dialog_row.xml +++ b/app/src/main/res/layout/filter_dialog_row.xml @@ -28,7 +28,7 @@ android:layout_marginRight="2dp" android:layout_weight="1" android:background="?attr/filter_dialog_button_background" - android:button="@android:color/transparent" + style="@style/NoButtonRadio" android:foreground="?android:attr/selectableItemBackground" android:checked="false" android:gravity="center" @@ -40,7 +40,7 @@ android:layout_height="match_parent" android:layout_weight="1" android:background="?attr/filter_dialog_button_background" - android:button="@android:color/transparent" + style="@style/NoButtonRadio" android:foreground="?android:attr/selectableItemBackground" android:checked="false" android:gravity="center" @@ -53,7 +53,7 @@ android:layout_width="48dp" android:layout_height="48dp" android:background="@drawable/ic_filter_close" - android:button="@android:color/transparent" + style="@style/NoButtonRadio" android:foreground="?android:attr/selectableItemBackground" android:layout_gravity="center_vertical" android:checked="true" /> diff --git a/core/src/main/res/drawable-v21/ic_filter_close.xml b/core/src/main/res/drawable-v21/ic_filter_close.xml new file mode 100644 index 000000000..9e0a26905 --- /dev/null +++ b/core/src/main/res/drawable-v21/ic_filter_close.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:bottom="5dp" + android:left="5dp" + android:right="5dp" + android:top="5dp"> + + <shape android:shape="oval"> + <stroke + android:width="4dp" + android:color="?attr/filter_dialog_clear" /> + </shape> + </item> + + <!-- x --> + <item + android:bottom="12dp" + android:left="12dp" + android:right="12dp" + android:top="12dp"> + <rotate + android:fromDegrees="135" + android:pivotX="50%" + android:pivotY="50%" + android:toDegrees="135"> + <shape android:shape="line"> + <stroke + android:width="4dp" + android:color="?attr/filter_dialog_clear" /> + </shape> + </rotate> + </item> + + <item + android:bottom="12dp" + android:left="12dp" + android:right="12dp" + android:top="12dp"> + <rotate + android:fromDegrees="45" + android:pivotX="50%" + android:pivotY="50%" + android:toDegrees="45"> + <shape android:shape="line"> + <stroke + android:width="4dp" + android:color="?attr/filter_dialog_clear" /> + </shape> + + </rotate> + </item> + +</layer-list>
\ No newline at end of file diff --git a/core/src/main/res/drawable/ic_filter_close.xml b/core/src/main/res/drawable/ic_filter_close.xml index 9e0a26905..4d7eedb30 100644 --- a/core/src/main/res/drawable/ic_filter_close.xml +++ b/core/src/main/res/drawable/ic_filter_close.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - + <!-- Fall-back for old Android devices that do not support attrs as colors --> <item android:bottom="5dp" android:left="5dp" @@ -10,7 +10,7 @@ <shape android:shape="oval"> <stroke android:width="4dp" - android:color="?attr/filter_dialog_clear" /> + android:color="#555" /> </shape> </item> @@ -28,7 +28,7 @@ <shape android:shape="line"> <stroke android:width="4dp" - android:color="?attr/filter_dialog_clear" /> + android:color="#555" /> </shape> </rotate> </item> @@ -46,7 +46,7 @@ <shape android:shape="line"> <stroke android:width="4dp" - android:color="?attr/filter_dialog_clear" /> + android:color="#555" /> </shape> </rotate> diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index a78f837bf..3a5ec310b 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -58,7 +58,7 @@ <attr name="action_icon_color" format="color"/> <attr name="scrollbar_thumb" format="reference"/> <attr name="background_elevated" format="color"/> - <attr name="filter_dialog_clear" format="reference"/> + <attr name="filter_dialog_clear" format="color"/> <attr name="filter_dialog_button_background" format="reference"/> <attr name="ic_notifications" format="reference"/> diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 9ec82215a..b5c10ae0e 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -318,4 +318,9 @@ <item name="android:clickable">true</item> </style> + <style name="NoButtonRadio" parent="Widget.MaterialComponents.CompoundButton.RadioButton"> + <item name="buttonCompat">@null</item> <!-- For Android 4.4 --> + <item name="android:button">@null</item> + </style> + </resources> |