diff --git a/app/build.gradle b/app/build.gradle index 1910568c..b3ce868f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,8 +32,8 @@ android { vectorDrawables.useSupportLibrary = true applicationId "code.name.monkey.retromusic" - versionCode 297 - versionName '3.1.240' + versionCode 299 + versionName '3.1.250' multiDexEnabled true diff --git a/app/src/main/assets/retro-changelog.html b/app/src/main/assets/retro-changelog.html index 5fb28570..91f09828 100644 --- a/app/src/main/assets/retro-changelog.html +++ b/app/src/main/assets/retro-changelog.html @@ -1 +1 @@ -

Subscribe to PewDiePie 👊

v3.1.240

v3.1.200

v3.0.570

If you see entire app white or dark or black select same theme in settings to fix

FAQ's

*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.

\ No newline at end of file +

v3.1.240

v3.1.200

v3.0.570

If you see entire app white or dark or black select same theme in settings to fix

FAQ's

*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.

\ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.kt index 0cbe739c..e5525a6b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.kt @@ -98,7 +98,7 @@ class BlacklistFolderChooserDialog : DialogFragment() { return MaterialDialog(activity!!).show { title(text = parentFolder!!.absolutePath) listItems(items = contentsArray(), waitForPositiveButton = false) { dialog, index, text -> - onSelection(dialog, index, text) + onSelection(index) } noAutoDismiss() positiveButton(R.string.add_action) { @@ -111,7 +111,7 @@ class BlacklistFolderChooserDialog : DialogFragment() { } } - private fun onSelection(materialDialog: MaterialDialog, i: Int, s: String) { + private fun onSelection(i: Int) { if (canGoUp && i == 0) { parentFolder = parentFolder!!.parentFile if (parentFolder!!.absolutePath == "/storage/emulated") { @@ -139,7 +139,7 @@ class BlacklistFolderChooserDialog : DialogFragment() { dialog?.apply { setTitle(parentFolder!!.absolutePath) listItems(items = contentsArray()) { dialog, index, text -> - onSelection(dialog, index, text) + onSelection(index) } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt index d0bcce92..a25a5613 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/RemoveFromPlaylistDialog.kt @@ -56,7 +56,9 @@ class RemoveFromPlaylistDialog : RoundedBottomSheetDialogFragment() { text = content setTextColor(ThemeStore.textColorSecondary(context)) setOnClickListener { - PlaylistsUtil.removeFromPlaylist(activity!!, songs as ArrayList) + val playlistSongs = ArrayList() + playlistSongs.addAll(songs as ArrayList) + PlaylistsUtil.removeFromPlaylist(activity!!, playlistSongs) dismiss() } } diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt index cbda4e80..b401fd21 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt @@ -39,9 +39,9 @@ class SongShareDialog : RoundedBottomSheetDialogFragment() { @SuppressLint("StringFormatInvalid") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - val song = arguments!!.getParcelable("song") - dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!)) + val song: Song = arguments!!.getParcelable("song") ?: return + dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!)) audioText.apply { text = getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName) setTextColor(ThemeStore.textColorSecondary(context!!)) diff --git a/app/src/main/java/code/name/monkey/retromusic/glide/artistimage/ArtistImageLoader.kt b/app/src/main/java/code/name/monkey/retromusic/glide/artistimage/ArtistImageLoader.kt index fadbea9c..4e544005 100644 --- a/app/src/main/java/code/name/monkey/retromusic/glide/artistimage/ArtistImageLoader.kt +++ b/app/src/main/java/code/name/monkey/retromusic/glide/artistimage/ArtistImageLoader.kt @@ -41,7 +41,7 @@ import java.util.concurrent.TimeUnit class ArtistImage(val artistName: String, val skipOkHttpCache: Boolean) -class ArtistImageFetcher(private val context: Context, private val lastFMRestClient: LastFMRestClient, private val okHttp: OkHttpClient, private val model: ArtistImage, width: Int, height: Int) : DataFetcher { +class ArtistImageFetcher(private val context: Context, private val lastFMRestClient: LastFMRestClient, private val okHttp: OkHttpClient, private val model: ArtistImage) : DataFetcher { @Volatile private var isCancelled: Boolean = false private var call: Call? = null @@ -120,7 +120,7 @@ class ArtistImageFetcher(private val context: Context, private val lastFMRestCli class ArtistImageLoader(private val context: Context, private val lastFMClient: LastFMRestClient, private val okhttp: OkHttpClient) : ModelLoader { override fun buildLoadData(model: ArtistImage, width: Int, height: Int, options: Options): ModelLoader.LoadData? { - return ModelLoader.LoadData(ObjectKey(model.artistName), ArtistImageFetcher(context, lastFMClient, okhttp, model, width, height)) + return ModelLoader.LoadData(ObjectKey(model.artistName), ArtistImageFetcher(context, lastFMClient, okhttp, model)) } override fun handles(model: ArtistImage): Boolean { diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt b/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt index 064c57f8..cc2063ad 100644 --- a/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt +++ b/app/src/main/java/code/name/monkey/retromusic/helper/menu/PlaylistMenuHelper.kt @@ -14,17 +14,14 @@ package code.name.monkey.retromusic.helper.menu + import android.app.Activity import android.content.Context -import androidx.appcompat.app.AppCompatActivity import android.view.MenuItem import android.widget.Toast - - -import java.util.ArrayList - -import code.name.monkey.retromusic.R +import androidx.appcompat.app.AppCompatActivity import code.name.monkey.retromusic.App +import code.name.monkey.retromusic.R import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog import code.name.monkey.retromusic.dialogs.DeletePlaylistDialog import code.name.monkey.retromusic.dialogs.RenamePlaylistDialog @@ -35,6 +32,7 @@ import code.name.monkey.retromusic.model.AbsCustomPlaylist import code.name.monkey.retromusic.model.Playlist import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.util.PlaylistsUtil +import java.util.* object PlaylistMenuHelper { diff --git a/app/src/main/java/code/name/monkey/retromusic/model/AbsCustomPlaylist.java b/app/src/main/java/code/name/monkey/retromusic/model/AbsCustomPlaylist.java index 085c9397..07ea3140 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/AbsCustomPlaylist.java +++ b/app/src/main/java/code/name/monkey/retromusic/model/AbsCustomPlaylist.java @@ -12,14 +12,32 @@ * See the GNU General Public License for more details. */ -package code.name.monkey.retromusic.model +package code.name.monkey.retromusic.model; -import android.content.Context -import io.reactivex.Observable -import java.util.* +import android.content.Context; +import android.os.Parcel; -abstract class AbsCustomPlaylist(id: Int, name: String) : Playlist(id, name) { +import java.util.ArrayList; - abstract fun getSongs(context: Context): Observable> +import androidx.annotation.NonNull; +import io.reactivex.Observable; + +/** + * @author Karim Abou Zeid (kabouzeid) + */ + +public abstract class AbsCustomPlaylist extends Playlist { + public AbsCustomPlaylist(int id, String name) { + super(id, name); + } + + public AbsCustomPlaylist() { + } + + public AbsCustomPlaylist(Parcel in) { + super(in); + } + + @NonNull + public abstract Observable> getSongs(Context context); } - diff --git a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/AbsSmartPlaylist.java b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/AbsSmartPlaylist.java index 3d94b86b..cc1f98d6 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/AbsSmartPlaylist.java +++ b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/AbsSmartPlaylist.java @@ -16,15 +16,13 @@ package code.name.monkey.retromusic.model.smartplaylist; import android.content.Context; import android.os.Parcel; -import android.support.annotation.DrawableRes; -import android.support.annotation.Nullable; -import com.kabouzeid.gramophone.R; -import com.kabouzeid.gramophone.model.AbsCustomPlaylist; +import androidx.annotation.DrawableRes; +import androidx.annotation.Nullable; +import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.model.AbsCustomPlaylist; + -/** - * @author Karim Abou Zeid (kabouzeid) - */ public abstract class AbsSmartPlaylist extends AbsCustomPlaylist { @DrawableRes public final int iconRes; diff --git a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/HistoryPlaylist.java b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/HistoryPlaylist.java index bcc9e38f..94970096 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/HistoryPlaylist.java +++ b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/HistoryPlaylist.java @@ -16,45 +16,21 @@ package code.name.monkey.retromusic.model.smartplaylist; import android.content.Context; import android.os.Parcel; -import android.support.annotation.NonNull; - -import com.kabouzeid.gramophone.R; -import com.kabouzeid.gramophone.loader.TopAndRecentlyPlayedTracksLoader; -import com.kabouzeid.gramophone.model.Song; -import com.kabouzeid.gramophone.provider.HistoryStore; import java.util.ArrayList; +import androidx.annotation.NonNull; +import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.loaders.TopAndRecentlyPlayedTracksLoader; +import code.name.monkey.retromusic.model.Song; +import code.name.monkey.retromusic.providers.HistoryStore; +import io.reactivex.Observable; + /** * @author Karim Abou Zeid (kabouzeid) */ public class HistoryPlaylist extends AbsSmartPlaylist { - public HistoryPlaylist(@NonNull Context context) { - super(context.getString(R.string.history), R.drawable.ic_access_time_white_24dp); - } - - @NonNull - @Override - public ArrayList getSongs(@NonNull Context context) { - return TopAndRecentlyPlayedTracksLoader.getRecentlyPlayedTracks(context); - } - - @Override - public void clear(@NonNull Context context) { - HistoryStore.getInstance(context).clear(); - } - - - @Override - public int describeContents() { - return 0; - } - - protected HistoryPlaylist(Parcel in) { - super(in); - } - public static final Creator CREATOR = new Creator() { public HistoryPlaylist createFromParcel(Parcel source) { return new HistoryPlaylist(source); @@ -64,4 +40,28 @@ public class HistoryPlaylist extends AbsSmartPlaylist { return new HistoryPlaylist[size]; } }; + + public HistoryPlaylist(@NonNull Context context) { + super(context.getString(R.string.history), R.drawable.ic_access_time_white_24dp); + } + + protected HistoryPlaylist(Parcel in) { + super(in); + } + + @NonNull + @Override + public Observable> getSongs(@NonNull Context context) { + return TopAndRecentlyPlayedTracksLoader.INSTANCE.getRecentlyPlayedTracks(context); + } + + @Override + public void clear(@NonNull Context context) { + HistoryStore.getInstance(context).clear(); + } + + @Override + public int describeContents() { + return 0; + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/LastAddedPlaylist.java b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/LastAddedPlaylist.java index 3b7200dc..b21e4be7 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/LastAddedPlaylist.java +++ b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/LastAddedPlaylist.java @@ -16,27 +16,40 @@ package code.name.monkey.retromusic.model.smartplaylist; import android.content.Context; import android.os.Parcel; -import android.support.annotation.NonNull; - -import com.kabouzeid.gramophone.R; -import com.kabouzeid.gramophone.loader.LastAddedLoader; -import com.kabouzeid.gramophone.model.Song; import java.util.ArrayList; -/** - * @author Karim Abou Zeid (kabouzeid) - */ +import androidx.annotation.NonNull; +import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.loaders.LastAddedSongsLoader; +import code.name.monkey.retromusic.model.Song; +import io.reactivex.Observable; + + public class LastAddedPlaylist extends AbsSmartPlaylist { + public static final Creator CREATOR = new Creator() { + public LastAddedPlaylist createFromParcel(Parcel source) { + return new LastAddedPlaylist(source); + } + + public LastAddedPlaylist[] newArray(int size) { + return new LastAddedPlaylist[size]; + } + }; + public LastAddedPlaylist(@NonNull Context context) { super(context.getString(R.string.last_added), R.drawable.ic_library_add_white_24dp); } + protected LastAddedPlaylist(Parcel in) { + super(in); + } + @NonNull @Override - public ArrayList getSongs(@NonNull Context context) { - return LastAddedLoader.getLastAddedSongs(context); + public Observable> getSongs(@NonNull Context context) { + return LastAddedSongsLoader.INSTANCE.getLastAddedSongs(context); } @Override @@ -52,18 +65,4 @@ public class LastAddedPlaylist extends AbsSmartPlaylist { public int describeContents() { return 0; } - - protected LastAddedPlaylist(Parcel in) { - super(in); - } - - public static final Creator CREATOR = new Creator() { - public LastAddedPlaylist createFromParcel(Parcel source) { - return new LastAddedPlaylist(source); - } - - public LastAddedPlaylist[] newArray(int size) { - return new LastAddedPlaylist[size]; - } - }; } diff --git a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/MyTopTracksPlaylist.java b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/MyTopTracksPlaylist.java index 3e7edb45..5d58b922 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/MyTopTracksPlaylist.java +++ b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/MyTopTracksPlaylist.java @@ -16,45 +16,21 @@ package code.name.monkey.retromusic.model.smartplaylist; import android.content.Context; import android.os.Parcel; -import android.support.annotation.NonNull; - -import com.kabouzeid.gramophone.R; -import com.kabouzeid.gramophone.loader.TopAndRecentlyPlayedTracksLoader; -import com.kabouzeid.gramophone.model.Song; -import com.kabouzeid.gramophone.provider.SongPlayCountStore; import java.util.ArrayList; +import androidx.annotation.NonNull; +import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.loaders.TopAndRecentlyPlayedTracksLoader; +import code.name.monkey.retromusic.model.Song; +import code.name.monkey.retromusic.providers.SongPlayCountStore; +import io.reactivex.Observable; + /** * @author Karim Abou Zeid (kabouzeid) */ public class MyTopTracksPlaylist extends AbsSmartPlaylist { - public MyTopTracksPlaylist(@NonNull Context context) { - super(context.getString(R.string.my_top_tracks), R.drawable.ic_trending_up_white_24dp); - } - - @NonNull - @Override - public ArrayList getSongs(@NonNull Context context) { - return TopAndRecentlyPlayedTracksLoader.getTopTracks(context); - } - - @Override - public void clear(@NonNull Context context) { - SongPlayCountStore.getInstance(context).clear(); - } - - - @Override - public int describeContents() { - return 0; - } - - protected MyTopTracksPlaylist(Parcel in) { - super(in); - } - public static final Creator CREATOR = new Creator() { public MyTopTracksPlaylist createFromParcel(Parcel source) { return new MyTopTracksPlaylist(source); @@ -64,4 +40,28 @@ public class MyTopTracksPlaylist extends AbsSmartPlaylist { return new MyTopTracksPlaylist[size]; } }; + + public MyTopTracksPlaylist(@NonNull Context context) { + super(context.getString(R.string.my_top_tracks), R.drawable.ic_trending_up_white_24dp); + } + + protected MyTopTracksPlaylist(Parcel in) { + super(in); + } + + @NonNull + @Override + public Observable> getSongs(@NonNull Context context) { + return TopAndRecentlyPlayedTracksLoader.INSTANCE.getTopTracks(context); + } + + @Override + public void clear(@NonNull Context context) { + SongPlayCountStore.getInstance(context).clear(); + } + + @Override + public int describeContents() { + return 0; + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/ShuffleAllPlaylist.java b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/ShuffleAllPlaylist.java index 67499473..e990e7b1 100644 --- a/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/ShuffleAllPlaylist.java +++ b/app/src/main/java/code/name/monkey/retromusic/model/smartplaylist/ShuffleAllPlaylist.java @@ -16,24 +16,39 @@ package code.name.monkey.retromusic.model.smartplaylist; import android.content.Context; import android.os.Parcel; -import android.support.annotation.NonNull; - -import com.kabouzeid.gramophone.R; -import com.kabouzeid.gramophone.loader.SongLoader; -import com.kabouzeid.gramophone.model.Song; import java.util.ArrayList; +import androidx.annotation.NonNull; +import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.loaders.SongLoader; +import code.name.monkey.retromusic.model.Song; +import io.reactivex.Observable; + public class ShuffleAllPlaylist extends AbsSmartPlaylist { + public static final Creator CREATOR = new Creator() { + public ShuffleAllPlaylist createFromParcel(Parcel source) { + return new ShuffleAllPlaylist(source); + } + + public ShuffleAllPlaylist[] newArray(int size) { + return new ShuffleAllPlaylist[size]; + } + }; + public ShuffleAllPlaylist(@NonNull Context context) { super(context.getString(R.string.action_shuffle_all), R.drawable.ic_shuffle_white_24dp); } + protected ShuffleAllPlaylist(Parcel in) { + super(in); + } + @NonNull @Override - public ArrayList getSongs(@NonNull Context context) { - return SongLoader.getAllSongs(context); + public Observable> getSongs(@NonNull Context context) { + return SongLoader.INSTANCE.getAllSongs(context); } @Override @@ -45,18 +60,4 @@ public class ShuffleAllPlaylist extends AbsSmartPlaylist { public int describeContents() { return 0; } - - protected ShuffleAllPlaylist(Parcel in) { - super(in); - } - - public static final Creator CREATOR = new Creator() { - public ShuffleAllPlaylist createFromParcel(Parcel source) { - return new ShuffleAllPlaylist(source); - } - - public ShuffleAllPlaylist[] newArray(int size) { - return new ShuffleAllPlaylist[size]; - } - }; } diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt index 56fb901b..4f40f3ce 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/BlacklistPreferenceDialog.kt @@ -21,6 +21,7 @@ import android.text.Html import android.util.AttributeSet import androidx.fragment.app.DialogFragment import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference +import code.name.monkey.retromusic.R import code.name.monkey.retromusic.dialogs.BlacklistFolderChooserDialog import code.name.monkey.retromusic.providers.BlacklistStore import com.afollestad.materialdialogs.MaterialDialog @@ -60,9 +61,9 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog return MaterialDialog(context!!).show { title(code.name.monkey.retromusic.R.string.blacklist) positiveButton(android.R.string.ok) { - dismiss(); + dismiss() } - neutralButton(code.name.monkey.retromusic.R.string.clear_action) { + neutralButton(text = getString(R.string.clear_action)) { MaterialDialog(context).show { title(code.name.monkey.retromusic.R.string.clear_blacklist) message(code.name.monkey.retromusic.R.string.do_you_want_to_clear_the_blacklist) @@ -73,7 +74,7 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog negativeButton(android.R.string.cancel) } } - negativeButton(code.name.monkey.retromusic.R.string.add_action) { + negativeButton(R.string.add_action) { val dialog = BlacklistFolderChooserDialog.create() dialog.setCallback(this@BlacklistPreferenceDialog) dialog.show(childFragmentManager, "FOLDER_CHOOSER"); diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt index 8ab7d615..8ff79c0b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt @@ -38,12 +38,12 @@ class MaterialListPreference : ListPreference { constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) override fun getDialogLayoutResource(): Int { - return mLayoutRes; + return mLayoutRes } - override fun onGetDefaultValue(a: TypedArray, index: Int): Any { + override fun onGetDefaultValue(a: TypedArray, index: Int): String { // Default value from attribute. Fallback value is set to 0. - return a.getString(index) + return a.getString(index)!! } fun setCustomValue(any: Any) { diff --git a/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt b/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt index d559b3ac..994eaa28 100644 --- a/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt +++ b/app/src/main/java/code/name/monkey/retromusic/providers/interfaces/Repository.kt @@ -17,7 +17,6 @@ package code.name.monkey.retromusic.providers.interfaces import code.name.monkey.retromusic.model.* import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist import io.reactivex.Observable -import java.util.* import kotlin.collections.ArrayList /** diff --git a/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java b/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java index 795ba4f5..a35c64b2 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java +++ b/app/src/main/java/code/name/monkey/retromusic/service/MusicService.java @@ -422,7 +422,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP playlistSongs = ((AbsCustomPlaylist) playlist).getSongs(getApplicationContext()).blockingFirst(); } else { //noinspection unchecked - playlistSongs = PlaylistSongsLoader.INSTANCE.getPlaylistSongList(getApplicationContext(), playlist.getId()).blockingFirst(); + playlistSongs = PlaylistSongsLoader.INSTANCE.getPlaylistSongList(getApplicationContext(), playlist.id).blockingFirst(); } if (!playlistSongs.isEmpty()) { if (shuffleMode == SHUFFLE_MODE_SHUFFLE) { diff --git a/app/src/main/java/code/name/monkey/retromusic/service/WearBrowserService.java b/app/src/main/java/code/name/monkey/retromusic/service/WearBrowserService.java index 94217386..5ef1df4b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/WearBrowserService.java +++ b/app/src/main/java/code/name/monkey/retromusic/service/WearBrowserService.java @@ -277,8 +277,8 @@ public class WearBrowserService extends MediaBrowserService { int size = PlaylistSongsLoader.INSTANCE.getPlaylistSongList(mContext, playlist).blockingFirst().size(); String songCount = String.format("%d %s", size, size > 1 ? "Songs" : "Song"); fillMediaItems(mediaItems, - Integer.toString(TYPE_PLAYLIST_ALL_SONGS) + Long.toString(playlist.getId()), - playlist.getName(), + Integer.toString(TYPE_PLAYLIST_ALL_SONGS) + Long.toString(playlist.id), + playlist.name, songCount, Uri.parse("android.resource://code.name.monkey.retromusic/drawable/ic_queue_music_white_24dp"), MediaBrowser.MediaItem.FLAG_BROWSABLE); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/BugReportActivity.kt b/app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/BugReportActivity.kt index 1b99d30c..b24df74c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/BugReportActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/BugReportActivity.kt @@ -206,7 +206,7 @@ open class BugReportActivity : AbsThemeActivity() { val bugDescription = inputDescription!!.text!!.toString() val extraInfo = ExtraInfo() - onSaveExtraInfo(extraInfo) + onSaveExtraInfo() val report = Report(bugTitle, bugDescription, deviceInfo, extraInfo) val target = GithubTarget("h4h13", "RetroMusicPlayer") @@ -214,7 +214,7 @@ open class BugReportActivity : AbsThemeActivity() { ReportIssueAsyncTask.report(this, report, target, login) } - private fun onSaveExtraInfo(extraInfo: ExtraInfo) {} + private fun onSaveExtraInfo() {} override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/tageditor/SongTagEditorActivity.kt b/app/src/main/java/code/name/monkey/retromusic/ui/activities/tageditor/SongTagEditorActivity.kt index d7504337..705feaed 100755 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/tageditor/SongTagEditorActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/tageditor/SongTagEditorActivity.kt @@ -98,7 +98,7 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher { override fun getSongPaths(): List { val paths = ArrayList(1) - paths.add(SongLoader.getSong(this, id).blockingFirst().data!!) + paths.add(SongLoader.getSong(this, id).blockingFirst().data) return paths } diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/adapter/album/AlbumAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/ui/adapter/album/AlbumAdapter.kt index 4bd3e629..a749fb16 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/adapter/album/AlbumAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/adapter/album/AlbumAdapter.kt @@ -212,7 +212,6 @@ open class AlbumAdapter(protected val activity: AppCompatActivity, } companion object { - - val TAG = AlbumAdapter::class.java.simpleName!! + val TAG: String = AlbumAdapter::class.java.simpleName } } diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/PlaylistsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/PlaylistsFragment.kt index b45957a4..3b63ccb3 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/PlaylistsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/PlaylistsFragment.kt @@ -1,12 +1,9 @@ package code.name.monkey.retromusic.ui.fragments.mainactivity import android.os.Bundle -import androidx.recyclerview.widget.LinearLayoutManager import android.view.Menu import android.view.MenuInflater - -import java.util.ArrayList - +import androidx.recyclerview.widget.LinearLayoutManager import code.name.monkey.retromusic.R import code.name.monkey.retromusic.model.Playlist import code.name.monkey.retromusic.mvp.contract.PlaylistContract @@ -14,6 +11,7 @@ import code.name.monkey.retromusic.mvp.presenter.PlaylistPresenter import code.name.monkey.retromusic.ui.adapter.playlist.PlaylistAdapter import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewFragment import code.name.monkey.retromusic.util.PreferenceUtil +import java.util.* class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment(), PlaylistContract.PlaylistView { diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/SongsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/SongsFragment.kt index 412eb42c..e444bf35 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/SongsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/SongsFragment.kt @@ -43,7 +43,7 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment activity!!.onBackPressed() } + setNavigationOnClickListener { activity!!.onBackPressed() } setOnMenuItemClickListener(this@ClassicPlayerFragment) } } diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/normal/PlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/normal/PlayerFragment.kt index d58d9eec..668369b3 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/normal/PlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/normal/PlayerFragment.kt @@ -81,7 +81,6 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks { display?.getMetrics(outMetrics) val density = resources.displayMetrics.density - val dpHeight = outMetrics.heightPixels / density val dpWidth = outMetrics.widthPixels / density playerAlbumCoverContainer?.layoutParams?.height = RetroUtil.convertDpToPixel((dpWidth - getCutOff()), context!!).toInt() diff --git a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java index 841f8995..6c3b621c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java @@ -366,16 +366,16 @@ public class MusicUtil { public static void toggleFavorite(@NonNull final Context context, @NonNull final Song song) { if (isFavorite(context, song)) { - PlaylistsUtil.removeFromPlaylist(context, song, getFavoritesPlaylist(context).blockingFirst().getId()); + PlaylistsUtil.removeFromPlaylist(context, song, getFavoritesPlaylist(context).blockingFirst().id); } else { - PlaylistsUtil.addToPlaylist(context, song, getOrCreateFavoritesPlaylist(context).blockingFirst().getId(), + PlaylistsUtil.addToPlaylist(context, song, getOrCreateFavoritesPlaylist(context).blockingFirst().id, false); } } public static boolean isFavoritePlaylist(@NonNull final Context context, @NonNull final Playlist playlist) { - return playlist.getName() != null && playlist.getName().equals(context.getString(R.string.favorites)); + return playlist.name != null && playlist.name.equals(context.getString(R.string.favorites)); } private static Observable getFavoritesPlaylist(@NonNull final Context context) { @@ -397,7 +397,7 @@ public class MusicUtil { //getFavoritesPlaylist(context).blockingFirst().id.subscribe(MusicUtil::setPlaylist); //return PlaylistsUtil.doPlaylistContains(context, getFavoritesPlaylist(context).blockingFirst().id, song.id); return PlaylistsUtil - .doPlaylistContains(context, getFavoritesPlaylist(context).blockingFirst().getId(), song.getId()); + .doPlaylistContains(context, getFavoritesPlaylist(context).blockingFirst().id, song.getId()); } public static boolean isArtistNameUnknown(@Nullable String artistName) { diff --git a/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java index 005e373e..07631c1f 100755 --- a/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/NavigationUtil.java @@ -19,7 +19,6 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.media.audiofx.AudioEffect; -import android.view.View; import android.widget.Toast; import androidx.annotation.NonNull; @@ -76,7 +75,7 @@ public class NavigationUtil { intent.putExtra(ArtistDetailActivity.EXTRA_ARTIST_ID, i); //noinspection unchecked ActivityCompat.startActivity(activity, intent, - ActivityOptionsCompat.makeSceneTransitionAnimation(activity, (Pair) null).toBundle()); + ActivityOptionsCompat.makeSceneTransitionAnimation(activity, null).toBundle()); } public static void goToPlaylistNew(@NonNull Activity activity, @NonNull Playlist playlist) { diff --git a/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java index b3096f24..5fc7364b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/PlaylistsUtil.java @@ -99,7 +99,7 @@ public class PlaylistsUtil { final StringBuilder selection = new StringBuilder(); selection.append(MediaStore.Audio.Playlists._ID + " IN ("); for (int i = 0; i < playlists.size(); i++) { - selection.append(playlists.get(i).getId()); + selection.append(playlists.get(i).id); if (i < playlists.size() - 1) { selection.append(","); } diff --git a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt index 30ef9ec9..f07a9b54 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt +++ b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt @@ -120,7 +120,7 @@ object ViewUtil { val top = v.top + ty val bottom = v.bottom + ty - return x >= left && x <= right && y >= top && y <= bottom + return x in left..right && y >= top && y <= bottom } fun setUpFastScrollRecyclerViewColor(context: Context, diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATESwitchPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATESwitchPreference.kt index a2b9c9be..f8958c27 100644 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATESwitchPreference.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATESwitchPreference.kt @@ -16,8 +16,6 @@ import code.name.monkey.appthemehelper.R import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.common.views.ATESwitch -import java.lang.reflect.Field - /** * @author Aidan Follestad (afollestad) */ @@ -26,23 +24,23 @@ class ATESwitchPreference : SwitchPreference { private var mSwitch: ATESwitch? = null constructor(context: Context) : super(context) { - init(context, null) + init() } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init() } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init() } @TargetApi(Build.VERSION_CODES.LOLLIPOP) constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { - init(context, attrs) + init() } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init() { layoutResource = R.layout.ate_preference_custom if (COMPAT_MODE) { widgetLayoutResource = R.layout.ate_preference_switch diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt index 2790d652..c30a6816 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEColorPreference.kt @@ -19,19 +19,19 @@ class ATEColorPreference(context: Context, attrs: AttributeSet?, defStyleAttr: I private var border: Int = 0 constructor(context: Context) : this(context, null, 0) { - init(context, null) + init() } constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) { - init(context, attrs) + init() } init { - init(context, attrs) + init() } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init() { layoutResource = R.layout.ate_preference_custom_support widgetLayoutResource = R.layout.ate_preference_color isPersistent = false diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt index 2ee1a45e..dd69f8a0 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt @@ -14,23 +14,23 @@ import code.name.monkey.appthemehelper.R class ATESwitchPreference : CheckBoxPreference { constructor(context: Context) : super(context) { - init(context, null) + init() } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init() } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init() } @TargetApi(Build.VERSION_CODES.LOLLIPOP) constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { - init(context, attrs) + init() } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init() { layoutResource = R.layout.ate_preference_custom_support widgetLayoutResource = R.layout.ate_preference_switch_support } diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEEditText.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEEditText.kt index 106ca768..cf86a399 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEEditText.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEEditText.kt @@ -14,18 +14,18 @@ import code.name.monkey.appthemehelper.ThemeStore class ATEEditText : AppCompatEditText { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { ATH.setTint(this, ThemeStore.accentColor(context)) setTextColor(ThemeStore.textColorPrimary(context)) } diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEProgressBar.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEProgressBar.kt index 76f9fa9d..36facb3c 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEProgressBar.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEProgressBar.kt @@ -16,23 +16,23 @@ import code.name.monkey.appthemehelper.ThemeStore class ATEProgressBar : ProgressBar { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } @TargetApi(Build.VERSION_CODES.LOLLIPOP) constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { ATH.setTint(this, ThemeStore.accentColor(context)) } } \ No newline at end of file diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESecondaryTextView.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESecondaryTextView.kt index e2f08e55..8a379ff8 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESecondaryTextView.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESecondaryTextView.kt @@ -12,18 +12,18 @@ import code.name.monkey.appthemehelper.ThemeStore class ATESecondaryTextView : AppCompatTextView { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { setTextColor(ThemeStore.textColorSecondary(context)) } } diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEStockSwitch.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEStockSwitch.kt index 15758822..bbf78952 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEStockSwitch.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATEStockSwitch.kt @@ -15,18 +15,18 @@ import code.name.monkey.appthemehelper.ThemeStore class ATEStockSwitch : Switch { constructor(context: Context) : super(context) { - init(context, null) + init(context) } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { - init(context, attrs) + init(context) } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { - init(context, attrs) + init(context) } - private fun init(context: Context, attrs: AttributeSet?) { + private fun init(context: Context) { ATH.setTint(this, ThemeStore.accentColor(context)) } diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ATHUtil.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ATHUtil.kt index 20c9c9e9..9c14ac96 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ATHUtil.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ATHUtil.kt @@ -23,15 +23,6 @@ object ATHUtil { } } - fun isInClassPath(clsName: String): Boolean { - try { - return inClassPath(clsName) != null - } catch (t: Throwable) { - return false - } - - } - fun inClassPath(clsName: String): Class<*> { try { return Class.forName(clsName) diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ViewUtil.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ViewUtil.kt index d4f8c902..69738c45 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ViewUtil.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/ViewUtil.kt @@ -3,27 +3,19 @@ package code.name.monkey.appthemehelper.util import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.TransitionDrawable -import android.os.Build -import androidx.annotation.ColorInt import android.view.View import android.view.ViewTreeObserver +import androidx.annotation.ColorInt object ViewUtil { fun removeOnGlobalLayoutListener(v: View, listener: ViewTreeObserver.OnGlobalLayoutListener) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { - v.viewTreeObserver.removeGlobalOnLayoutListener(listener) - } else { - v.viewTreeObserver.removeOnGlobalLayoutListener(listener) - } + v.viewTreeObserver.removeOnGlobalLayoutListener(listener) } fun setBackgroundCompat(view: View, drawable: Drawable?) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) - view.background = drawable - else - view.setBackgroundDrawable(drawable) + view.background = drawable } fun setBackgroundTransition(view: View, newDrawable: Drawable): TransitionDrawable {