mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
fix: fixed a bug in the paginated song lists
This commit is contained in:
parent
d4caa6f209
commit
bad0fa6c23
1 changed files with 5 additions and 1 deletions
|
|
@ -71,7 +71,11 @@ public class SongListPageViewModel extends AndroidViewModel {
|
||||||
public void getSongsByPage(LifecycleOwner owner) {
|
public void getSongsByPage(LifecycleOwner owner) {
|
||||||
switch (title) {
|
switch (title) {
|
||||||
case Constants.MEDIA_BY_GENRE:
|
case Constants.MEDIA_BY_GENRE:
|
||||||
int page = (songList.getValue() != null ? songList.getValue().size() : 0) / 100;
|
int songCount = songList.getValue() != null ? songList.getValue().size() : 0;
|
||||||
|
|
||||||
|
if (songCount > 0 && songCount % 100 != 0) return;
|
||||||
|
|
||||||
|
int page = songCount / 100;
|
||||||
songRepository.getSongsByGenre(genre.getGenre(), page).observe(owner, children -> {
|
songRepository.getSongsByGenre(genre.getGenre(), page).observe(owner, children -> {
|
||||||
if (children != null && !children.isEmpty()) {
|
if (children != null && !children.isEmpty()) {
|
||||||
List<Child> currentMedia = songList.getValue();
|
List<Child> currentMedia = songList.getValue();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue