v2.10
This commit is contained in:
parent
3d7ba2afc6
commit
08e00b89c5
341 changed files with 7612 additions and 6811 deletions
|
@ -97,8 +97,8 @@ public class AlbumLoader {
|
|||
}
|
||||
|
||||
public static String getSongLoaderSortOrder(Context context) {
|
||||
return PreferenceUtil.getInstance(context).getAlbumSortOrder() + ", " +
|
||||
//PreferenceUtil.getInstance(context).getAlbumSongSortOrder() + "," +
|
||||
PreferenceUtil.getInstance(context).getAlbumDetailSongSortOrder();
|
||||
return PreferenceUtil.getInstance().getAlbumSortOrder() + ", " +
|
||||
//PreferenceUtil.getInstance().getAlbumSongSortOrder() + "," +
|
||||
PreferenceUtil.getInstance().getAlbumDetailSongSortOrder();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ import io.reactivex.Observable;
|
|||
|
||||
public class ArtistLoader {
|
||||
private static String getSongLoaderSortOrder(Context context) {
|
||||
return PreferenceUtil.getInstance(context).getArtistSortOrder() + ", " +
|
||||
PreferenceUtil.getInstance(context).getArtistAlbumSortOrder() + ", " +
|
||||
PreferenceUtil.getInstance(context).getAlbumDetailSongSortOrder() + ", " +
|
||||
PreferenceUtil.getInstance(context).getArtistDetailSongSortOrder();
|
||||
return PreferenceUtil.getInstance().getArtistSortOrder() + ", " +
|
||||
PreferenceUtil.getInstance().getArtistAlbumSortOrder() + ", " +
|
||||
PreferenceUtil.getInstance().getAlbumDetailSongSortOrder() + ", " +
|
||||
PreferenceUtil.getInstance().getArtistDetailSongSortOrder();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ArtistSongLoader extends SongLoader {
|
|||
new String[]{
|
||||
String.valueOf(artistId)
|
||||
},
|
||||
PreferenceUtil.getInstance(context).getArtistSongSortOrder()
|
||||
PreferenceUtil.getInstance().getArtistSongSortOrder()
|
||||
);
|
||||
} catch (SecurityException e) {
|
||||
return null;
|
||||
|
|
|
@ -79,7 +79,7 @@ public class GenreLoader {
|
|||
try {
|
||||
return context.getContentResolver().query(
|
||||
Genres.Members.getContentUri("external", genreId),
|
||||
SongLoader.BASE_PROJECTION, SongLoader.BASE_SELECTION, null, PreferenceUtil.getInstance(context).getSongSortOrder());
|
||||
SongLoader.BASE_PROJECTION, SongLoader.BASE_SELECTION, null, PreferenceUtil.getInstance().getSongSortOrder());
|
||||
} catch (SecurityException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class GenreLoader {
|
|||
try {
|
||||
return context.getContentResolver().query(
|
||||
Genres.EXTERNAL_CONTENT_URI,
|
||||
projection, null, null, PreferenceUtil.getInstance(context).getGenreSortOrder());
|
||||
projection, null, null, PreferenceUtil.getInstance().getGenreSortOrder());
|
||||
} catch (SecurityException e) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -4,13 +4,12 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.MediaStore.Audio.AudioColumns;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
import io.reactivex.Observable;
|
||||
|
||||
/**
|
||||
|
@ -19,7 +18,7 @@ import io.reactivex.Observable;
|
|||
|
||||
public class GenreSongsLoader {
|
||||
|
||||
public static Observable<ArrayList<Song>> getGenreSongsList(@NonNull Context context, @NonNull int genreId) {
|
||||
public static Observable<ArrayList<Song>> getGenreSongsList(@NonNull Context context, int genreId) {
|
||||
return Observable.create(e -> {
|
||||
ArrayList<Song> list = new ArrayList<>();
|
||||
Cursor cursor = makeGenreSongCursor(context, genreId);
|
||||
|
@ -49,8 +48,9 @@ public class GenreSongsLoader {
|
|||
final String albumName = cursor.getString(8);
|
||||
final int artistId = cursor.getInt(9);
|
||||
final String artistName = cursor.getString(10);
|
||||
final String composer = cursor.getString(11);
|
||||
|
||||
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName);
|
||||
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, composer);
|
||||
}
|
||||
|
||||
private static Cursor makeGenreSongCursor(Context context, long genreId) {
|
||||
|
@ -69,6 +69,7 @@ public class GenreSongsLoader {
|
|||
AudioColumns.ALBUM,// 8
|
||||
AudioColumns.ARTIST_ID,// 9
|
||||
AudioColumns.ARTIST,// 10
|
||||
AudioColumns.COMPOSER,// 11
|
||||
}, SongLoader.BASE_SELECTION, null,
|
||||
MediaStore.Audio.Genres.Members.DEFAULT_SORT_ORDER);
|
||||
} catch (SecurityException e) {
|
||||
|
|
|
@ -4,12 +4,11 @@ import android.content.Context;
|
|||
import android.database.Cursor;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import code.name.monkey.retromusic.model.Album;
|
||||
import code.name.monkey.retromusic.model.Artist;
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
|
@ -26,7 +25,7 @@ public class LastAddedSongsLoader {
|
|||
}
|
||||
|
||||
public static Cursor makeLastAddedCursor(@NonNull final Context context) {
|
||||
long cutoff = PreferenceUtil.getInstance(context).getLastAddedCutoff();
|
||||
long cutoff = PreferenceUtil.getInstance().getLastAddedCutoff();
|
||||
|
||||
return SongLoader.makeSongCursor(
|
||||
context,
|
||||
|
|
|
@ -5,14 +5,13 @@ import android.database.Cursor;
|
|||
import android.provider.MediaStore;
|
||||
import android.provider.MediaStore.Audio.AudioColumns;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import code.name.monkey.retromusic.model.AbsCustomPlaylist;
|
||||
import code.name.monkey.retromusic.model.Playlist;
|
||||
import code.name.monkey.retromusic.model.PlaylistSong;
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
|
||||
|
@ -65,11 +64,12 @@ public class PlaylistSongsLoader {
|
|||
final int artistId = cursor.getInt(9);
|
||||
final String artistName = cursor.getString(10);
|
||||
final int idInPlaylist = cursor.getInt(11);
|
||||
final String composer = cursor.getString(12);
|
||||
|
||||
return new PlaylistSong(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, playlistId, idInPlaylist);
|
||||
return new PlaylistSong(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, playlistId, idInPlaylist, composer);
|
||||
}
|
||||
|
||||
public static Cursor makePlaylistSongCursor(@NonNull final Context context, final int playlistId) {
|
||||
private static Cursor makePlaylistSongCursor(@NonNull final Context context, final int playlistId) {
|
||||
try {
|
||||
return context.getContentResolver().query(
|
||||
MediaStore.Audio.Playlists.Members.getContentUri("external", playlistId),
|
||||
|
@ -85,7 +85,8 @@ public class PlaylistSongsLoader {
|
|||
AudioColumns.ALBUM,// 8
|
||||
AudioColumns.ARTIST_ID,// 9
|
||||
AudioColumns.ARTIST,// 10
|
||||
MediaStore.Audio.Playlists.Members._ID // 11
|
||||
MediaStore.Audio.Playlists.Members._ID, // 11
|
||||
AudioColumns.COMPOSER,// 12
|
||||
}, SongLoader.BASE_SELECTION, null,
|
||||
MediaStore.Audio.Playlists.Members.DEFAULT_SORT_ORDER);
|
||||
} catch (SecurityException e) {
|
||||
|
|
|
@ -5,16 +5,18 @@ import android.database.Cursor;
|
|||
import android.provider.BaseColumns;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.MediaStore.Audio.AudioColumns;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import code.name.monkey.retromusic.helper.ShuffleHelper;
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
import code.name.monkey.retromusic.providers.BlacklistStore;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* Created by hemanths on 10/08/17.
|
||||
|
@ -36,6 +38,7 @@ public class SongLoader {
|
|||
AudioColumns.ALBUM,// 8
|
||||
AudioColumns.ARTIST_ID,// 9
|
||||
AudioColumns.ARTIST,// 10
|
||||
AudioColumns.COMPOSER,// 11
|
||||
};
|
||||
|
||||
@NonNull
|
||||
|
@ -83,16 +86,17 @@ public class SongLoader {
|
|||
final String albumName = cursor.getString(8);
|
||||
final int artistId = cursor.getInt(9);
|
||||
final String artistName = cursor.getString(10);
|
||||
final String composer = cursor.getString(11);
|
||||
|
||||
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName,
|
||||
artistId, artistName);
|
||||
artistId, artistName, composer);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Cursor makeSongCursor(@NonNull final Context context,
|
||||
@Nullable final String selection, final String[] selectionValues) {
|
||||
return makeSongCursor(context, selection, selectionValues,
|
||||
PreferenceUtil.getInstance(context).getSongSortOrder());
|
||||
PreferenceUtil.getInstance().getSongSortOrder());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -167,25 +171,28 @@ public class SongLoader {
|
|||
}
|
||||
|
||||
public static Observable<ArrayList<Song>> suggestSongs(@NonNull Context context) {
|
||||
return Observable.create(observer -> {
|
||||
SongLoader.getAllSongs(context)
|
||||
.subscribe(songs -> {
|
||||
ArrayList<Song> list = new ArrayList<>();
|
||||
if (songs.isEmpty()) {
|
||||
observer.onNext(new ArrayList<>());
|
||||
observer.onComplete();
|
||||
return;
|
||||
}
|
||||
ShuffleHelper.makeShuffleList(songs, -1);
|
||||
if (songs.size() > 10) {
|
||||
list.addAll(songs.subList(0, 10));
|
||||
} else {
|
||||
list.addAll(songs);
|
||||
}
|
||||
observer.onNext(list);
|
||||
observer.onComplete();
|
||||
});
|
||||
});
|
||||
return SongLoader.getAllSongs(context)
|
||||
.flatMap((Function<ArrayList<Song>, ObservableSource<ArrayList<Song>>>) songs -> {
|
||||
ArrayList<Song> list = new ArrayList<>();
|
||||
ShuffleHelper.makeShuffleList(songs, -1);
|
||||
if (songs.size() > 10) {
|
||||
list.addAll(songs.subList(0, 10));
|
||||
}
|
||||
return Observable.just(list);
|
||||
});
|
||||
/*.subscribe(songs -> {
|
||||
ArrayList<Song> list = new ArrayList<>();
|
||||
if (songs.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ShuffleHelper.makeShuffleList(songs, -1);
|
||||
if (songs.size() > 10) {
|
||||
list.addAll(songs.subList(0, 10));
|
||||
} else {
|
||||
list.addAll(songs);
|
||||
}
|
||||
return;
|
||||
});*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue