Made the due distinction based on the server on the most listened to songs of the week

This commit is contained in:
antonio 2023-01-06 18:30:07 +01:00
parent 5eed437c5b
commit 1204716a65
6 changed files with 29 additions and 14 deletions

View file

@ -80,12 +80,13 @@ public class HomeViewModel extends AndroidViewModel {
public LiveData<List<Chronology>> getGridSongSample(LifecycleOwner owner) {
Calendar cal = Calendar.getInstance();
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
String server = PreferenceUtil.getInstance(App.getInstance()).getServerId();
if (thisGridTopSong.getValue() == null) {
if (dayOfMonth >= 7) {
chronologyRepository.getThisWeek().observe(owner, thisGridTopSong::postValue);
chronologyRepository.getThisWeek(server).observe(owner, thisGridTopSong::postValue);
} else {
chronologyRepository.getLastWeek().observe(owner, thisGridTopSong::postValue);
chronologyRepository.getLastWeek(server).observe(owner, thisGridTopSong::postValue);
}
}