mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-06-09 03:52:12 +03:00
Merge pull request #306 from nitehu/fix/genre_refresh
Fixed missing Genre Refresh functionality
This commit is contained in:
commit
59c0054a11
@ -111,13 +111,14 @@ public class SelectGenreActivity extends SubsonicTabActivity implements AdapterV
|
|||||||
@Override
|
@Override
|
||||||
protected List<Genre> doInBackground() throws Throwable
|
protected List<Genre> doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
|
boolean refresh = getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_REFRESH, false);
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService(SelectGenreActivity.this);
|
MusicService musicService = MusicServiceFactory.getMusicService(SelectGenreActivity.this);
|
||||||
|
|
||||||
List<Genre> genres = new ArrayList<Genre>();
|
List<Genre> genres = new ArrayList<Genre>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
genres = musicService.getGenres(SelectGenreActivity.this, this);
|
genres = musicService.getGenres(refresh, SelectGenreActivity.this, this);
|
||||||
}
|
}
|
||||||
catch (Exception x)
|
catch (Exception x)
|
||||||
{
|
{
|
||||||
|
@ -405,14 +405,18 @@ public class CachedMusicService implements MusicService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Genre> getGenres(Context context, ProgressListener progressListener) throws Exception
|
public List<Genre> getGenres(boolean refresh, Context context, ProgressListener progressListener) throws Exception
|
||||||
{
|
{
|
||||||
checkSettingsChanged(context);
|
checkSettingsChanged(context);
|
||||||
|
if (refresh)
|
||||||
|
{
|
||||||
|
cachedGenres.clear();
|
||||||
|
}
|
||||||
List<Genre> result = cachedGenres.get();
|
List<Genre> result = cachedGenres.get();
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
result = musicService.getGenres(context, progressListener);
|
result = musicService.getGenres(refresh, context, progressListener);
|
||||||
cachedGenres.set(result);
|
cachedGenres.set(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public interface MusicService
|
|||||||
|
|
||||||
boolean isLicenseValid(Context context, ProgressListener progressListener) throws Exception;
|
boolean isLicenseValid(Context context, ProgressListener progressListener) throws Exception;
|
||||||
|
|
||||||
List<Genre> getGenres(Context context, ProgressListener progressListener) throws Exception;
|
List<Genre> getGenres(boolean refresh, Context context, ProgressListener progressListener) throws Exception;
|
||||||
|
|
||||||
void star(String id, String albumId, String artistId, Context context, ProgressListener progressListener) throws Exception;
|
void star(String id, String albumId, String artistId, Context context, ProgressListener progressListener) throws Exception;
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ public class OfflineMusicService extends RESTMusicService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Genre> getGenres(Context context, ProgressListener progressListener) throws Exception
|
public List<Genre> getGenres(boolean refresh, Context context, ProgressListener progressListener) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Getting Genres not available in offline mode");
|
throw new OfflineException("Getting Genres not available in offline mode");
|
||||||
}
|
}
|
||||||
|
@ -829,7 +829,7 @@ public class RESTMusicService implements MusicService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Genre> getGenres(Context context,
|
public List<Genre> getGenres(boolean refresh, Context context,
|
||||||
ProgressListener progressListener) throws Exception {
|
ProgressListener progressListener) throws Exception {
|
||||||
updateProgressListener(progressListener, R.string.parser_reading);
|
updateProgressListener(progressListener, R.string.parser_reading);
|
||||||
Response<GenresResponse> response = subsonicAPIClient.getApi().getGenres().execute();
|
Response<GenresResponse> response = subsonicAPIClient.getApi().getGenres().execute();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user