aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-05-29 17:36:41 -0700
committerScott Jackson <daneren2005@gmail.com>2015-05-29 17:36:41 -0700
commit1697ead7480395a4850e2cfc06d2af2d58910d5a (patch)
treeff297bb5c089830afec560fac312dd7977d46b3d /app/src
parentcea1002a9dd95191ea7b4f11f6a9834b7243a4ec (diff)
downloaddsub-1697ead7480395a4850e2cfc06d2af2d58910d5a.tar.gz
dsub-1697ead7480395a4850e2cfc06d2af2d58910d5a.tar.bz2
dsub-1697ead7480395a4850e2cfc06d2af2d58910d5a.zip
Put back scroll to item on search and remove long click action
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java7
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java25
2 files changed, 19 insertions, 13 deletions
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 293012a2..8d9a8682 100644
--- a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
+++ b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java
@@ -105,7 +105,7 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH
}
});
- updateView.getChildAt(0).setOnLongClickListener(new View.OnLongClickListener() {
+ /*updateView.getChildAt(0).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
T item = holder.getItem();
@@ -113,7 +113,7 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH
v.showContextMenu();
return false;
}
- });
+ });*/
}
}
@@ -240,6 +240,9 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH
this.onItemClickedListener = onItemClickedListener;
}
+ public void addSelected(T item) {
+ selected.add(item);
+ }
public List<T> getSelected() {
List<T> selected = new ArrayList<>();
selected.addAll(this.selected);
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 5dc50757..417b1328 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -77,7 +77,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
private Boolean licenseValid;
private List<Entry> albums;
private List<Entry> entries;
- private boolean addAlbumHeader = false;
private LoadTask currentTask;
private ArtistInfo artistInfo;
private String artistInfoDelayed;
@@ -198,9 +197,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
recyclerView.setLayoutManager(layoutManager);
}
- if(albumListType == null || "starred".equals(albumListType)) {
- addAlbumHeader = true;
- }
registerForContextMenu(recyclerView);
if(entries == null) {
@@ -763,6 +759,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
// Show header if not album list type and not root and not artist
// For Subsonic 5.1+ display a header for artists with getArtistInfo data if it exists
+ boolean addedHeader = false;
if(albumListType == null && !"root".equals(id) && (!artist || artistInfo != null || artistInfoDelayed != null)) {
View header = createHeader();
@@ -796,22 +793,28 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
}
entryGridAdapter.setHeader(header);
+ addedHeader = true;
}
}
- recyclerView.setAdapter(entryGridAdapter);
- context.supportInvalidateOptionsMenu();
-
- /*if(lookupEntry != null) {
+ int scrollToPosition = -1;
+ if(lookupEntry != null) {
for(int i = 0; i < entries.size(); i++) {
if(lookupEntry.equals(entries.get(i).getTitle())) {
- recyclerView.scrollToPosition();
- entryList.setSelection(i + entryList.getHeaderViewsCount());
+ scrollToPosition = i;
+ entryGridAdapter.addSelected(entries.get(i));
lookupEntry = null;
break;
}
}
- }*/
+ }
+
+ recyclerView.setAdapter(entryGridAdapter);
+ context.supportInvalidateOptionsMenu();
+
+ if(scrollToPosition != -1) {
+ recyclerView.scrollToPosition(scrollToPosition + (addedHeader ? 1 : 0));
+ }
Bundle args = getArguments();
boolean playAll = args.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false);