Redesign filter dialog

This commit is contained in:
bws9000 2020-07-07 10:55:56 -04:00
parent 06f36d12d8
commit 2ce23f6868
13 changed files with 42 additions and 84 deletions

View File

@ -50,9 +50,7 @@ public abstract class FilterDialog {
for (String filterId : filterValues) {
if (!TextUtils.isEmpty(filterId)) {
if (layout.findViewWithTag(filterId) != null) {
((RadioButton) layout.findViewWithTag(filterId)).setChecked(true);
}
((RadioButton) layout.findViewWithTag(filterId)).setChecked(true);
}
}
@ -67,6 +65,9 @@ public abstract class FilterDialog {
filterValues.add((String) group.getCheckedButton().getTag());
}
}
if (filterValues.contains(null)) {
filterValues.clear();
}
updateFilter(filterValues);
});

View File

@ -30,7 +30,7 @@
android:button="@android:color/transparent"
android:checked="false"
android:gravity="center"
android:textColor="@drawable/filter_dialog_button_text_light" />
android:textColor="@color/filter_dialog_button_text" />
<RadioButton
android:id="@+id/filter_dialog_radioButton2"
@ -41,7 +41,7 @@
android:button="@android:color/transparent"
android:checked="false"
android:gravity="center"
android:textColor="@drawable/filter_dialog_button_text_light" />
android:textColor="@color/filter_dialog_button_text" />
</LinearLayout>
</androidx.cardview.widget.CardView>
@ -49,7 +49,7 @@
android:id="@+id/filter_dialog_clear"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/filter_dialog_button_clear"
android:background="@drawable/ic_filter_close"
android:button="@android:color/transparent"
android:checked="true" />

View File

@ -35,10 +35,9 @@ public class FeedItemFilter {
public FeedItemFilter(String[] properties) {
this.mProperties = properties;
Log.d("***xxx***", Arrays.toString(properties));
for (String property : properties) {
// see R.arrays.feed_filter_values
switch ("" + property) {
switch (property) {
case "unplayed":
showUnplayed = true;
break;
@ -76,7 +75,7 @@ public class FeedItemFilter {
showNotFavorite = true;
break;
default:
return;
break;
}
}
}
@ -85,7 +84,7 @@ public class FeedItemFilter {
* Run a list of feed items through the filter.
*/
public List<FeedItem> filter(List<FeedItem> items) {
if (mProperties.length == 0) return items;
if(mProperties.length == 0) return items;
List<FeedItem> result = new ArrayList<>();

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/filter_dialog_text_active" android:state_checked="true" />
<item android:color="?attr/filter_dialog_text_inactive" />
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/filter_dialog_clear_active" android:state_checked="true" />
<item android:color="?attr/filter_dialog_clear_inactive" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_filter_close_dark" android:state_checked="true" />
<item android:drawable="@drawable/ic_filter_close_light" />
</selector>

View File

@ -10,9 +10,8 @@
<shape android:shape="oval">
<stroke
android:width="4dp"
android:color="?attr/filter_dialog_clear_active" />
android:color="?attr/filter_dialog_close" />
</shape>
</item>
<!-- x -->
@ -29,7 +28,7 @@
<shape android:shape="line">
<stroke
android:width="4dp"
android:color="?attr/filter_dialog_clear_active" />
android:color="?attr/filter_dialog_close" />
</shape>
</rotate>
</item>
@ -47,7 +46,7 @@
<shape android:shape="line">
<stroke
android:width="4dp"
android:color="?attr/filter_dialog_clear_active" />
android:color="?attr/filter_dialog_close" />
</shape>
</rotate>

View File

@ -1,55 +0,0 @@
<?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_inactive" />
</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_inactive" />
</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_inactive" />
</shape>
</rotate>
</item>
</layer-list>

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="filter_dialog_close" format="reference" />
<attr name="filter_dialog_text_active" format="reference" />
<attr name="filter_dialog_text_inactive" format="reference" />
<attr name="filter_dialog_button_background" format="reference" />
<attr name="filter_dialog_button_clear" format="reference" />
<attr name="filter_dialog_clear_active" format="reference" />
<attr name="filter_dialog_clear_inactive" format="reference" />
<attr name="action_about" format="reference" />

View File

@ -40,4 +40,7 @@
<color name="dialog_filter_clear_inactive_light">#757575</color>
<color name="dialog_filter_clear_inactive_dark">#46C6C6C6</color>
<color name="dialog_filter_text_active">#FFFFFF</color>
<color name="dialog_filter_text_inactive">#000000</color>
</resources>

View File

@ -9,9 +9,6 @@
<item name="filter_dialog_button_background">
@drawable/filter_dialog_button_background_light
</item>
<item name="filter_dialog_button_clear">@drawable/filter_dialog_button_clear</item>
<item name="filter_dialog_clear_active">@color/dialog_filter_clear_active_light</item>
<item name="filter_dialog_clear_inactive">@color/dialog_filter_clear_inactive_light</item>
<item name="colorPrimary">@color/accent_light</item>
<item name="colorAccent">@color/accent_light</item>
<item name="colorSecondary">@color/accent_light</item>
@ -79,6 +76,12 @@
<item name="ic_key">@drawable/ic_key_black</item>
<item name="ic_volume_adaption">@drawable/ic_volume_adaption_black</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_light</item>
<item name="filter_dialog_text_active">@color/dialog_filter_text_active</item>
<item name="filter_dialog_text_inactive">@color/dialog_filter_text_inactive</item>
<item name="filter_dialog_clear_active">@color/dialog_filter_clear_active_light</item>
<item name="filter_dialog_clear_inactive">@color/dialog_filter_clear_inactive_light</item>
<item name="filter_dialog_close">@color/filter_dialog_close</item>
</style>
<style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark">
@ -86,12 +89,6 @@
</style>
<style name="Theme.Base.AntennaPod.Dark" parent="Theme.MaterialComponents">
<item name="filter_dialog_button_background">
@drawable/filter_dialog_button_background_dark
</item>
<item name="filter_dialog_button_clear">@drawable/filter_dialog_button_clear</item>
<item name="filter_dialog_clear_active">@color/dialog_filter_clear_active_dark</item>
<item name="filter_dialog_clear_inactive">@color/dialog_filter_clear_inactive_dark</item>
<item name="colorAccent">@color/accent_dark</item>
<item name="colorSecondary">@color/accent_dark</item>
<item name="colorOnSecondary">@color/black</item>
@ -160,6 +157,13 @@
<item name="ic_key">@drawable/ic_key_white</item>
<item name="ic_volume_adaption">@drawable/ic_volume_adaption_white</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_dark</item>
<item name="filter_dialog_button_background">
@drawable/filter_dialog_button_background_dark
</item>
<item name="filter_dialog_clear_active">@color/dialog_filter_clear_active_dark</item>
<item name="filter_dialog_clear_inactive">@color/dialog_filter_clear_inactive_dark</item>
<item name="filter_dialog_close">@color/filter_dialog_close</item>
</style>
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">