mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Made the due distinction based on the server on the most listened to songs of the week
This commit is contained in:
parent
5eed437c5b
commit
1204716a65
6 changed files with 29 additions and 14 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue