aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/adapter/SearchAdapter.java17
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java15
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java5
3 files changed, 35 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/SearchAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/SearchAdapter.java
index c1185702..66f2db21 100644
--- a/app/src/main/java/github/daneren2005/dsub/adapter/SearchAdapter.java
+++ b/app/src/main/java/github/daneren2005/dsub/adapter/SearchAdapter.java
@@ -17,6 +17,8 @@ package github.daneren2005.dsub.adapter;
import android.content.Context;
import android.content.res.Resources;
+import android.view.Menu;
+import android.view.MenuInflater;
import android.view.ViewGroup;
import java.io.Serializable;
@@ -27,6 +29,7 @@ import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.MusicDirectory.Entry;
import github.daneren2005.dsub.domain.SearchResult;
import github.daneren2005.dsub.util.ImageLoader;
+import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.view.AlbumView;
import github.daneren2005.dsub.view.ArtistView;
import github.daneren2005.dsub.view.SongView;
@@ -64,6 +67,7 @@ public class SearchAdapter extends SectionAdapter<Serializable> {
this.headers.add(res.getString(R.string.search_songs));
}
this.onItemClickedListener = listener;
+ checkable = true;
}
@Override
@@ -88,7 +92,7 @@ public class SearchAdapter extends SectionAdapter<Serializable> {
albumView.setObject((Entry) item, imageLoader);
} else if(viewType == VIEW_TYPE_SONG) {
SongView songView = (SongView) view;
- songView.setObject((Entry) item, false);
+ songView.setObject((Entry) item, true);
} else if(viewType == VIEW_TYPE_ARTIST) {
view.setObject(item);
}
@@ -111,4 +115,15 @@ public class SearchAdapter extends SectionAdapter<Serializable> {
return VIEW_TYPE_ARTIST;
}
}
+
+ @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);
+ }
}
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java
index 96b32d8d..f442dabb 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SearchFragment.java
@@ -1,7 +1,9 @@
package github.daneren2005.dsub.fragments;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import android.content.Intent;
import android.os.Bundle;
@@ -158,6 +160,19 @@ public class SearchFragment extends SubsonicFragment implements SectionAdapter.O
}
}
+ @Override
+ protected List<MusicDirectory.Entry> getSelectedEntries() {
+ List<Serializable> selected = adapter.getSelected();
+ List<MusicDirectory.Entry> selectedMedia = new ArrayList<>();
+ for(Serializable ser: selected) {
+ if(ser instanceof MusicDirectory.Entry) {
+ selectedMedia.add((MusicDirectory.Entry) ser);
+ }
+ }
+
+ return selectedMedia;
+ }
+
public void search(final String query, final boolean autoplay) {
if(skipSearch) {
skipSearch = false;
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java
index f91048b9..9dc3e363 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectRecyclerFragment.java
@@ -35,7 +35,6 @@ import github.daneren2005.dsub.R;
import github.daneren2005.dsub.adapter.SectionAdapter;
import github.daneren2005.dsub.service.MusicService;
import github.daneren2005.dsub.service.MusicServiceFactory;
-import github.daneren2005.dsub.util.BackgroundTask;
import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.ProgressListener;
import github.daneren2005.dsub.util.TabBackgroundTask;
@@ -141,6 +140,10 @@ public abstract class SelectRecyclerFragment<T> extends SubsonicFragment impleme
}
}
+ protected SectionAdapter getCurrentAdapter() {
+ return adapter;
+ }
+
private void setupLayoutManager() {
setupLayoutManager(recyclerView, largeAlbums);
}