diff --git a/app/src/main/java/com/cappielloantonio/play/repository/AlbumRepository.java b/app/src/main/java/com/cappielloantonio/play/repository/AlbumRepository.java index 4cc4fb8a..92a5dbd9 100644 --- a/app/src/main/java/com/cappielloantonio/play/repository/AlbumRepository.java +++ b/app/src/main/java/com/cappielloantonio/play/repository/AlbumRepository.java @@ -265,23 +265,21 @@ public class AlbumRepository { public MutableLiveData> getDecades() { MutableLiveData> decades = new MutableLiveData<>(); - getFirstAlbum(first -> { - getLastAlbum(last -> { - if(first != -1 && last != -1) { - List decadeList = new ArrayList(); + getFirstAlbum(first -> getLastAlbum(last -> { + if(first != -1 && last != -1) { + List decadeList = new ArrayList(); - int startDecade = first - (first % 10); - int lastDecade = last - (last % 10); + int startDecade = first - (first % 10); + int lastDecade = last - (last % 10); - while (startDecade <= lastDecade) { - decadeList.add(startDecade); - startDecade = startDecade + 10; - } - - decades.setValue(decadeList); + while (startDecade <= lastDecade) { + decadeList.add(startDecade); + startDecade = startDecade + 10; } - }); - }); + + decades.setValue(decadeList); + } + })); return decades; }