From fce836130ece465927bdd7deeef4ce2c7881a598 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 3 Jun 2013 21:26:54 -0700 Subject: Add refresh to genres for when doing manual refresh --- .../src/github/daneren2005/dsub/fragments/SelectGenreFragment.java | 6 +++--- .../src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 2 +- .../src/github/daneren2005/dsub/service/CachedMusicService.java | 6 +++--- .../src/github/daneren2005/dsub/service/MusicService.java | 2 +- .../src/github/daneren2005/dsub/service/OfflineMusicService.java | 2 +- .../src/github/daneren2005/dsub/service/RESTMusicService.java | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'subsonic-android/src/github') diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java index f4b0f213..7ac7ace8 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java @@ -89,10 +89,10 @@ public class SelectGenreFragment extends SubsonicFragment implements AdapterView @Override protected void refresh(boolean refresh) { - load(); + load(refresh); } - private void load() { + private void load(final boolean refresh) { setTitle(R.string.main_albums_genres); BackgroundTask> task = new TabBackgroundTask>(this) { @@ -103,7 +103,7 @@ public class SelectGenreFragment extends SubsonicFragment implements AdapterView List genres = new ArrayList(); try { - genres = musicService.getGenres(context, this); + genres = musicService.getGenres(refresh, context, this); } catch (Exception x) { Log.e(TAG, "Failed to load genres", x); } diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 05b78eab..2fcdc00f 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -400,7 +400,7 @@ public class SubsonicFragment extends SherlockFragment { @Override protected List doInBackground() throws Throwable { MusicService musicService = MusicServiceFactory.getMusicService(context); - return musicService.getGenres(context, this); + return musicService.getGenres(false, context, this); } @Override diff --git a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java index 71bbb867..314f065e 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -279,12 +279,12 @@ public class CachedMusicService implements MusicService { } @Override - public List getGenres(Context context, ProgressListener progressListener) throws Exception { + public List getGenres(boolean refresh, Context context, ProgressListener progressListener) throws Exception { checkSettingsChanged(context); - List result = cachedGenres.get(); + List result = refresh ? null : cachedGenres.get(); if (result == null) { - result = musicService.getGenres(context, progressListener); + result = musicService.getGenres(refresh, context, progressListener); cachedGenres.set(result); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java index 31e9c23c..f69ebfb1 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java @@ -112,7 +112,7 @@ public interface MusicService { void addChatMessage(String message, Context context, ProgressListener progressListener) throws Exception; - List getGenres(Context context, ProgressListener progressListener) throws Exception; + List getGenres(boolean refresh, Context context, ProgressListener progressListener) throws Exception; public MusicDirectory getSongsByGenre(String genre, int count, int offset, Context context, ProgressListener progressListener) throws Exception; } \ No newline at end of file diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java index 97fed19f..9af58b16 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java @@ -483,7 +483,7 @@ public class OfflineMusicService extends RESTMusicService { } @Override - public List getGenres(Context context, ProgressListener progressListener) throws Exception { + public List getGenres(boolean refresh, Context context, ProgressListener progressListener) throws Exception { throw new OfflineException("Getting Genres not available in offline mode"); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index 5fc66190..f4f64046 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -790,7 +790,7 @@ public class RESTMusicService implements MusicService { } @Override - public List getGenres(Context context, ProgressListener progressListener) throws Exception { + public List getGenres(boolean refresh, Context context, ProgressListener progressListener) throws Exception { checkServerVersion(context, "1.9", "Genres not supported."); Reader reader = getReader(context, progressListener, "getGenres", null); -- cgit v1.2.3