diff options
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java | 30 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilterGroup.java | 36 | ||||
-rw-r--r-- | core/src/main/res/color/filter_dialog_background_dark.xml | 5 | ||||
-rw-r--r-- | core/src/main/res/color/filter_dialog_background_light.xml | 5 | ||||
-rw-r--r-- | core/src/main/res/color/filter_dialog_button_text.xml | 5 | ||||
-rw-r--r-- | core/src/main/res/color/filter_dialog_clear_dark.xml | 5 | ||||
-rw-r--r-- | core/src/main/res/color/filter_dialog_clear_light.xml | 5 | ||||
-rw-r--r-- | core/src/main/res/drawable/ic_filter_close.xml | 55 | ||||
-rw-r--r-- | core/src/main/res/values/arrays.xml | 24 | ||||
-rw-r--r-- | core/src/main/res/values/attrs.xml | 2 | ||||
-rw-r--r-- | core/src/main/res/values/colors.xml | 5 | ||||
-rw-r--r-- | core/src/main/res/values/strings.xml | 21 | ||||
-rw-r--r-- | core/src/main/res/values/styles.xml | 6 |
13 files changed, 167 insertions, 37 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java index 719383d23..d34e23506 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java @@ -1,8 +1,10 @@ package de.danoeh.antennapod.core.feed; import android.text.TextUtils; +import android.util.Log; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import de.danoeh.antennapod.core.storage.DBReader; @@ -11,17 +13,21 @@ import de.danoeh.antennapod.core.util.LongList; import static de.danoeh.antennapod.core.feed.FeedItem.TAG_FAVORITE; public class FeedItemFilter { + private final String[] mProperties; private boolean showPlayed = false; private boolean showUnplayed = false; private boolean showPaused = false; + private boolean showNotPaused = false; private boolean showQueued = false; private boolean showNotQueued = false; private boolean showDownloaded = false; private boolean showNotDownloaded = false; private boolean showHasMedia = false; + private boolean showNoMedia = false; private boolean showIsFavorite = false; + private boolean showNotFavorite = false; public FeedItemFilter(String properties) { this(TextUtils.split(properties, ",")); @@ -29,15 +35,18 @@ public class FeedItemFilter { public FeedItemFilter(String[] properties) { this.mProperties = properties; - for(String property : properties) { + for (String property : properties) { // see R.arrays.feed_filter_values - switch(property) { + switch (property) { case "unplayed": showUnplayed = true; break; case "paused": showPaused = true; break; + case "not_paused": + showNotPaused = true; + break; case "played": showPlayed = true; break; @@ -56,9 +65,17 @@ public class FeedItemFilter { case "has_media": showHasMedia = true; break; + case "no_media": + showNoMedia = true; + break; case "is_favorite": showIsFavorite = true; break; + case "not_favorite": + showNotFavorite = true; + break; + default: + break; } } } @@ -77,12 +94,15 @@ public class FeedItemFilter { if (showQueued && showNotQueued) return result; if (showDownloaded && showNotDownloaded) return result; - final LongList queuedIds = DBReader.getQueueIDList(); - for(FeedItem item : items) { + final LongList queuedIds = DBReader.getQueueIDList(); + for (FeedItem item : items) { // If the item does not meet a requirement, skip it. + if (showPlayed && !item.isPlayed()) continue; if (showUnplayed && item.isPlayed()) continue; + if (showPaused && item.getState() != FeedItem.State.IN_PROGRESS) continue; + if (showNotPaused && item.getState() == FeedItem.State.IN_PROGRESS) continue; boolean queued = queuedIds.contains(item.getId()); if (showQueued && !queued) continue; @@ -93,8 +113,10 @@ public class FeedItemFilter { if (showNotDownloaded && downloaded) continue; if (showHasMedia && !item.hasMedia()) continue; + if (showNoMedia && item.hasMedia()) continue; if (showIsFavorite && !item.isTagged(TAG_FAVORITE)) continue; + if (showNotFavorite && item.isTagged(TAG_FAVORITE)) continue; // If the item reaches here, it meets all criteria result.add(item); diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilterGroup.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilterGroup.java new file mode 100644 index 000000000..fcbe2e4ab --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilterGroup.java @@ -0,0 +1,36 @@ +package de.danoeh.antennapod.core.feed; + +import de.danoeh.antennapod.core.R; + +public enum FeedItemFilterGroup { + PLAYED(new ItemProperties(R.string.hide_played_episodes_label, "played"), + new ItemProperties(R.string.not_played, "unplayed")), + PAUSED(new ItemProperties(R.string.hide_paused_episodes_label, "paused"), + new ItemProperties(R.string.not_paused, "not_paused")), + FAVORITE(new ItemProperties(R.string.hide_is_favorite_label, "is_favorite"), + new ItemProperties(R.string.not_favorite, "not_favorite")), + MEDIA(new ItemProperties(R.string.has_media, "has_media"), + new ItemProperties(R.string.no_media, "no_media")), + QUEUED(new ItemProperties(R.string.queued_label, "queued"), + new ItemProperties(R.string.not_queued_label, "not_queued")), + DOWNLOADED(new ItemProperties(R.string.hide_downloaded_episodes_label, "downloaded"), + new ItemProperties(R.string.hide_not_downloaded_episodes_label, "not_downloaded")); + + public final ItemProperties[] values; + + FeedItemFilterGroup(ItemProperties... values) { + this.values = values; + } + + public static class ItemProperties { + + public final int displayName; + public final String filterId; + + public ItemProperties(int displayName, String filterId) { + this.displayName = displayName; + this.filterId = filterId; + } + + } +} diff --git a/core/src/main/res/color/filter_dialog_background_dark.xml b/core/src/main/res/color/filter_dialog_background_dark.xml new file mode 100644 index 000000000..3df2a80dc --- /dev/null +++ b/core/src/main/res/color/filter_dialog_background_dark.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@color/accent_dark" android:state_checked="true"/> + <item android:color="@color/dialog_filter_inactive_dark" /> +</selector>
\ No newline at end of file diff --git a/core/src/main/res/color/filter_dialog_background_light.xml b/core/src/main/res/color/filter_dialog_background_light.xml new file mode 100644 index 000000000..930325629 --- /dev/null +++ b/core/src/main/res/color/filter_dialog_background_light.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@color/accent_light" android:state_checked="true" /> + <item android:color="@color/dialog_filter_inactive_light" /> +</selector>
\ No newline at end of file diff --git a/core/src/main/res/color/filter_dialog_button_text.xml b/core/src/main/res/color/filter_dialog_button_text.xml new file mode 100644 index 000000000..fea8b3e74 --- /dev/null +++ b/core/src/main/res/color/filter_dialog_button_text.xml @@ -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/colorOnSecondary" android:state_checked="true" /> + <item android:color="?android:textColorPrimary" /> +</selector>
\ No newline at end of file diff --git a/core/src/main/res/color/filter_dialog_clear_dark.xml b/core/src/main/res/color/filter_dialog_clear_dark.xml new file mode 100644 index 000000000..88e022d0f --- /dev/null +++ b/core/src/main/res/color/filter_dialog_clear_dark.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@color/dialog_filter_inactive_dark" android:state_checked="true" /> + <item android:color="@color/dialog_filter_clear_inactive_dark" /> +</selector>
\ No newline at end of file diff --git a/core/src/main/res/color/filter_dialog_clear_light.xml b/core/src/main/res/color/filter_dialog_clear_light.xml new file mode 100644 index 000000000..9d513f72a --- /dev/null +++ b/core/src/main/res/color/filter_dialog_clear_light.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@color/dialog_filter_inactive_light" android:state_checked="true" /> + <item android:color="@color/dialog_filter_clear_inactive_light" /> +</selector>
\ 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 new file mode 100644 index 000000000..9e0a26905 --- /dev/null +++ b/core/src/main/res/drawable/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/values/arrays.xml b/core/src/main/res/values/arrays.xml index dc79905cd..13ff092b0 100644 --- a/core/src/main/res/values/arrays.xml +++ b/core/src/main/res/values/arrays.xml @@ -245,30 +245,6 @@ <item>exoplayer</item> </string-array> - <string-array name="episode_filter_options"> - <item>@string/hide_unplayed_episodes_label</item> - <item>@string/hide_paused_episodes_label</item> - <item>@string/hide_played_episodes_label</item> - <item>@string/hide_queued_episodes_label</item> - <item>@string/hide_not_queued_episodes_label</item> - <item>@string/hide_downloaded_episodes_label</item> - <item>@string/hide_not_downloaded_episodes_label</item> - <item>@string/hide_has_media_label</item> - <item>@string/hide_is_favorite_label</item> - </string-array> - - <string-array name="episode_filter_values"> - <item>unplayed</item> - <item>paused</item> - <item>played</item> - <item>queued</item> - <item>not_queued</item> - <item>downloaded</item> - <item>not_downloaded</item> - <item>has_media</item> - <item>is_favorite</item> - </string-array> - <!-- sort for podcast screen, not for queue --> <string-array name="feed_episodes_sort_options"> <item>@string/sort_date_new_old</item> diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index b89a819f1..4a18f6ae6 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -58,6 +58,8 @@ <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_button_background" format="reference"/> <declare-styleable name="SquareImageView"> <attr name="direction" format="enum"> diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index a86d61eba..a55378931 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -28,4 +28,9 @@ <color name="master_switch_background_light">#DDDDDD</color> <color name="master_switch_background_dark">#191919</color> + <!-- filter dialog --> + <color name="dialog_filter_clear_inactive_light">#666666</color> + <color name="dialog_filter_clear_inactive_dark">#bbbbbb</color> + <color name="dialog_filter_inactive_light">#eeeeee</color> + <color name="dialog_filter_inactive_dark">#555555</color> </resources> diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index fd1bb9aa9..b5b327a90 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -152,14 +152,9 @@ <string name="select_all_above">Select all above</string> <string name="select_all_below">Select all below</string> <string name="hide_unplayed_episodes_label">Unplayed</string> - <string name="hide_paused_episodes_label">Paused</string> - <string name="hide_played_episodes_label">Played</string> <string name="hide_queued_episodes_label">Queued</string> <string name="hide_not_queued_episodes_label">Not queued</string> - <string name="hide_downloaded_episodes_label">Downloaded</string> - <string name="hide_not_downloaded_episodes_label">Not downloaded</string> <string name="hide_has_media_label">Has media</string> - <string name="hide_is_favorite_label">Is favorite</string> <string name="filtered_label">Filtered</string> <string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed</string> <string name="open_podcast">Open Podcast</string> @@ -737,13 +732,23 @@ <string name="selected_downloaded_label">Selected downloaded Episodes</string> <string name="not_downloaded_label">Not downloaded</string> <string name="selected_not_downloaded_label">Selected not downloaded Episodes</string> - <string name="queued_label">Queued</string> <string name="selected_queued_label">Selected queued Episodes</string> - <string name="not_queued_label">Not queued</string> <string name="selected_not_queued_label">Selected not queued Episodes</string> - <string name="has_media">Has media</string> <string name="selected_has_media_label">Selected episodes with media</string> + <string name="hide_is_favorite_label">Is favorite</string> + <string name="not_favorite">Not favorite</string> + <string name="hide_downloaded_episodes_label">Downloaded</string> + <string name="hide_not_downloaded_episodes_label">Not downloaded</string> + <string name="queued_label">Queued</string> + <string name="not_queued_label">Not queued</string> + <string name="has_media">Has media</string> + <string name="no_media">No media</string> + <string name="hide_paused_episodes_label">Paused</string> + <string name="not_paused">Not paused</string> + <string name="hide_played_episodes_label">Played</string> + <string name="not_played">Not played</string> + <!-- Sort --> <string name="sort_title_a_z">Title (A \u2192 Z)</string> <string name="sort_title_z_a">Title (Z \u2192 A)</string> diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index ab78eac47..972174da5 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"> +<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light"> <!-- Room for API dependent attributes --> @@ -73,6 +73,8 @@ <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_clear">@color/filter_dialog_clear_light</item> + <item name="filter_dialog_button_background">@color/filter_dialog_background_light</item> </style> <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> @@ -148,6 +150,8 @@ <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_clear">@color/filter_dialog_clear_dark</item> + <item name="filter_dialog_button_background">@color/filter_dialog_background_dark</item> </style> <style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack"> |