Bugfixes
This commit is contained in:
parent
5f89e52658
commit
f9cd2e8a2e
5 changed files with 24 additions and 29 deletions
|
|
@ -40,10 +40,10 @@ public class AlbumLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Cursor makeAlbumCursor(final Context context) {
|
public static final Cursor makeAlbumCursor(final Context context) {
|
||||||
return makeAlbumCursor(context, null);
|
return makeAlbumCursor(context, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Cursor makeAlbumCursor(final Context context, String selection) {
|
public static final Cursor makeAlbumCursor(final Context context, final String selection, final String[] values) {
|
||||||
return context.getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
|
return context.getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
|
||||||
new String[]{
|
new String[]{
|
||||||
/* 0 */
|
/* 0 */
|
||||||
|
|
@ -58,11 +58,11 @@ public class AlbumLoader {
|
||||||
MediaStore.Audio.AlbumColumns.NUMBER_OF_SONGS,
|
MediaStore.Audio.AlbumColumns.NUMBER_OF_SONGS,
|
||||||
/* 5 */
|
/* 5 */
|
||||||
MediaStore.Audio.AlbumColumns.FIRST_YEAR
|
MediaStore.Audio.AlbumColumns.FIRST_YEAR
|
||||||
}, selection, null, PreferenceUtils.getInstace(context).getAlbumSortOrder());
|
}, selection, values, PreferenceUtils.getInstace(context).getAlbumSortOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Album getAlbum(Context context, int albumId) {
|
public static Album getAlbum(Context context, int albumId) {
|
||||||
Cursor cursor = makeAlbumCursor(context, BaseColumns._ID + "=" + albumId);
|
Cursor cursor = makeAlbumCursor(context, BaseColumns._ID + "=?", new String[]{String.valueOf(albumId)});
|
||||||
Album album = new Album();
|
Album album = new Album();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
final int id = cursor.getInt(0);
|
final int id = cursor.getInt(0);
|
||||||
|
|
@ -82,7 +82,7 @@ public class AlbumLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Album> getAlbums(Context context, String query) {
|
public static List<Album> getAlbums(Context context, String query) {
|
||||||
Cursor cursor = makeAlbumCursor(context, MediaStore.Audio.AlbumColumns.ALBUM + " LIKE '%" + query + "%'");
|
Cursor cursor = makeAlbumCursor(context, MediaStore.Audio.AlbumColumns.ALBUM + " LIKE ?", new String[]{"%"+query+"%"});
|
||||||
List<Album> albums = new ArrayList<>();
|
List<Album> albums = new ArrayList<>();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@ public class ArtistLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Cursor makeArtistCursor(final Context context) {
|
public static final Cursor makeArtistCursor(final Context context) {
|
||||||
return makeArtistCursor(context, null);
|
return makeArtistCursor(context, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Cursor makeArtistCursor(final Context context, String selection) {
|
public static final Cursor makeArtistCursor(final Context context, final String selection, final String[] values) {
|
||||||
return context.getContentResolver().query(MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,
|
return context.getContentResolver().query(MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,
|
||||||
new String[]{
|
new String[]{
|
||||||
/* 0 */
|
/* 0 */
|
||||||
|
|
@ -52,11 +52,11 @@ public class ArtistLoader {
|
||||||
MediaStore.Audio.ArtistColumns.NUMBER_OF_ALBUMS,
|
MediaStore.Audio.ArtistColumns.NUMBER_OF_ALBUMS,
|
||||||
/* 3 */
|
/* 3 */
|
||||||
MediaStore.Audio.ArtistColumns.NUMBER_OF_TRACKS
|
MediaStore.Audio.ArtistColumns.NUMBER_OF_TRACKS
|
||||||
}, selection, null, PreferenceUtils.getInstace(context).getArtistSortOrder());
|
}, selection, values, PreferenceUtils.getInstace(context).getArtistSortOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Artist getArtist(Context context, int artistId) {
|
public static Artist getArtist(Context context, int artistId) {
|
||||||
Cursor cursor = makeArtistCursor(context, BaseColumns._ID + "=" + artistId);
|
Cursor cursor = makeArtistCursor(context, BaseColumns._ID + "=?", new String[]{String.valueOf(artistId)});
|
||||||
Artist artist = new Artist();
|
Artist artist = new Artist();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
final int id = cursor.getInt(0);
|
final int id = cursor.getInt(0);
|
||||||
|
|
@ -74,7 +74,7 @@ public class ArtistLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Artist> getArtists(Context context, String query) {
|
public static List<Artist> getArtists(Context context, String query) {
|
||||||
Cursor cursor = makeArtistCursor(context, MediaStore.Audio.ArtistColumns.ARTIST + " LIKE '%" + query + "%'");
|
Cursor cursor = makeArtistCursor(context, MediaStore.Audio.ArtistColumns.ARTIST + " LIKE ?", new String[]{"%"+query+"%"});
|
||||||
List<Artist> artists = new ArrayList<>();
|
List<Artist> artists = new ArrayList<>();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PlaylistLoader {
|
public class PlaylistLoader {
|
||||||
public static Playlist getPlaylist(final Context context, final int playlistID) {
|
public static Playlist getPlaylist(final Context context, final int playlistId) {
|
||||||
Playlist playlist = new Playlist();
|
Playlist playlist = new Playlist();
|
||||||
Cursor cursor = makePlaylistCursor(context, BaseColumns._ID + "=" + playlistID);
|
Cursor cursor = makePlaylistCursor(context, BaseColumns._ID + "=?", new String[]{String.valueOf(playlistId)});
|
||||||
|
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
final int id = cursor.getInt(0);
|
final int id = cursor.getInt(0);
|
||||||
|
|
@ -29,7 +29,7 @@ public class PlaylistLoader {
|
||||||
|
|
||||||
public static List<Playlist> getAllPlaylists(final Context context) {
|
public static List<Playlist> getAllPlaylists(final Context context) {
|
||||||
List<Playlist> playlists = new ArrayList<>();
|
List<Playlist> playlists = new ArrayList<>();
|
||||||
Cursor cursor = makePlaylistCursor(context, null);
|
Cursor cursor = makePlaylistCursor(context, null, null);
|
||||||
|
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|
@ -45,13 +45,13 @@ public class PlaylistLoader {
|
||||||
return playlists;
|
return playlists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Cursor makePlaylistCursor(final Context context, final String selection) {
|
public static Cursor makePlaylistCursor(final Context context, final String selection, final String[] values) {
|
||||||
return context.getContentResolver().query(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
|
return context.getContentResolver().query(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
|
||||||
new String[]{
|
new String[]{
|
||||||
/* 0 */
|
/* 0 */
|
||||||
BaseColumns._ID,
|
BaseColumns._ID,
|
||||||
/* 1 */
|
/* 1 */
|
||||||
PlaylistsColumns.NAME
|
PlaylistsColumns.NAME
|
||||||
}, selection, null, MediaStore.Audio.Playlists.DEFAULT_SORT_ORDER);
|
}, selection, values, MediaStore.Audio.Playlists.DEFAULT_SORT_ORDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,10 @@ public class SongLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Cursor makeSongCursor(final Context context) {
|
public static final Cursor makeSongCursor(final Context context) {
|
||||||
return makeSongCursor(context, (MediaStore.Audio.AudioColumns.IS_MUSIC + "=1"));
|
return makeSongCursor(context, MediaStore.Audio.AudioColumns.IS_MUSIC + "=?", new String[]{"1"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Cursor makeSongCursor(final Context context, final String selection) {
|
public static final Cursor makeSongCursor(final Context context, final String selection, final String[] values) {
|
||||||
return context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
|
return context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
|
||||||
new String[]{
|
new String[]{
|
||||||
/* 0 */
|
/* 0 */
|
||||||
|
|
@ -63,11 +63,11 @@ public class SongLoader {
|
||||||
MediaStore.Audio.AudioColumns.ARTIST_ID,
|
MediaStore.Audio.AudioColumns.ARTIST_ID,
|
||||||
/* 7 */
|
/* 7 */
|
||||||
MediaStore.Audio.AudioColumns.ALBUM_ID
|
MediaStore.Audio.AudioColumns.ALBUM_ID
|
||||||
}, selection, null, PreferenceUtils.getInstace(context).getSongSortOrder());
|
}, selection, values, PreferenceUtils.getInstace(context).getSongSortOrder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Song> getSongs(Context context, String query) {
|
public static List<Song> getSongs(final Context context, final String query) {
|
||||||
Cursor cursor = makeSongCursor(context, MediaStore.Audio.AudioColumns.TITLE + " LIKE '%" + query + "%'");
|
Cursor cursor = makeSongCursor(context, MediaStore.Audio.AudioColumns.TITLE + " LIKE ?", new String[]{"%"+query+"%"});
|
||||||
List<Song> songs = new ArrayList<>();
|
List<Song> songs = new ArrayList<>();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|
@ -91,8 +91,8 @@ public class SongLoader {
|
||||||
return songs;
|
return songs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Song getSong(Context context, int queryId) {
|
public static Song getSong(final Context context, final int queryId) {
|
||||||
Cursor cursor = makeSongCursor(context, MediaStore.Audio.AudioColumns._ID + "=" + queryId);
|
Cursor cursor = makeSongCursor(context, MediaStore.Audio.AudioColumns._ID + "=?", new String[]{String.valueOf(queryId)});
|
||||||
Song song = null;
|
Song song = null;
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
final int id = cursor.getInt(0);
|
final int id = cursor.getInt(0);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@+id/media_controller_container"
|
android:layout_above="@+id/media_controller_container"
|
||||||
android:background="@color/materialmusic_default_bar_color"
|
android:background="@color/materialmusic_default_bar_color"
|
||||||
android:elevation="1dp"
|
android:elevation="2dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="16dp"
|
android:paddingBottom="16dp"
|
||||||
android:paddingLeft="72dp"
|
android:paddingLeft="72dp"
|
||||||
|
|
@ -88,12 +88,6 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="5dp"
|
|
||||||
android:layout_below="@id/footer"
|
|
||||||
android:background="@drawable/shadow_down"/>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/media_controller_container"
|
android:id="@+id/media_controller_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -161,6 +155,7 @@
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
|
android:elevation="2dp"
|
||||||
android:id="@+id/progress_slider"
|
android:id="@+id/progress_slider"
|
||||||
style="@style/MusicProgressSlider"
|
style="@style/MusicProgressSlider"
|
||||||
android:layout_above="@+id/footer"/>
|
android:layout_above="@+id/footer"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue