mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Removed unused code
This commit is contained in:
parent
5248e897dd
commit
8de8ce2755
7 changed files with 10 additions and 475 deletions
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
|
|
@ -3,6 +3,7 @@
|
|||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="app/src/main/res/drawable/ic_refresh.xml" value="0.18958333333333333" />
|
||||
<entry key="app/src/main/res/layout/fragment_artist_page.xml" value="0.3229166666666667" />
|
||||
<entry key="app/src/main/res/layout/item_horizontal_album.xml" value="0.3166496424923391" />
|
||||
<entry key="app/src/main/res/layout/item_horizontal_track.xml" value="0.1" />
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
|||
|
||||
public void setItems(List<Song> songs) {
|
||||
this.songs = songs;
|
||||
notifyDataSetChanged();
|
||||
notifyItemRangeChanged(0, songs.size());
|
||||
}
|
||||
|
||||
public Song getItem(int id) {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
|
||||
public void setItems(List<Song> songs) {
|
||||
this.songs = songs;
|
||||
notifyDataSetChanged();
|
||||
notifyItemRangeChanged(0, songs.size());
|
||||
}
|
||||
|
||||
public Song getItem(int id) {
|
||||
|
|
@ -103,9 +103,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
itemView.setOnClickListener(this);
|
||||
itemView.setOnLongClickListener(this);
|
||||
|
||||
more.setOnClickListener(v -> {
|
||||
openMore(v);
|
||||
});
|
||||
more.setOnClickListener(this::openMore);
|
||||
|
||||
songTitle.setSelected(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,9 @@ public class PlayerBottomSheetFragment extends Fragment implements MusicServiceE
|
|||
|
||||
playerNowPlayingSongAdapter = new PlayerNowPlayingSongAdapter(requireContext());
|
||||
bind.playerBodyLayout.playerSongCoverViewPager.setAdapter(playerNowPlayingSongAdapter);
|
||||
playerBottomSheetViewModel.getQueueSong().observe(requireActivity(), queue -> playerNowPlayingSongAdapter.setItems(MappingUtil.mapQueue(queue)));
|
||||
playerBottomSheetViewModel.getQueueSong().observe(requireActivity(), queue -> {
|
||||
playerNowPlayingSongAdapter.setItems(MappingUtil.mapQueue(queue));
|
||||
});
|
||||
|
||||
bind.playerBodyLayout.playerSongCoverViewPager.setOffscreenPageLimit(3);
|
||||
bind.playerBodyLayout.playerSongCoverViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
|
|
@ -141,7 +143,9 @@ public class PlayerBottomSheetFragment extends Fragment implements MusicServiceE
|
|||
|
||||
playerSongQueueAdapter = new PlayerSongQueueAdapter(requireContext(), this);
|
||||
bind.playerBodyLayout.playerQueueRecyclerView.setAdapter(playerSongQueueAdapter);
|
||||
playerBottomSheetViewModel.getQueueSong().observe(requireActivity(), queue -> playerSongQueueAdapter.setItems(MappingUtil.mapQueue(queue)));
|
||||
playerBottomSheetViewModel.getQueueSong().observe(requireActivity(), queue -> {
|
||||
playerSongQueueAdapter.setItems(MappingUtil.mapQueue(queue));
|
||||
});
|
||||
|
||||
new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.LEFT) {
|
||||
int originalPosition = -1;
|
||||
|
|
|
|||
|
|
@ -1,125 +0,0 @@
|
|||
package com.cappielloantonio.play.ui.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.cappielloantonio.play.interfaces.MediaCallback;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
import com.cappielloantonio.play.util.SyncUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SyncFragment {
|
||||
private Context context;
|
||||
|
||||
private void syncLibraries() {
|
||||
SyncUtil.getLibraries(context, new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void syncAlbums(int size, int offset, int page) {
|
||||
SyncUtil.getAlbums(context, new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
// syncViewModel.addToAlbumList((List<AlbumID3>) media);
|
||||
|
||||
if (media.size() == size) {
|
||||
syncAlbums(size, size * (page + 1), page + 1);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}, size, offset);
|
||||
}
|
||||
|
||||
private void syncArtists() {
|
||||
SyncUtil.getArtists(context, new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
// syncViewModel.setArtistList((ArrayList<ArtistID3>) media);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void syncGenres() {
|
||||
SyncUtil.getGenres(context, new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
// syncViewModel.setGenreList((ArrayList<Genre>) media);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void syncPlaylist() {
|
||||
SyncUtil.getPlaylists(context, new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
// syncViewModel.setPlaylistList((ArrayList<Playlist>) media);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void syncSongsPerPlaylist(List<Playlist> playlists) {
|
||||
/* for (Playlist playlist : playlists) {
|
||||
SyncUtil.getSongsPerPlaylist(context(), new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
loadSectorInfo(SONG_X_PLAYLIST, exception.getMessage(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
playlistSongRepository.insertAll((ArrayList<PlaylistSongCross>) media);
|
||||
loadSectorInfo(SONG_X_PLAYLIST, "Playlist processed: " + playlist.getName(), true);
|
||||
}
|
||||
}, playlist.getId());
|
||||
} */
|
||||
}
|
||||
|
||||
private void syncSongs() {
|
||||
/* for (AlbumID3 album : syncViewModel.getAlbumList()) {
|
||||
SyncUtil.getSongs(context, syncViewModel.getCatalogue(), new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
syncViewModel.addToSongList((ArrayList<Song>) media);
|
||||
}
|
||||
}, album);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void syncDownloadedSong() {
|
||||
/*songRepository.getListLiveDownloadedSong().observe(requireActivity(), songs -> {
|
||||
for (Song song : songs) {
|
||||
if (!DownloadUtil.getDownloadTracker(context()).isDownloaded(song)) {
|
||||
song.setOffline(false);
|
||||
songRepository.setOfflineStatus(song);
|
||||
}
|
||||
}
|
||||
});*/
|
||||
}
|
||||
}
|
||||
|
|
@ -9,10 +9,6 @@ import java.util.List;
|
|||
public class QueueUtil {
|
||||
private static final String TAG = "QueueUtil";
|
||||
|
||||
public static Queue getQueueElementFromSong(Song song, int startingPosition) {
|
||||
return new Queue(startingPosition, song.getId(), song.getTitle(), song.getAlbumId(), song.getAlbumName(), song.getArtistId(), song.getArtistName(), song.getPrimary(), song.getDuration());
|
||||
}
|
||||
|
||||
public static List<Queue> getQueueElementsFromSongs(List<Song> songs) {
|
||||
int counter = 0;
|
||||
List<Queue> queue = new ArrayList<>();
|
||||
|
|
@ -24,29 +20,4 @@ public class QueueUtil {
|
|||
|
||||
return queue;
|
||||
}
|
||||
|
||||
public static List<String> getIDsFromSongs(List<Song> songs) {
|
||||
List<String> IDs = new ArrayList<>();
|
||||
|
||||
for (Song song : songs) {
|
||||
IDs.add(song.getId());
|
||||
}
|
||||
|
||||
return IDs;
|
||||
}
|
||||
|
||||
public static List<Song> orderSongByIdList(List<String> IDs, List<Song> songs) {
|
||||
List<Song> orderedSong = new ArrayList<>();
|
||||
|
||||
for (String ID : IDs) {
|
||||
for (Song song : songs) {
|
||||
if (ID.equals(song.getId())) {
|
||||
orderedSong.add(song);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return orderedSong;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,314 +0,0 @@
|
|||
package com.cappielloantonio.play.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.interfaces.MediaCallback;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.play.subsonic.models.IndexID3;
|
||||
import com.cappielloantonio.play.subsonic.models.MusicFolder;
|
||||
import com.cappielloantonio.play.subsonic.models.ResponseStatus;
|
||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
public class SyncUtil {
|
||||
private static final String TAG = "SyncUtil";
|
||||
|
||||
public static final String SONG = "song";
|
||||
public static final String ALBUM = "album";
|
||||
public static final String ARTIST = "artist";
|
||||
|
||||
public static void getLibraries(Context context, MediaCallback callback) {
|
||||
App.getSubsonicClientInstance(context, false)
|
||||
.getBrowsingClient()
|
||||
.getMusicFolders()
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, retrofit2.Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.FAILED)) {
|
||||
String errorMessage = response.body().getError().getCode().getValue() + " - " + response.body().getError().getMessage();
|
||||
callback.onError(new Exception(errorMessage));
|
||||
} else if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
boolean musicFolderFound = false;
|
||||
|
||||
for (MusicFolder folder : response.body().getMusicFolders().getMusicFolders()) {
|
||||
if (folder.getName().equals("music")) {
|
||||
PreferenceUtil.getInstance(context).setMusicLibraryID(String.valueOf(folder.getId()));
|
||||
musicFolderFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (musicFolderFound) callback.onLoadMedia(null);
|
||||
} else {
|
||||
callback.onError(new Exception("Empty response"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
callback.onError(new Exception(t.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getSongs(Context context, Map<Integer, Song> currentCatalogue, MediaCallback callback, AlbumID3 album) {
|
||||
App.getSubsonicClientInstance(context, false)
|
||||
.getBrowsingClient()
|
||||
.getAlbum(album.getId())
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, retrofit2.Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.FAILED)) {
|
||||
String errorMessage = response.body().getError().getCode().getValue() + " - " + response.body().getError().getMessage();
|
||||
callback.onError(new Exception(errorMessage));
|
||||
} else if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<Song> songList = new ArrayList<>(MappingUtil.mapSong(response.body().getAlbum().getSongs()));
|
||||
updateSongData(currentCatalogue, songList);
|
||||
callback.onLoadMedia(songList);
|
||||
} else {
|
||||
callback.onError(new Exception("Empty response"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
callback.onError(new Exception(t.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getAlbums(Context context, MediaCallback callback, int size, int offset) {
|
||||
App.getSubsonicClientInstance(context, false)
|
||||
.getAlbumSongListClient()
|
||||
.getAlbumList2("alphabeticalByName", size, offset)
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, retrofit2.Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.FAILED)) {
|
||||
String errorMessage = response.body().getError().getCode().getValue() + " - " + response.body().getError().getMessage();
|
||||
callback.onError(new Exception(errorMessage));
|
||||
} else if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<AlbumID3> albumList = new ArrayList<>();
|
||||
albumList.addAll(response.body().getAlbumList2().getAlbums());
|
||||
callback.onLoadMedia(albumList);
|
||||
} else {
|
||||
callback.onError(new Exception("Empty response"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
callback.onError(new Exception(t.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getArtists(Context context, MediaCallback callback) {
|
||||
App.getSubsonicClientInstance(context, false)
|
||||
.getBrowsingClient()
|
||||
.getArtists()
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, retrofit2.Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.FAILED)) {
|
||||
String errorMessage = response.body().getError().getCode().getValue() + " - " + response.body().getError().getMessage();
|
||||
callback.onError(new Exception(errorMessage));
|
||||
} else if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<ArtistID3> artistList = new ArrayList<>();
|
||||
|
||||
for (IndexID3 index : response.body().getArtists().getIndices()) {
|
||||
artistList.addAll(index.getArtists());
|
||||
}
|
||||
|
||||
callback.onLoadMedia(artistList);
|
||||
} else {
|
||||
callback.onError(new Exception("Empty response"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
callback.onError(new Exception(t.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getPlaylists(Context context, MediaCallback callback) {
|
||||
App.getSubsonicClientInstance(context, false)
|
||||
.getPlaylistClient()
|
||||
.getPlaylists()
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, retrofit2.Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.FAILED)) {
|
||||
String errorMessage = response.body().getError().getCode().getValue() + " - " + response.body().getError().getMessage();
|
||||
callback.onError(new Exception(errorMessage));
|
||||
} else if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<com.cappielloantonio.play.subsonic.models.Playlist> playlistList = new ArrayList<>();
|
||||
playlistList.addAll(response.body().getPlaylists().getPlaylists());
|
||||
callback.onLoadMedia(playlistList);
|
||||
} else {
|
||||
callback.onError(new Exception("Empty response"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
callback.onError(new Exception(t.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getGenres(Context context, MediaCallback callback) {
|
||||
App.getSubsonicClientInstance(context, false)
|
||||
.getBrowsingClient()
|
||||
.getGenres()
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, retrofit2.Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.FAILED)) {
|
||||
String errorMessage = response.body().getError().getCode().getValue() + " - " + response.body().getError().getMessage();
|
||||
callback.onError(new Exception(errorMessage));
|
||||
} else if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
List<com.cappielloantonio.play.subsonic.models.Genre> genreList = new ArrayList<>();
|
||||
genreList.addAll(response.body().getGenres().getGenres());
|
||||
callback.onLoadMedia(genreList);
|
||||
} else {
|
||||
callback.onError(new Exception("Empty response"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
callback.onError(new Exception(t.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getSongsPerPlaylist(Context context, MediaCallback callback, String playlistId) {
|
||||
/*PlaylistItemQuery query = new PlaylistItemQuery();
|
||||
|
||||
query.setId(playlistId);
|
||||
query.setUserId(App.getApiClientInstance(context).getCurrentUserId());
|
||||
query.setFields(new ItemFields[]{ItemFields.MediaSources});
|
||||
|
||||
|
||||
App.getApiClientInstance(context).GetPlaylistItems(query, new Response<ItemsResult>() {
|
||||
@Override
|
||||
public void onResponse(ItemsResult result) {
|
||||
int itemNumber = 0;
|
||||
ArrayList<PlaylistSongCross> crosses = new ArrayList<>();
|
||||
|
||||
for (BaseItemDto itemDto : result.getItems()) {
|
||||
crosses.add(new PlaylistSongCross(playlistId, itemDto.getId(), itemNumber++));
|
||||
}
|
||||
|
||||
callback.onLoadMedia(crosses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
callback.onError(exception);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
public static void getInstantMix(Context context, MediaCallback callback, String resultType, String itemID, int limit) {
|
||||
/*SimilarItemsQuery query = new SimilarItemsQuery();
|
||||
|
||||
query.setId(itemID);
|
||||
query.setUserId(App.getApiClientInstance(context).getCurrentUserId());
|
||||
query.setFields(new ItemFields[]{ItemFields.MediaSources});
|
||||
query.setLimit(limit);
|
||||
|
||||
App.getApiClientInstance(context).GetInstantMixFromItem(query, new Response<ItemsResult>() {
|
||||
@Override
|
||||
public void onResponse(ItemsResult result) {
|
||||
List<Object> items = new ArrayList<>();
|
||||
|
||||
for (BaseItemDto itemDto : result.getItems()) {
|
||||
if (resultType.equals(ARTIST) && itemDto.getBaseItemType() == BaseItemType.MusicArtist) {
|
||||
items.add(new Artist(itemDto));
|
||||
} else if (resultType.equals(ALBUM) && itemDto.getBaseItemType() == BaseItemType.MusicAlbum) {
|
||||
items.add(new Album(itemDto));
|
||||
} else if (resultType.equals(SONG) && itemDto.getBaseItemType() == BaseItemType.Audio) {
|
||||
items.add(new Song(itemDto));
|
||||
}
|
||||
}
|
||||
|
||||
callback.onLoadMedia(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
callback.onError(exception);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
public static void getSimilarItems(Context context, MediaCallback callback, String resultType, String itemID, int limit) {
|
||||
/*SimilarItemsQuery query = new SimilarItemsQuery();
|
||||
|
||||
query.setId(itemID);
|
||||
query.setUserId(App.getApiClientInstance(context).getCurrentUserId());
|
||||
query.setFields(new ItemFields[]{ItemFields.MediaSources});
|
||||
query.setLimit(limit);
|
||||
|
||||
App.getApiClientInstance(context).GetSimilarItems(query, new Response<ItemsResult>() {
|
||||
@Override
|
||||
public void onResponse(ItemsResult result) {
|
||||
List<Object> items = new ArrayList<>();
|
||||
|
||||
for (BaseItemDto itemDto : result.getItems()) {
|
||||
if (resultType.equals(ARTIST) && itemDto.getBaseItemType() == BaseItemType.MusicArtist) {
|
||||
items.add(new Artist(itemDto));
|
||||
} else if (resultType.equals(ALBUM) && itemDto.getBaseItemType() == BaseItemType.MusicAlbum) {
|
||||
items.add(new Album(itemDto));
|
||||
} else if (resultType.equals(SONG) && itemDto.getBaseItemType() == BaseItemType.Audio) {
|
||||
items.add(new Song(itemDto));
|
||||
}
|
||||
}
|
||||
|
||||
callback.onLoadMedia(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
callback.onError(exception);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
public static Bundle getSyncBundle(Boolean syncAlbum, Boolean syncArtist, Boolean syncGenres, Boolean syncPlaylist, Boolean syncSong) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("sync_album", syncAlbum);
|
||||
bundle.putBoolean("sync_artist", syncArtist);
|
||||
bundle.putBoolean("sync_genres", syncGenres);
|
||||
bundle.putBoolean("sync_playlist", syncPlaylist);
|
||||
bundle.putBoolean("sync_song", syncSong);
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
private static void updateSongData(Map<Integer, Song> library, List<Song> songs) {
|
||||
for (Song song : songs) {
|
||||
if (library.containsKey(song.hashCode())) {
|
||||
Song oldSong = library.get(song.hashCode());
|
||||
song.setFavorite(oldSong.isFavorite());
|
||||
song.setAdded(oldSong.getAdded());
|
||||
song.setLastPlay(oldSong.getLastPlay());
|
||||
song.setPlayCount(oldSong.getPlayCount());
|
||||
song.setOffline(oldSong.isOffline());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue