mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Code refactor
This commit is contained in:
parent
c37002c87b
commit
9bed2275ef
1 changed files with 12 additions and 14 deletions
|
|
@ -265,23 +265,21 @@ public class AlbumRepository {
|
||||||
public MutableLiveData<List<Integer>> getDecades() {
|
public MutableLiveData<List<Integer>> getDecades() {
|
||||||
MutableLiveData<List<Integer>> decades = new MutableLiveData<>();
|
MutableLiveData<List<Integer>> decades = new MutableLiveData<>();
|
||||||
|
|
||||||
getFirstAlbum(first -> {
|
getFirstAlbum(first -> getLastAlbum(last -> {
|
||||||
getLastAlbum(last -> {
|
if(first != -1 && last != -1) {
|
||||||
if(first != -1 && last != -1) {
|
List<Integer> decadeList = new ArrayList();
|
||||||
List<Integer> decadeList = new ArrayList();
|
|
||||||
|
|
||||||
int startDecade = first - (first % 10);
|
int startDecade = first - (first % 10);
|
||||||
int lastDecade = last - (last % 10);
|
int lastDecade = last - (last % 10);
|
||||||
|
|
||||||
while (startDecade <= lastDecade) {
|
while (startDecade <= lastDecade) {
|
||||||
decadeList.add(startDecade);
|
decadeList.add(startDecade);
|
||||||
startDecade = startDecade + 10;
|
startDecade = startDecade + 10;
|
||||||
}
|
|
||||||
|
|
||||||
decades.setValue(decadeList);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
decades.setValue(decadeList);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
return decades;
|
return decades;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue