diff --git a/app/app.iml b/app/app.iml
index caf1673d..2566dab7 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -21,6 +21,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -130,11 +152,9 @@
-
-
@@ -146,26 +166,23 @@
-
+
-
-
-
-
+
@@ -173,6 +190,7 @@
+
@@ -188,6 +206,7 @@
+
@@ -195,6 +214,7 @@
+
@@ -231,6 +251,7 @@
+
diff --git a/app/build.gradle b/app/build.gradle
index c65db325..6141b996 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
@@ -52,7 +53,9 @@ android {
versionName defaultConfig.versionName + "_" + getDate()
dimension "default"
}
-
+ sans {
+ dimension "default"
+ }
}
packagingOptions {
@@ -146,5 +149,9 @@ dependencies {
implementation 'com.github.hannesa2:AndroidSlidingUpPanel:3.5.0'
implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3'
implementation 'org.nanohttpd:nanohttpd:2.3.1'
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
+repositories {
+ mavenCentral()
+}
diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.java b/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.java
index a1350042..a26f6b76 100644
--- a/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.java
+++ b/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.java
@@ -409,7 +409,7 @@ public class MusicPlayerRemote {
MediaStore.Audio.AudioColumns._ID + "=?",
new String[]{songId}
));*/
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(
musicService,
MediaStore.Audio.AudioColumns._ID + "=?",
new String[]{songId}))
@@ -431,7 +431,7 @@ public class MusicPlayerRemote {
songFile = new File(uri.getPath());
}
if (songFile != null) {
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(
musicService,
MediaStore.Audio.AudioColumns.DATA + "=?",
new String[]{songFile.getAbsolutePath()}
diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/SearchQueryHelper.java b/app/src/main/java/code/name/monkey/retromusic/helper/SearchQueryHelper.java
index 7aaa91ae..acef195a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/helper/SearchQueryHelper.java
+++ b/app/src/main/java/code/name/monkey/retromusic/helper/SearchQueryHelper.java
@@ -36,51 +36,51 @@ public class SearchQueryHelper {
ArrayList songs = new ArrayList<>();
if (artistName != null && albumName != null && titleName != null) {
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION + AND + ALBUM_SELECTION + AND + TITLE_SELECTION, new String[]{artistName.toLowerCase(), albumName.toLowerCase(), titleName.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, ARTIST_SELECTION + AND + ALBUM_SELECTION + AND + TITLE_SELECTION, new String[]{artistName.toLowerCase(), albumName.toLowerCase(), titleName.toLowerCase()})).blockingFirst();
}
if (!songs.isEmpty()) {
return songs;
}
if (artistName != null && titleName != null) {
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION + AND + TITLE_SELECTION, new String[]{artistName.toLowerCase(), titleName.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, ARTIST_SELECTION + AND + TITLE_SELECTION, new String[]{artistName.toLowerCase(), titleName.toLowerCase()})).blockingFirst();
}
if (!songs.isEmpty()) {
return songs;
}
if (albumName != null && titleName != null) {
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ALBUM_SELECTION + AND + TITLE_SELECTION, new String[]{albumName.toLowerCase(), titleName.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, ALBUM_SELECTION + AND + TITLE_SELECTION, new String[]{albumName.toLowerCase(), titleName.toLowerCase()})).blockingFirst();
}
if (!songs.isEmpty()) {
return songs;
}
if (artistName != null) {
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION, new String[]{artistName.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, ARTIST_SELECTION, new String[]{artistName.toLowerCase()})).blockingFirst();
}
if (!songs.isEmpty()) {
return songs;
}
if (albumName != null) {
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ALBUM_SELECTION, new String[]{albumName.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, ALBUM_SELECTION, new String[]{albumName.toLowerCase()})).blockingFirst();
}
if (!songs.isEmpty()) {
return songs;
}
if (titleName != null) {
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, TITLE_SELECTION, new String[]{titleName.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, TITLE_SELECTION, new String[]{titleName.toLowerCase()})).blockingFirst();
}
if (!songs.isEmpty()) {
return songs;
}
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION, new String[]{query.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, ARTIST_SELECTION, new String[]{query.toLowerCase()})).blockingFirst();
if (!songs.isEmpty()) {
return songs;
}
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ALBUM_SELECTION, new String[]{query.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, ALBUM_SELECTION, new String[]{query.toLowerCase()})).blockingFirst();
if (!songs.isEmpty()) {
return songs;
}
- songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, TITLE_SELECTION, new String[]{query.toLowerCase()})).blockingFirst();
+ songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, TITLE_SELECTION, new String[]{query.toLowerCase()})).blockingFirst();
if (!songs.isEmpty()) {
return songs;
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.java b/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.java
index 20052668..0edf4ebc 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.java
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/AlbumLoader.java
@@ -17,7 +17,7 @@ import java.util.ArrayList;
public class AlbumLoader {
public static Observable> getAllAlbums(@NonNull Context context) {
- Observable> songs = SongLoader.getSongs(SongLoader.makeSongCursor(
+ Observable> songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(
context,
null,
null,
@@ -30,7 +30,7 @@ public class AlbumLoader {
@NonNull
public static Observable> getAlbums(@NonNull final Context context,
String query) {
- Observable> songs = SongLoader.getSongs(SongLoader.makeSongCursor(
+ Observable> songs = SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(
context,
AudioColumns.ALBUM + " LIKE ?",
new String[]{"%" + query + "%"},
@@ -42,7 +42,7 @@ public class AlbumLoader {
@NonNull
public static Observable getAlbum(@NonNull final Context context, int albumId) {
return Observable.create(e -> {
- Observable> songs = SongLoader.getSongs(SongLoader
+ Observable> songs = SongLoader.Companion.getSongs(SongLoader.Companion
.makeSongCursor(context, AudioColumns.ALBUM_ID + "=?",
new String[]{String.valueOf(albumId)}, getSongLoaderSortOrder(context)));
songs.subscribe(songs1 -> {
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.java b/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.java
index 94e08244..88e8fa57 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.java
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistLoader.java
@@ -22,7 +22,7 @@ public class ArtistLoader {
@NonNull
public static Observable getArtist(@NonNull final Context context, int artistId) {
- return Observable.create(e -> SongLoader.getSongs(SongLoader.makeSongCursor(
+ return Observable.create(e -> SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(
context,
AudioColumns.ARTIST_ID + "=?",
new String[]{String.valueOf(artistId)},
@@ -36,8 +36,8 @@ public class ArtistLoader {
@NonNull
public static Observable> getAllArtists(@NonNull final Context context) {
- return Observable.create(e -> SongLoader
- .getSongs(SongLoader.makeSongCursor(
+ return Observable.create(e -> SongLoader.Companion
+ .getSongs(SongLoader.Companion.makeSongCursor(
context,
null,
null,
@@ -51,7 +51,7 @@ public class ArtistLoader {
@NonNull
public static Observable> getArtists(@NonNull final Context context, String query) {
- return Observable.create(e -> SongLoader.getSongs(SongLoader.makeSongCursor(
+ return Observable.create(e -> SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(
context,
AudioColumns.ARTIST + " LIKE ?",
new String[]{"%" + query + "%"},
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistSongLoader.java b/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistSongLoader.java
index 1f1064bf..99be9459 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistSongLoader.java
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/ArtistSongLoader.java
@@ -17,12 +17,12 @@ public class ArtistSongLoader extends SongLoader {
@NonNull
public static Observable> getArtistSongList(@NonNull final Context context, final int artistId) {
- return getSongs(makeArtistSongCursor(context, artistId));
+ return Companion.getSongs(makeArtistSongCursor(context, artistId));
}
public static Cursor makeArtistSongCursor(@NonNull final Context context, final int artistId) {
try {
- return makeSongCursor(
+ return Companion.makeSongCursor(
context,
MediaStore.Audio.AudioColumns.ARTIST_ID + "=?",
new String[]{
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.java b/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.java
index 49e0e4f7..34f9b059 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.java
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/GenreLoader.java
@@ -5,11 +5,11 @@ import android.database.Cursor;
import android.net.Uri;
import android.provider.BaseColumns;
import android.provider.MediaStore.Audio.Genres;
-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.model.Genre;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.PreferenceUtil;
@@ -30,7 +30,7 @@ public class GenreLoader {
return getSongsWithNoGenre(context);
}
- return SongLoader.getSongs(makeGenreSongCursor(context, genreId));
+ return SongLoader.Companion.getSongs(makeGenreSongCursor(context, genreId));
}
@NonNull
@@ -46,11 +46,11 @@ public class GenreLoader {
private static Observable> getSongsWithNoGenre(@NonNull final Context context) {
String selection = BaseColumns._ID + " NOT IN " +
"(SELECT " + Genres.Members.AUDIO_ID + " FROM audio_genres_map)";
- return SongLoader.getSongs(SongLoader.makeSongCursor(context, selection, null));
+ return SongLoader.Companion.getSongs(SongLoader.Companion.makeSongCursor(context, selection, null));
}
private static boolean hasSongsWithNoGenre(@NonNull final Context context) {
- final Cursor allSongsCursor = SongLoader.makeSongCursor(context, null, null);
+ final Cursor allSongsCursor = SongLoader.Companion.makeSongCursor(context, null, null);
final Cursor allSongsWithGenreCursor = makeAllSongsWithGenreCursor(context);
if (allSongsCursor == null || allSongsWithGenreCursor == 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().getSongSortOrder());
+ SongLoader.Companion.getBASE_PROJECTION(), SongLoader.BASE_SELECTION, null, PreferenceUtil.getInstance().getSongSortOrder());
} catch (SecurityException e) {
return null;
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.java b/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.java
index 7a7d37c5..2de6083d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.java
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/LastAddedSongsLoader.java
@@ -21,13 +21,13 @@ public class LastAddedSongsLoader {
@NonNull
public static Observable> getLastAddedSongs(@NonNull Context context) {
- return SongLoader.getSongs(makeLastAddedCursor(context));
+ return SongLoader.Companion.getSongs(makeLastAddedCursor(context));
}
public static Cursor makeLastAddedCursor(@NonNull final Context context) {
long cutoff = PreferenceUtil.getInstance().getLastAddedCutoff();
- return SongLoader.makeSongCursor(
+ return SongLoader.Companion.makeSongCursor(
context,
MediaStore.Audio.Media.DATE_ADDED + ">?",
new String[]{String.valueOf(cutoff)},
diff --git a/app/src/main/java/code/name/monkey/retromusic/loaders/SearchLoader.java b/app/src/main/java/code/name/monkey/retromusic/loaders/SearchLoader.java
index 46880686..7117e7db 100644
--- a/app/src/main/java/code/name/monkey/retromusic/loaders/SearchLoader.java
+++ b/app/src/main/java/code/name/monkey/retromusic/loaders/SearchLoader.java
@@ -14,7 +14,7 @@ public class SearchLoader {
ArrayList