mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Imports optimization and entries rearranged
This commit is contained in:
parent
3c2837e096
commit
65e47f61ef
63 changed files with 987 additions and 1087 deletions
|
|
@ -75,19 +75,15 @@ public class MusicUtil {
|
|||
}
|
||||
|
||||
public static int getDefaultPicPerCategory(String category) {
|
||||
if(category.equals(CustomGlideRequest.SONG_PIC)) {
|
||||
if (category.equals(CustomGlideRequest.SONG_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else if(category.equals(CustomGlideRequest.ALBUM_PIC)) {
|
||||
} else if (category.equals(CustomGlideRequest.ALBUM_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else if(category.equals(CustomGlideRequest.ARTIST_PIC)) {
|
||||
} else if (category.equals(CustomGlideRequest.ARTIST_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else if(category.equals(CustomGlideRequest.PLAYLIST_PIC)) {
|
||||
} else if (category.equals(CustomGlideRequest.PLAYLIST_PIC)) {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return R.drawable.default_album_art;
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +91,7 @@ public class MusicUtil {
|
|||
public static List<MediaItem> getMediaItemsFromSongs(List<Song> songs) {
|
||||
List<MediaItem> mediaItems = new ArrayList<>();
|
||||
|
||||
for(Song song: songs) {
|
||||
for (Song song : songs) {
|
||||
mediaItems.add(getMediaItemFromSong(song));
|
||||
}
|
||||
|
||||
|
|
@ -111,8 +107,7 @@ public class MusicUtil {
|
|||
public static List<Integer> getRandomSongNumber(Context context, int numberOfNumbers, int refreshAfterXHours) {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < numberOfNumbers; i++)
|
||||
{
|
||||
for (int i = 0; i < numberOfNumbers; i++) {
|
||||
list.add(getRandomNumber(0, PreferenceUtil.getInstance(context).getSongNumber(), getMidnightTimestamp(System.currentTimeMillis() / 1000, refreshAfterXHours) + i));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,31 +14,24 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
public class PreferenceUtil {
|
||||
private static final String TAG = "PreferenceUtil";
|
||||
|
||||
public static final String SERVER = "server";
|
||||
public static final String USER = "user";
|
||||
public static final String TOKEN = "token";
|
||||
public static final String MUSIC_LIBRARY_ID = "music_library_id";
|
||||
|
||||
public static final String POSITION = "position";
|
||||
public static final String PROGRESS = "progress";
|
||||
|
||||
public static final String SYNC = "sync";
|
||||
public static final String SONG_GENRE_SYNC = "song_genre_sync";
|
||||
public static final String SEARCH_ELEMENT_PER_CATEGORY = "search_element_per_category";
|
||||
|
||||
public static final String IMAGE_CACHE_SIZE = "image_cache_size";
|
||||
public static final String MEDIA_CACHE_SIZE = "media_cache_size";
|
||||
public static final String INSTANT_MIX_SONG_NUMBER = "instant_mix_song_number";
|
||||
|
||||
public static final String TRANSCODE_CODEC = "transcode_codec";
|
||||
public static final String DIRECT_PLAY_CODECS = "direct_play_codecs";
|
||||
public static final String MAXIMUM_BITRATE = "maximum_bitrate";
|
||||
public static final String AUDIO_DUCKING = "audio_ducking";
|
||||
|
||||
public static final String SONG_NUMBER = "SONG_NUMBER";
|
||||
|
||||
private static final String TAG = "PreferenceUtil";
|
||||
private static PreferenceUtil sInstance;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
||||
|
|
@ -54,7 +47,9 @@ public class PreferenceUtil {
|
|||
return sInstance;
|
||||
}
|
||||
|
||||
public String getTheme() { return mPreferences.getString("themePref", ThemeHelper.DEFAULT_MODE ); }
|
||||
public String getTheme() {
|
||||
return mPreferences.getString("themePref", ThemeHelper.DEFAULT_MODE);
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return mPreferences.getString(SERVER, "https://jellyfin.org");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.cappielloantonio.play.util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.cappielloantonio.play.model.Queue;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
|
||||
|
|
@ -19,7 +17,7 @@ public class QueueUtil {
|
|||
int counter = 0;
|
||||
List<Queue> queue = new ArrayList<>();
|
||||
|
||||
for(Song song: songs) {
|
||||
for (Song song : songs) {
|
||||
queue.add(new Queue(counter, song.getId()));
|
||||
counter++;
|
||||
}
|
||||
|
|
@ -30,7 +28,7 @@ public class QueueUtil {
|
|||
public static List<String> getIDsFromSongs(List<Song> songs) {
|
||||
List<String> IDs = new ArrayList<>();
|
||||
|
||||
for(Song song: songs) {
|
||||
for (Song song : songs) {
|
||||
IDs.add(song.getId());
|
||||
}
|
||||
|
||||
|
|
@ -40,9 +38,9 @@ public class QueueUtil {
|
|||
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())) {
|
||||
for (String ID : IDs) {
|
||||
for (Song song : songs) {
|
||||
if (ID.equals(song.getId())) {
|
||||
orderedSong.add(song);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ import com.cappielloantonio.play.model.SongGenreCross;
|
|||
import org.jellyfin.apiclient.interaction.Response;
|
||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||
import org.jellyfin.apiclient.model.dto.BaseItemType;
|
||||
import org.jellyfin.apiclient.model.playlists.PlaylistItemQuery;
|
||||
import org.jellyfin.apiclient.model.querying.ArtistsQuery;
|
||||
import org.jellyfin.apiclient.model.querying.ItemFields;
|
||||
import org.jellyfin.apiclient.model.querying.ItemQuery;
|
||||
import org.jellyfin.apiclient.model.querying.ItemsByNameQuery;
|
||||
import org.jellyfin.apiclient.model.querying.ItemsResult;
|
||||
import org.jellyfin.apiclient.model.playlists.PlaylistItemQuery;
|
||||
import org.jellyfin.apiclient.model.querying.SimilarItemsQuery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -30,11 +30,10 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
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";
|
||||
private static final String TAG = "SyncUtil";
|
||||
|
||||
public static void getLibraries(Context context, MediaCallback callback) {
|
||||
String id = App.getApiClientInstance(context).getCurrentUserId();
|
||||
|
|
@ -258,11 +257,9 @@ public class SyncUtil {
|
|||
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) {
|
||||
} else if (resultType.equals(ALBUM) && itemDto.getBaseItemType() == BaseItemType.MusicAlbum) {
|
||||
items.add(new Album(itemDto));
|
||||
}
|
||||
else if (resultType.equals(SONG) && itemDto.getBaseItemType() == BaseItemType.Audio) {
|
||||
} else if (resultType.equals(SONG) && itemDto.getBaseItemType() == BaseItemType.Audio) {
|
||||
items.add(new Song(itemDto));
|
||||
}
|
||||
}
|
||||
|
|
@ -290,7 +287,7 @@ public class SyncUtil {
|
|||
}
|
||||
|
||||
private static Song updateSongData(Map<Integer, Song> library, Song newSong) {
|
||||
if(library.containsKey(newSong.hashCode())) {
|
||||
if (library.containsKey(newSong.hashCode())) {
|
||||
Song oldSong = library.get(newSong.hashCode());
|
||||
newSong.setFavorite(oldSong.isFavorite());
|
||||
newSong.setAdded(oldSong.getAdded());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue