From 3ae589147df3f36c56bdb74db003651f946ca304 Mon Sep 17 00:00:00 2001 From: owner Date: Thu, 20 Dec 2012 20:57:13 -0800 Subject: Closes #78 Fix for letter not showing in Artist list --- .../daneren2005/dsub/view/ArtistAdapter.java | 44 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/subsonic-android/src/github/daneren2005/dsub/view/ArtistAdapter.java b/subsonic-android/src/github/daneren2005/dsub/view/ArtistAdapter.java index 12956a14..0edb03c5 100644 --- a/subsonic-android/src/github/daneren2005/dsub/view/ArtistAdapter.java +++ b/subsonic-android/src/github/daneren2005/dsub/view/ArtistAdapter.java @@ -23,19 +23,40 @@ import java.util.List; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.SectionIndexer; import github.daneren2005.dsub.activity.SubsonicTabActivity; import github.daneren2005.dsub.domain.Artist; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.Set; /** * @author Sindre Mehus */ -public class ArtistAdapter extends ArrayAdapter { +public class ArtistAdapter extends ArrayAdapter implements SectionIndexer { private final SubsonicTabActivity activity; + + // Both arrays are indexed by section ID. + private final Object[] sections; + private final Integer[] positions; public ArtistAdapter(SubsonicTabActivity activity, List artists) { super(activity, R.layout.artist_list_item, artists); this.activity = activity; + + Set sectionSet = new LinkedHashSet(30); + List positionList = new ArrayList(30); + for (int i = 0; i < artists.size(); i++) { + Artist artist = artists.get(i); + String index = artist.getIndex(); + if (!sectionSet.contains(index)) { + sectionSet.add(index); + positionList.add(i); + } + } + sections = sectionSet.toArray(new Object[sectionSet.size()]); + positions = positionList.toArray(new Integer[positionList.size()]); } @Override @@ -50,4 +71,25 @@ public class ArtistAdapter extends ArrayAdapter { view.setArtist(entry); return view; } + + @Override + public Object[] getSections() { + return sections; + } + + @Override + public int getPositionForSection(int section) { + section = Math.min(section, positions.length - 1); + return positions[section]; + } + + @Override + public int getSectionForPosition(int pos) { + for (int i = 0; i < sections.length - 1; i++) { + if (pos < positions[i + 1]) { + return i; + } + } + return sections.length - 1; + } } -- cgit v1.2.3 From d8ea03d9226221c1effd39c4ebeb95c8562af605 Mon Sep 17 00:00:00 2001 From: owner Date: Thu, 20 Dec 2012 20:59:05 -0800 Subject: Increased default max size to 2GB --- subsonic-android/res/xml/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsonic-android/res/xml/settings.xml b/subsonic-android/res/xml/settings.xml index 07d7a64f..ebb19e03 100644 --- a/subsonic-android/res/xml/settings.xml +++ b/subsonic-android/res/xml/settings.xml @@ -170,7 +170,7 @@ Date: Thu, 20 Dec 2012 21:15:53 -0800 Subject: Closes #80 Fix play now not clearing playlist --- .../src/github/daneren2005/dsub/activity/SelectAlbumActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java index 9ca1744f..aa8c85e1 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java @@ -284,6 +284,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity { toggleStarred(entry); break; case R.id.song_menu_play_now: + getDownloadService().clear(); getDownloadService().download(songs, false, true, true, false); break; case R.id.song_menu_play_next: -- cgit v1.2.3 From 5f7df3f6300c0d0f0d7573c5614f7b84e081754a Mon Sep 17 00:00:00 2001 From: owner Date: Thu, 20 Dec 2012 21:19:50 -0800 Subject: Move to download activity on context menu play now + don't for play last --- .../src/github/daneren2005/dsub/activity/SelectAlbumActivity.java | 1 + .../src/github/daneren2005/dsub/activity/SubsonicTabActivity.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java index aa8c85e1..0cf380dd 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java @@ -286,6 +286,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity { case R.id.song_menu_play_now: getDownloadService().clear(); getDownloadService().download(songs, false, true, true, false); + Util.startActivityWithoutTransition(SelectAlbumActivity.this, DownloadActivity.class); break; case R.id.song_menu_play_next: getDownloadService().download(songs, false, false, true, false); diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java index 19e01045..705c460d 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java @@ -361,7 +361,9 @@ public class SubsonicTabActivity extends SherlockActivity { warnIfNetworkOrStorageUnavailable(); if(!background) { downloadService.download(songs, save, autoplay, false, shuffle); - Util.startActivityWithoutTransition(SubsonicTabActivity.this, DownloadActivity.class); + if(!append) { + Util.startActivityWithoutTransition(SubsonicTabActivity.this, DownloadActivity.class); + } } else { downloadService.downloadBackground(songs, save); -- cgit v1.2.3