Merge pull request #306 from nitehu/fix/genre_refresh

Fixed missing Genre Refresh functionality
This commit is contained in:
Nite 2020-09-24 15:30:42 +02:00 committed by GitHub
commit 59c0054a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 6 deletions

View File

@ -111,13 +111,14 @@ public class SelectGenreActivity extends SubsonicTabActivity implements AdapterV
@Override
protected List<Genre> doInBackground() throws Throwable
{
boolean refresh = getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_REFRESH, false);
MusicService musicService = MusicServiceFactory.getMusicService(SelectGenreActivity.this);
List<Genre> genres = new ArrayList<Genre>();
try
{
genres = musicService.getGenres(SelectGenreActivity.this, this);
genres = musicService.getGenres(refresh, SelectGenreActivity.this, this);
}
catch (Exception x)
{

View File

@ -405,14 +405,18 @@ public class CachedMusicService implements MusicService
}
@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);
if (refresh)
{
cachedGenres.clear();
}
List<Genre> result = cachedGenres.get();
if (result == null)
{
result = musicService.getGenres(context, progressListener);
result = musicService.getGenres(refresh, context, progressListener);
cachedGenres.set(result);
}

View File

@ -53,7 +53,7 @@ public interface MusicService
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;

View File

@ -770,7 +770,7 @@ public class OfflineMusicService extends RESTMusicService
}
@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");
}

View File

@ -829,7 +829,7 @@ public class RESTMusicService implements MusicService {
}
@Override
public List<Genre> getGenres(Context context,
public List<Genre> getGenres(boolean refresh, Context context,
ProgressListener progressListener) throws Exception {
updateProgressListener(progressListener, R.string.parser_reading);
Response<GenresResponse> response = subsonicAPIClient.getApi().getGenres().execute();