mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 02:13:33 +00:00
Optimized imports
This commit is contained in:
parent
8d517ae3e0
commit
0827fc10a9
80 changed files with 130 additions and 269 deletions
|
|
@ -8,7 +8,6 @@ import androidx.lifecycle.MutableLiveData;
|
|||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.interfaces.MediaCallback;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.subsonic.models.ResponseStatus;
|
||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ public class ArtistRepository {
|
|||
if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<Album> albums = new ArrayList<>(MappingUtil.mapAlbum(response.body().getArtist().getAlbums()));
|
||||
|
||||
if(albums.size() > 0) {
|
||||
if (albums.size() > 0) {
|
||||
AlbumRepository albumRepository = new AlbumRepository(App.getInstance());
|
||||
|
||||
for (int index = 0; index < albums.size(); index++) {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ import androidx.lifecycle.MutableLiveData;
|
|||
|
||||
import com.cappielloantonio.play.database.AppDatabase;
|
||||
import com.cappielloantonio.play.database.dao.DownloadDao;
|
||||
import com.cappielloantonio.play.database.dao.QueueDao;
|
||||
import com.cappielloantonio.play.model.Download;
|
||||
import com.cappielloantonio.play.model.Queue;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.util.MappingUtil;
|
||||
import com.cappielloantonio.play.util.QueueUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
|||
|
|
@ -39,14 +39,13 @@ public class GenreRepository {
|
|||
if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<Genre> genreList = new ArrayList<>(MappingUtil.mapGenre(response.body().getGenres().getGenres()));
|
||||
|
||||
if(random) {
|
||||
if (random) {
|
||||
Collections.shuffle(genreList);
|
||||
}
|
||||
|
||||
if(size != -1) {
|
||||
if (size != -1) {
|
||||
genres.setValue(genreList.subList(0, Math.min(size, genreList.size())));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
genres.setValue(genreList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import android.app.Application;
|
|||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.subsonic.models.ResponseStatus;
|
||||
|
|
|
|||
|
|
@ -206,25 +206,25 @@ public class SongRepository {
|
|||
public MutableLiveData<List<Song>> getSongsByGenres(ArrayList<String> genresId) {
|
||||
MutableLiveData<List<Song>> songsByGenre = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
for(String id: genresId)
|
||||
for (String id : genresId)
|
||||
|
||||
App.getSubsonicClientInstance(application, false)
|
||||
.getAlbumSongListClient()
|
||||
.getSongsByGenre(id, 500, 0)
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<Song> songs = new ArrayList<>(MappingUtil.mapSong(response.body().getSongsByGenre().getSongs()));
|
||||
songsByGenre.setValue(songs);
|
||||
App.getSubsonicClientInstance(application, false)
|
||||
.getAlbumSongListClient()
|
||||
.getSongsByGenre(id, 500, 0)
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<Song> songs = new ArrayList<>(MappingUtil.mapSong(response.body().getSongsByGenre().getSongs()));
|
||||
songsByGenre.setValue(songs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return songsByGenre;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import android.app.Application;
|
|||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.interfaces.SystemCallback;
|
||||
import com.cappielloantonio.play.subsonic.api.system.SystemClient;
|
||||
import com.cappielloantonio.play.subsonic.models.ResponseStatus;
|
||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue