From 60176f016fc8814ea2f57f6bacc14c8e1cc31c76 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 29 Oct 2015 17:17:04 -0700 Subject: Make recent podcasts multi-selectable --- .../dsub/adapter/PodcastChannelAdapter.java | 18 ++++++++++++++++++ .../daneren2005/dsub/adapter/SectionAdapter.java | 10 ++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/PodcastChannelAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/PodcastChannelAdapter.java index 6d995d56..875a4800 100644 --- a/app/src/main/java/github/daneren2005/dsub/adapter/PodcastChannelAdapter.java +++ b/app/src/main/java/github/daneren2005/dsub/adapter/PodcastChannelAdapter.java @@ -15,12 +15,17 @@ package github.daneren2005.dsub.adapter; import android.content.Context; +import android.view.Menu; +import android.view.MenuInflater; import android.view.ViewGroup; +import github.daneren2005.dsub.R; import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.PodcastChannel; import github.daneren2005.dsub.domain.PodcastEpisode; import github.daneren2005.dsub.util.ImageLoader; +import github.daneren2005.dsub.util.Util; +import github.daneren2005.dsub.view.BasicHeaderView; import github.daneren2005.dsub.view.FastScroller; import github.daneren2005.dsub.view.PodcastChannelView; import github.daneren2005.dsub.view.SongView; @@ -49,6 +54,7 @@ public class PodcastChannelAdapter extends SectionAdapter implemen this.imageLoader = imageLoader; this.onItemClickedListener = listener; this.largeCell = largeCell; + checkable = true; } @Override @@ -100,4 +106,16 @@ public class PodcastChannelAdapter extends SectionAdapter implemen return null; } } + + @Override + public void onCreateActionModeMenu(Menu menu, MenuInflater menuInflater) { + if(Util.isOffline(context)) { + menuInflater.inflate(R.menu.multiselect_media_offline, menu); + } else { + menuInflater.inflate(R.menu.multiselect_media, menu); + } + + menu.removeItem(R.id.menu_remove_playlist); + menu.removeItem(R.id.menu_unstar); + } } diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java index c2f3c804..95bef065 100644 --- a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java +++ b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java @@ -159,10 +159,12 @@ public abstract class SectionAdapter extends RecyclerView.Adapter