diff options
3 files changed, 19 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java index 36e02929a..475a6a109 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -15,7 +15,8 @@ import de.danoeh.antennapod.model.feed.FeedItemFilter; import org.apache.commons.lang3.StringUtils; import org.greenrobot.eventbus.Subscribe; -import java.util.Collections; +import java.util.ArrayList; +import java.util.HashSet; /** * Shows all episodes (possibly filtered by user). @@ -33,9 +34,8 @@ public class AllEpisodesFragment extends EpisodesListFragment { toolbar.setTitle(R.string.episodes_label); updateToolbar(); updateFilterUi(); - speedDialView.removeActionItemById(R.id.mark_unread_batch); - speedDialView.removeActionItemById(R.id.remove_from_queue_batch); - speedDialView.removeActionItemById(R.id.delete_batch); + txtvInformation.setOnClickListener( + v -> AllEpisodesFilterDialog.newInstance(getFilter()).show(getChildFragmentManager(), null)); return root; } @@ -64,8 +64,13 @@ public class AllEpisodesFragment extends EpisodesListFragment { AllEpisodesFilterDialog.newInstance(getFilter()).show(getChildFragmentManager(), null); return true; } else if (item.getItemId() == R.id.action_favorites) { - onFilterChanged(new AllEpisodesFilterDialog.AllEpisodesFilterChangedEvent(getFilter().showIsFavorite - ? Collections.emptySet() : Collections.singleton(FeedItemFilter.IS_FAVORITE))); + ArrayList<String> filter = new ArrayList<>(getFilter().getValuesList()); + if (filter.contains(FeedItemFilter.IS_FAVORITE)) { + filter.remove(FeedItemFilter.IS_FAVORITE); + } else { + filter.add(FeedItemFilter.IS_FAVORITE); + } + onFilterChanged(new AllEpisodesFilterDialog.AllEpisodesFilterChangedEvent(new HashSet<>(filter))); return true; } return false; @@ -91,5 +96,7 @@ public class AllEpisodesFragment extends EpisodesListFragment { txtvInformation.setVisibility(View.GONE); emptyView.setMessage(R.string.no_all_episodes_label); } + toolbar.getMenu().findItem(R.id.action_favorites).setIcon( + getFilter().showIsFavorite ? R.drawable.ic_star : R.drawable.ic_star_border); } } diff --git a/app/src/main/res/layout/episodes_list_fragment.xml b/app/src/main/res/layout/episodes_list_fragment.xml index 39a0c260a..0a6c1da5f 100644 --- a/app/src/main/res/layout/episodes_list_fragment.xml +++ b/app/src/main/res/layout/episodes_list_fragment.xml @@ -18,6 +18,7 @@ android:id="@+id/txtvInformation" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" android:gravity="center" android:layout_below="@id/toolbar" android:paddingTop="2dp" diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java index 460177d56..e0c940c56 100644 --- a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java +++ b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItemFilter.java @@ -4,6 +4,7 @@ import android.text.TextUtils; import java.io.Serializable; import java.util.Arrays; +import java.util.List; public class FeedItemFilter implements Serializable { @@ -72,6 +73,10 @@ public class FeedItemFilter implements Serializable { return properties.clone(); } + public List<String> getValuesList() { + return Arrays.asList(properties); + } + public boolean matches(FeedItem item) { if (showNew && !item.isNew()) { return false; |