diff --git a/app/build.gradle b/app/build.gradle
index 31d99ef6..5948be51 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,8 +13,8 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
- versionCode 366
- versionName '3.4.000-beta05'
+ versionCode 367
+ versionName '3.4.000-beta10'
multiDexEnabled true
@@ -102,9 +102,9 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.multidex:multidex:2.0.1'
- implementation 'androidx.fragment:fragment:1.2.0-alpha02'
+ implementation 'androidx.fragment:fragment:1.2.0-alpha03'
implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'androidx.recyclerview:recyclerview:1.1.0-beta03'
+ implementation 'androidx.recyclerview:recyclerview:1.1.0-beta04'
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.palette:palette:1.0.0"
@@ -113,8 +113,8 @@ dependencies {
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
- implementation 'com.google.android.material:material:1.1.0-alpha09'
- implementation 'com.google.android.play:core:1.6.1'
+ implementation 'com.google.android.material:material:1.1.0-alpha10'
+ implementation 'com.google.android.play:core:1.6.3'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
@@ -158,6 +158,5 @@ dependencies {
kapt 'com.google.dagger:dagger-compiler:2.23.1'
implementation project(':appthemehelper')
- debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 70872001..79ab23ab 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -124,13 +124,11 @@
android:immersive="true"
android:label="@string/error"
android:launchMode="singleInstance"
- android:screenOrientation="portrait"
android:theme="@style/ErrorHandlingTheme" />
diff --git a/app/src/main/java/code/name/monkey/retromusic/App.kt b/app/src/main/java/code/name/monkey/retromusic/App.kt
index 3fca1efa..c739c7ef 100644
--- a/app/src/main/java/code/name/monkey/retromusic/App.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/App.kt
@@ -24,7 +24,6 @@ import code.name.monkey.retromusic.dagger.MusicComponent
import code.name.monkey.retromusic.dagger.module.AppModule
import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.TransactionDetails
-import com.google.android.play.core.missingsplits.MissingSplitsManagerFactory
class App : MultiDexApplication() {
@@ -32,9 +31,9 @@ class App : MultiDexApplication() {
lateinit var billingProcessor: BillingProcessor
override fun onCreate() {
- if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
+ /* if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
return
- }
+ }*/
super.onCreate()
instance = this
musicComponent = DaggerMusicComponent.builder()
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
index 33fe08fb..cb71c533 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt
@@ -33,7 +33,6 @@ import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder
-import code.name.monkey.retromusic.loaders.ArtistLoader
import code.name.monkey.retromusic.misc.AppBarStateChangeListener
import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Artist
@@ -78,6 +77,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
setDrawUnderStatusBar()
setupWindowTransition()
super.onCreate(savedInstanceState)
+ App.musicComponent.inject(this)
toggleBottomNavigationView(true)
setLightNavigationBar(true)
setNavigationbarColorAuto()
@@ -102,7 +102,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
setOnClickListener { MusicPlayerRemote.openAndShuffleQueue(album.songs!!, true) }
}
- App.musicComponent?.inject(this)
+
albumDetailsPresenter.attachView(this)
if (intent.extras!!.containsKey(EXTRA_ALBUM_ID)) {
@@ -186,38 +186,11 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
loadAlbumCover()
simpleSongAdapter.swapDataSet(album.songs)
-
albumDetailsPresenter.loadMore(album.artistId)
}
private lateinit var artistImage: ImageView
- private fun loadMoreFrom(album: Album) {
- disposable.add(ArtistLoader.getArtistFlowable(this, album.artistId)
- .map {
-
- return@map it.albums!!
- }
- .map { it.filter { albumSearch -> albumSearch.id != album.id } }
- .subscribe {
- for (albumFinal in it) {
- if (albumFinal.id == album.id)
- println("$albumFinal -> $album")
- }
- if (it.isEmpty()) {
- return@subscribe
- }
- moreTitle.visibility = View.VISIBLE
- moreRecyclerView.visibility = View.VISIBLE
- moreTitle.text = String.format("More from %s", album.artistName)
-
- val albumAdapter = HorizontalAlbumAdapter(this, it as ArrayList, false, null)
- moreRecyclerView.layoutManager = GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false)
- moreRecyclerView.adapter = albumAdapter
-
- })
- }
-
override fun moreAlbums(albums: ArrayList) {
moreTitle.show()
moreRecyclerView.show()
@@ -237,6 +210,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView {
}
})
+
}
private fun loadAlbumCover() {
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
index b805c78b..4e921524 100755
--- a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt
@@ -79,16 +79,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
ActivityCompat.postponeEnterTransition(this)
-
- App.musicComponent.inject(this)
- artistDetailsPresenter.attachView(this)
-
- if (intent.extras!!.containsKey(EXTRA_ARTIST_ID)) {
- artistDetailsPresenter.loadArtist(intent.extras!!.getInt(EXTRA_ARTIST_ID))
- } else {
- finish()
- }
-
lastFMRestClient = LastFMRestClient(this)
setUpViews()
@@ -107,6 +97,15 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
biographyText.maxLines = 4
}
}
+
+ App.musicComponent.inject(this)
+ artistDetailsPresenter.attachView(this)
+
+ if (intent.extras!!.containsKey(EXTRA_ARTIST_ID)) {
+ artistDetailsPresenter.loadArtist(intent.extras!!.getInt(EXTRA_ARTIST_ID))
+ } else {
+ finish()
+ }
}
override fun onDestroy() {
@@ -203,14 +202,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
}
override fun artist(artist: Artist) {
- setArtist(artist)
- }
-
- private fun getArtist(): Artist {
- return this.artist
- }
-
- private fun setArtist(artist: Artist) {
if (artist.songCount <= 0) {
finish()
}
@@ -224,10 +215,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
text.text = String.format("%s • %s", MusicUtil.getArtistInfoString(this, artist), MusicUtil
.getReadableDurationString(MusicUtil.getTotalDuration(this, artist.songs)))
- //val songs = artist.songs.sortedWith(compareBy { it.title }) as ArrayList
songAdapter.swapDataSet(artist.songs)
-
- //val albums = artist.albums?.sortedWith(compareBy { it.artistName }) as ArrayList
albumAdapter.swapDataSet(artist.albums!!)
}
@@ -255,7 +243,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
// If the "lang" parameter is set and no biography is given, retry with default language
if (biography == null && lang != null) {
- loadBiography(getArtist().name, null)
+ loadBiography(artist.name, null)
}
}
@@ -293,7 +281,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView {
}
private fun handleSortOrderMenuItem(item: MenuItem): Boolean {
- val songs = getArtist().songs
+ val songs = artist.songs
when (item.itemId) {
android.R.id.home -> {
super.onBackPressed()
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
index 23ef2c57..45b58a8d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/LyricsActivity.kt
@@ -50,10 +50,10 @@ class LyricsActivity : AbsMusicServiceActivity(), View.OnClickListener, ViewPage
override fun onPageScrollStateChanged(state: Int) {
when (state) {
ViewPager.SCROLL_STATE_IDLE ->
- fab.show(true)
+ fab.show( )
ViewPager.SCROLL_STATE_DRAGGING,
ViewPager.SCROLL_STATE_SETTLING ->
- fab.hide(true)
+ fab.hide( )
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt
index ada47244..06af22be 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlayingQueueActivity.kt
@@ -92,9 +92,9 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
- clearQueue.shrink(true)
+ clearQueue.shrink( )
} else if (dy < 0) {
- clearQueue.extend(true)
+ clearQueue.extend( )
}
}
})
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt
index cf35da35..d7e937df 100644
--- a/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/SearchActivity.kt
@@ -95,9 +95,9 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
- keyboardPopup.shrink(true)
+ keyboardPopup.shrink()
} else if (dy < 0) {
- keyboardPopup.extend(true)
+ keyboardPopup.extend()
}
}
})
diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt
index 739ddf77..74c54d76 100755
--- a/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/activities/SettingsActivity.kt
@@ -1,6 +1,5 @@
package code.name.monkey.retromusic.activities
-import android.content.SharedPreferences
import android.os.Bundle
import android.view.MenuItem
import androidx.annotation.StringRes
@@ -11,11 +10,10 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
-import code.name.monkey.retromusic.util.PreferenceUtil
import kotlinx.android.synthetic.main.activity_settings.*
-class SettingsActivity : AbsBaseActivity(), SharedPreferences.OnSharedPreferenceChangeListener {
+class SettingsActivity : AbsBaseActivity() {
private val fragmentManager = supportFragmentManager
@@ -25,7 +23,6 @@ class SettingsActivity : AbsBaseActivity(), SharedPreferences.OnSharedPreference
setStatusbarColorAuto()
setNavigationbarColorAuto()
-
setLightNavigationBar(true)
setupToolbar()
@@ -84,23 +81,6 @@ class SettingsActivity : AbsBaseActivity(), SharedPreferences.OnSharedPreference
return super.onOptionsItemSelected(item)
}
- public override fun onPause() {
- super.onPause()
- PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this)
- }
-
- public override fun onResume() {
- super.onResume()
- PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this)
- }
-
- override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
- if (key == PreferenceUtil.PROFILE_IMAGE_PATH) {
- recreate()
- }
- }
-
-
companion object {
const val TAG: String = "SettingsActivity"
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/base/MediaEntryViewHolder.java b/app/src/main/java/code/name/monkey/retromusic/adapter/base/MediaEntryViewHolder.java
new file mode 100644
index 00000000..3d2b231e
--- /dev/null
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/base/MediaEntryViewHolder.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2019 Hemanth Savarala.
+ *
+ * Licensed under the GNU General Public License v3
+ *
+ * This is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by
+ * the Free Software Foundation either version 3 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ */
+
+package code.name.monkey.retromusic.adapter.base;
+
+import android.os.Build;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.google.android.material.card.MaterialCardView;
+
+import code.name.monkey.appthemehelper.ThemeStore;
+import code.name.monkey.retromusic.R;
+
+public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener {
+ @Nullable
+ public TextView title;
+
+ @Nullable
+ public TextView text;
+
+ @Nullable
+ public TextView time;
+
+ @Nullable
+ public TextView imageText;
+
+ @Nullable
+ public ViewGroup imageContainer;
+
+ @Nullable
+ public MaterialCardView imageContainerCard;
+
+ @Nullable
+ public View menu;
+
+ @Nullable
+ public View dragView;
+
+ @Nullable
+ public View paletteColorContainer;
+
+ @Nullable
+ public RecyclerView recyclerView;
+
+ @Nullable
+ public ImageButton playSongs;
+
+ @Nullable
+ public View mask;
+
+ @Nullable
+ public MaterialCardView imageTextContainer;
+
+ @Nullable
+ public ImageView image;
+
+ public MediaEntryViewHolder(@NonNull View itemView) {
+ super(itemView);
+ title = itemView.findViewById(R.id.title);
+ text = itemView.findViewById(R.id.text);
+
+ image = itemView.findViewById(R.id.image);
+ time = itemView.findViewById(R.id.time);
+
+ imageText = itemView.findViewById(R.id.image_text);
+ imageContainer = itemView.findViewById(R.id.image_container);
+ imageTextContainer = itemView.findViewById(R.id.image_text_container);
+ imageContainerCard = itemView.findViewById(R.id.image_container_card);
+
+ menu = itemView.findViewById(R.id.menu);
+ dragView = itemView.findViewById(R.id.drag_view);
+ paletteColorContainer = itemView.findViewById(R.id.palette_color_container);
+ recyclerView = itemView.findViewById(R.id.recycler_view);
+ mask = itemView.findViewById(R.id.mask);
+ playSongs = itemView.findViewById(R.id.playSongs);
+
+ if (imageContainerCard != null) {
+ imageContainerCard.setCardBackgroundColor(ThemeStore.Companion.primaryColor(itemView.getContext()));
+ }
+ itemView.setOnClickListener(this);
+ itemView.setOnLongClickListener(this);
+ }
+
+ @Override
+ public boolean onLongClick(View v) {
+ return false;
+ }
+
+ @Override
+ public void onClick(View v) {
+
+ }
+
+ public void setImageTransitionName(@NonNull String transitionName) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && image != null) {
+ image.setTransitionName(transitionName);
+ }
+ }
+}
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/base/MediaEntryViewHolder.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/base/MediaEntryViewHolder.kt
deleted file mode 100644
index 09780904..00000000
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/base/MediaEntryViewHolder.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-package code.name.monkey.retromusic.adapter.base
-
-import android.os.Build
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ImageButton
-import android.widget.ImageView
-import android.widget.TextView
-import androidx.cardview.widget.CardView
-import androidx.recyclerview.widget.RecyclerView
-import code.name.monkey.appthemehelper.ThemeStore
-import code.name.monkey.retromusic.R
-
-open class MediaEntryViewHolder(view: View) : RecyclerView.ViewHolder(view), View.OnClickListener, View.OnLongClickListener {
- override fun onLongClick(v: View?): Boolean {
- return false
- }
-
- override fun onClick(v: View?) {
-
- }
-
- var image: ImageView? = null
- var imageText: TextView? = null
- var title: TextView? = null
- var text: TextView? = null
- var imageContainer: ViewGroup? = null
- var imageContainerCard: CardView? = null
- var menu: View? = null
- var dragView: View? = null
- var paletteColorContainer: View? = null
- var time: TextView? = null
- var recyclerView: RecyclerView? = null
- var playSongs: ImageButton? = null
- var mask: View? = null
- var imageTextContainer: CardView? = null
-
- init {
-
-
- title = view.findViewById(R.id.title)
- text = view.findViewById(R.id.text)
-
- image = view.findViewById(R.id.image)
- imageContainer = view.findViewById(R.id.image_container)
- imageTextContainer = view.findViewById(R.id.image_text_container)
- imageContainerCard = view.findViewById(R.id.image_container_card)
-
- imageText = view.findViewById(R.id.image_text)
-
- menu = view.findViewById(R.id.menu)
- dragView = view.findViewById(R.id.drag_view)
-
- paletteColorContainer = view.findViewById(R.id.palette_color_container)
-
- time = view.findViewById(R.id.time);
- recyclerView = view.findViewById(R.id.recycler_view)
-
- mask = view.findViewById(R.id.mask)
- playSongs = view.findViewById(R.id.playSongs)
-
- view.setOnClickListener(this@MediaEntryViewHolder)
- view.setOnLongClickListener(this@MediaEntryViewHolder)
-
- imageContainerCard?.setCardBackgroundColor(ThemeStore.primaryColor(itemView.context))
-
- }
-
- fun setImageTransitionName(transitionName: String) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && image != null) {
- image!!.transitionName = transitionName
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt
index 5ec0b8f5..f079a9ea 100644
--- a/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/adapter/song/SongAdapter.kt
@@ -1,15 +1,15 @@
package code.name.monkey.retromusic.adapter.song
+import android.app.ActivityOptions
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
-import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
-import androidx.core.util.Pair
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
+import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
@@ -33,9 +33,14 @@ import java.util.*
* Created by hemanths on 13/08/17.
*/
-open class SongAdapter @JvmOverloads constructor(protected val activity: AppCompatActivity, dataSet: ArrayList,
- @param:LayoutRes protected var itemLayoutRes: Int, usePalette: Boolean, cabHolder: CabHolder?,
- showSectionName: Boolean = true) : AbsMultiSelectAdapter(activity, cabHolder, code.name.monkey.retromusic.R.menu.menu_media_selection), MaterialCab.Callback, FastScrollRecyclerView.SectionedAdapter {
+open class SongAdapter @JvmOverloads constructor(
+ protected val activity: AppCompatActivity,
+ dataSet: ArrayList,
+ protected var itemLayoutRes: Int,
+ usePalette: Boolean,
+ cabHolder: CabHolder?,
+ showSectionName: Boolean = true
+) : AbsMultiSelectAdapter(activity, cabHolder, code.name.monkey.retromusic.R.menu.menu_media_selection), MaterialCab.Callback, FastScrollRecyclerView.SectionedAdapter {
var dataSet: ArrayList
protected var usePalette = false
@@ -83,9 +88,7 @@ open class SongAdapter @JvmOverloads constructor(protected val activity: AppComp
if (holder.text != null) {
holder.text!!.text = getSongText(song)
}
-
loadAlbumCover(song, holder)
-
}
private fun setColors(color: Int, holder: ViewHolder) {
@@ -161,41 +164,35 @@ open class SongAdapter @JvmOverloads constructor(protected val activity: AppComp
return ""
}
}
-
return MusicUtil.getSectionName(sectionName)
}
open inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
-
protected open var songMenuRes = SongMenuHelper.MENU_RES
-
protected open val song: Song
get() = dataSet[adapterPosition]
init {
- setImageTransitionName(activity.getString(code.name.monkey.retromusic.R.string.transition_album_art))
- if (menu != null) {
- menu!!.setOnClickListener(object : SongMenuHelper.OnClickSongMenu(activity) {
- override val song: Song
- get() = this@ViewHolder.song
+ setImageTransitionName(activity.getString(R.string.transition_album_art))
+ menu?.setOnClickListener(object : SongMenuHelper.OnClickSongMenu(activity) {
+ override val song: Song
+ get() = this@ViewHolder.song
- override val menuRes: Int
- get() = songMenuRes
+ override val menuRes: Int
+ get() = songMenuRes
- override fun onMenuItemClick(item: MenuItem): Boolean {
- return onSongMenuItemClick(item) || super.onMenuItemClick(item)
- }
- })
- }
+ override fun onMenuItemClick(item: MenuItem): Boolean {
+ return onSongMenuItemClick(item) || super.onMenuItemClick(item)
+ }
+ })
}
protected open fun onSongMenuItemClick(item: MenuItem): Boolean {
if (image != null && image!!.visibility == View.VISIBLE) {
when (item.itemId) {
- code.name.monkey.retromusic.R.id.action_go_to_album -> {
- val albumPairs = arrayOf>(Pair.create(imageContainer,
- activity.resources.getString(code.name.monkey.retromusic.R.string.transition_album_art)))
- NavigationUtil.goToAlbum(activity, song.albumId, *albumPairs)
+ R.id.action_go_to_album -> {
+ val options: ActivityOptions = ActivityOptions.makeSceneTransitionAnimation(activity, image, activity.getString(R.string.transition_album_art))
+ NavigationUtil.goToAlbumOptions(activity, song.albumId, options)
return true
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/dagger/module/AlbumModule.kt b/app/src/main/java/code/name/monkey/retromusic/dagger/module/AlbumModule.kt
index 13c9dd86..80fcd1ca 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dagger/module/AlbumModule.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dagger/module/AlbumModule.kt
@@ -20,7 +20,6 @@ import code.name.monkey.retromusic.mvp.presenter.AlbumsPresenter
import code.name.monkey.retromusic.mvp.presenter.AlbumsPresenter.AlbumsPresenterImpl
import dagger.Module
import dagger.Provides
-import javax.inject.Singleton
/**
* Created by hemanths on 2019-09-04.
@@ -29,13 +28,11 @@ import javax.inject.Singleton
class AlbumModule {
@Provides
- @Singleton
fun providesAlbumsPresenter(presenter: AlbumsPresenterImpl): AlbumsPresenter {
return presenter
}
@Provides
- @Singleton
fun providesAlbumDetailsPresenter(presenter: AlbumDetailsPresenterImpl): AlbumDetailsPresenter {
return presenter
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/dagger/module/ArtistModule.kt b/app/src/main/java/code/name/monkey/retromusic/dagger/module/ArtistModule.kt
index d00f6786..0d9ecfec 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dagger/module/ArtistModule.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dagger/module/ArtistModule.kt
@@ -15,14 +15,12 @@
package code.name.monkey.retromusic.dagger.module
import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter
+import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter.ArtistDetailsPresenterImpl
import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter
+import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter.ArtistsPresenterImpl
import dagger.Module
import dagger.Provides
-import code.name.monkey.retromusic.mvp.presenter.ArtistDetailsPresenter.*
-import code.name.monkey.retromusic.mvp.presenter.ArtistsPresenter.*
-import javax.inject.Singleton
-
/**
* Created by hemanths on 2019-09-04.
*/
@@ -30,13 +28,11 @@ import javax.inject.Singleton
class ArtistModule {
@Provides
- @Singleton
fun providesArtistDetailsPresenter(presenter: ArtistDetailsPresenterImpl): ArtistDetailsPresenter {
return presenter
}
@Provides
- @Singleton
fun providesArtistsPresenter(presenter: ArtistsPresenterImpl): ArtistsPresenter {
return presenter
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt
index 999f27e7..3a7e26f6 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt
@@ -21,6 +21,8 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.loaders.PlaylistLoader
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.PlaylistsUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
@@ -39,8 +41,9 @@ class AddToPlaylistDialog : DialogFragment() {
playlistNames.add(p.name)
}
- return MaterialDialog(requireContext(), BottomSheet()).show {
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(R.string.add_playlist_title)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
listItems(items = playlistNames) { dialog, index, _ ->
val songs = arguments!!.getParcelableArrayList("songs") ?: return@listItems
if (index == 0) {
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 29264b45..06566845 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
@@ -23,6 +23,8 @@ import android.os.Environment
import androidx.core.app.ActivityCompat
import androidx.fragment.app.DialogFragment
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
@@ -51,7 +53,7 @@ class BlacklistFolderChooserDialog : DialogFragment() {
results[0] = ".."
}
for (i in parentContents!!.indices) {
- results[if (canGoUp) i + 1 else i] = parentContents!![i].name!!
+ results[if (canGoUp) i + 1 else i] = parentContents!![i].name
}
val data = ArrayList()
@@ -79,8 +81,8 @@ class BlacklistFolderChooserDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
var savedInstanceStateFinal = savedInstanceState
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
- ActivityCompat.checkSelfPermission(activity!!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
- return MaterialDialog(activity!!).show {
+ ActivityCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ return MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(R.string.md_error_label)
message(R.string.md_storage_perm_error)
positiveButton(android.R.string.ok)
@@ -96,8 +98,9 @@ class BlacklistFolderChooserDialog : DialogFragment() {
checkIfCanGoUp()
parentContents = listFiles()
- return MaterialDialog(activity!!, BottomSheet()).show {
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(text = parentFolder!!.absolutePath)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
listItems(items = contentsArray(), waitForPositiveButton = false) { _, index, _ ->
onSelection(index)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/ClearSmartPlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/ClearSmartPlaylistDialog.kt
index bf93005b..8e61964c 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/ClearSmartPlaylistDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/ClearSmartPlaylistDialog.kt
@@ -20,6 +20,8 @@ import android.text.Html
import androidx.fragment.app.DialogFragment
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
@@ -33,8 +35,9 @@ class ClearSmartPlaylistDialog : DialogFragment() {
val content = Html.fromHtml(getString(R.string.clear_playlist_x, playlist!!.name))
- return MaterialDialog(activity!!, BottomSheet()).show {
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(title)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
message(text = content)
positiveButton(R.string.clear_action) {
if (activity == null) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt
index 83ecb2f2..b571f85f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt
@@ -27,6 +27,8 @@ import code.name.monkey.retromusic.R.string
import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.PlaylistsUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.WhichButton
import com.afollestad.materialdialogs.actions.getActionButton
@@ -45,8 +47,9 @@ class CreatePlaylistDialog : DialogFragment() {
override fun onCreateDialog(
savedInstanceState: Bundle?
): Dialog {
- val materialDialog = MaterialDialog(activity!!, BottomSheet())
+ val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.show {
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
title(string.new_playlist_title)
customView(layout.dialog_playlist)
negativeButton(android.R.string.cancel)
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt
index 0daea09f..312b2781 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeletePlaylistDialog.kt
@@ -22,6 +22,8 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.R.string
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.util.PlaylistsUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import java.util.*
@@ -42,8 +44,9 @@ class DeletePlaylistDialog : DialogFragment() {
content = Html.fromHtml(getString(string.delete_playlist_x, playlists[0].name))
}
- return MaterialDialog(activity!!, BottomSheet())
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.show {
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
title(title)
message(text = content)
negativeButton(android.R.string.cancel)
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt
index da6e3f02..d06b269f 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt
@@ -25,7 +25,9 @@ import code.name.monkey.retromusic.activities.saf.SAFGuideActivity
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.SAFUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
@@ -53,12 +55,13 @@ class DeleteSongsDialog : DialogFragment() {
}
}
- return MaterialDialog(requireActivity(), BottomSheet()).show {
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(title)
message(text = content)
negativeButton(android.R.string.cancel) {
dismiss()
}
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
noAutoDismiss()
positiveButton(R.string.action_delete) {
if (songs != null) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt
index 84f801ff..5d0734e6 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/OptionsSheetDialogFragment.kt
@@ -24,6 +24,7 @@ import code.name.monkey.retromusic.activities.MainActivity
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.OptionMenuItemView
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.customview.customView
@@ -66,11 +67,12 @@ class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
actionFolders.setOnClickListener(this)
- materialDialog = MaterialDialog(activity!!, BottomSheet())
+ materialDialog = MaterialDialog(requireActivity(), BottomSheet(LayoutMode.WRAP_CONTENT))
.show {
icon(R.mipmap.ic_launcher_round)
title(R.string.app_name)
customView(view = layout, scrollable = true)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
}
return materialDialog
}
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 b6d6208d..e2eaf495 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
@@ -21,6 +21,8 @@ import androidx.fragment.app.DialogFragment
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.model.PlaylistSong
import code.name.monkey.retromusic.util.PlaylistsUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
@@ -43,7 +45,7 @@ class RemoveFromPlaylistDialog : DialogFragment() {
}
- return MaterialDialog(activity!!, BottomSheet())
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.show {
title(title)
message(text = content)
@@ -53,6 +55,7 @@ class RemoveFromPlaylistDialog : DialogFragment() {
return@positiveButton
PlaylistsUtil.removeFromPlaylist(activity!!, songs as MutableList)
}
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
}
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt
index 8e5173c6..391bf11c 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/RenamePlaylistDialog.kt
@@ -26,6 +26,8 @@ import code.name.monkey.retromusic.R.layout
import code.name.monkey.retromusic.R.string
import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.util.PlaylistsUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.WhichButton
import com.afollestad.materialdialogs.actions.getActionButton
@@ -41,8 +43,9 @@ class RenamePlaylistDialog : DialogFragment() {
private lateinit var actionNewPlaylistContainer: TextInputLayout
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
- val materialDialog = MaterialDialog(activity!!, BottomSheet())
+ val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.show {
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
title(string.rename_playlist_title)
customView(layout.dialog_playlist)
negativeButton(android.R.string.cancel)
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt
index d1ba375b..66051a27 100755
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt
@@ -36,6 +36,7 @@ import code.name.monkey.retromusic.service.MusicService.ACTION_QUIT
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.ViewUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.WhichButton
import com.afollestad.materialdialogs.actions.getActionButton
@@ -57,8 +58,9 @@ class SleepTimerDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
timerUpdater = TimerUpdater()
- materialDialog = MaterialDialog(activity!!, BottomSheet())
+ materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.title(R.string.action_sleep_timer)
+ .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
.positiveButton(R.string.action_set) {
PreferenceUtil.getInstance(requireContext()).sleepTimerFinishMusic = shouldFinishLastSong.isChecked
diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt
index 8817c4d0..14e6b31e 100644
--- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongDetailDialog.kt
@@ -14,7 +14,6 @@
package code.name.monkey.retromusic.dialogs
-import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.os.Bundle
@@ -31,6 +30,8 @@ import code.name.monkey.retromusic.R.layout
import code.name.monkey.retromusic.R.string
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.customview.customView
@@ -53,15 +54,16 @@ inline fun ViewGroup.forEach(action: (View) -> Unit) {
class SongDetailDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
- val context: Activity = activity!!
+ val context: Context = requireContext()
val song = arguments!!.getParcelable("song")
- val materialDialog = MaterialDialog(context, BottomSheet())
+ val materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.show {
customView(layout.dialog_file_details,
scrollable = true)
positiveButton(android.R.string.ok)
title(string.action_details)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
}
val dialogView = materialDialog.getCustomView()
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 3a3dc98a..b7ab8555 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
@@ -21,55 +21,22 @@ import androidx.fragment.app.DialogFragment
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
class SongShareDialog : DialogFragment() {
- /* override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
- return inflater.inflate(R.layout.dialog_file_share, container, false)
- }
-
- @SuppressLint("StringFormatInvalid")
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- 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!!))
- setOnClickListener {
- val currentlyListening = getString(code.name.monkey.retromusic.R.string.currently_listening_to_x_by_x, song.title, song.artistName)
- activity!!.startActivity(Intent.createChooser(Intent().setAction(Intent.ACTION_SEND)
- .putExtra(Intent.EXTRA_TEXT, currentlyListening)
- .setType("text/plain"), null))
- dismiss()
- }
- icon = ContextCompat.getDrawable(context, code.name.monkey.retromusic.R.drawable.ic_text_fields_black_24dp)
- MaterialUtil.setTint(this)
- }
-
- audioFile.apply {
- setTextColor(ThemeStore.textColorSecondary(context!!))
- setOnClickListener {
- activity!!.startActivity(Intent.createChooser(MusicUtil.createShareSongFileIntent(song, context), null))
- dismiss()
- }
- icon = ContextCompat.getDrawable(context, code.name.monkey.retromusic.R.drawable.ic_share_white_24dp)
- MaterialUtil.setTint(this, false)
- }
-
- }*/
-
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val song: Song? = arguments!!.getParcelable("song")
val currentlyListening: String = getString(R.string.currently_listening_to_x_by_x, song?.title, song?.artistName)
- return MaterialDialog(activity!!, BottomSheet())
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.title(R.string.what_do_you_want_to_share)
.show {
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
listItems(items = listOf(getString(code.name.monkey.retromusic.R.string.the_audio_file), "\u201C" + currentlyListening + "\u201D")) { dialog, index, text ->
when (index) {
0 -> {
diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt
index 3b7c48ad..4e5f6cf5 100644
--- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/SongsFragment.kt
@@ -1,6 +1,7 @@
package code.name.monkey.retromusic.fragments.mainactivity
import android.os.Bundle
+import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
@@ -26,6 +27,10 @@ class SongsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment
diff --git a/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicGlideModule.kt b/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicGlideModule.kt
index 5c18ac4a..da9620f9 100644
--- a/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicGlideModule.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicGlideModule.kt
@@ -26,7 +26,6 @@ import java.io.InputStream
class RetroMusicGlideModule : GlideModule {
override fun applyOptions(context: Context, builder: GlideBuilder) {
-
}
override fun registerComponents(context: Context, glide: Glide) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt b/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt
index cfabadad..9487835d 100644
--- a/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/helper/MusicPlayerRemote.kt
@@ -49,7 +49,6 @@ object MusicPlayerRemote {
} else song.id == currentSong.id
}
-
val currentSong: Song
get() = if (musicService != null) {
musicService!!.currentSong
@@ -219,7 +218,7 @@ object MusicPlayerRemote {
*/
fun openAndShuffleQueue(queue: ArrayList, startPlaying: Boolean) {
var startPosition = 0
- if (!queue.isEmpty()) {
+ if (queue.isNotEmpty()) {
startPosition = Random().nextInt(queue.size)
}
diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt
index 2dc960ac..76643f31 100644
--- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/AlbumDetailsPresenter.kt
@@ -46,7 +46,7 @@ interface AlbumDetailsPresenter : Presenter {
) : PresenterImpl(), AlbumDetailsPresenter {
private lateinit var album: Album
-
+ private var disposable: CompositeDisposable = CompositeDisposable()
override fun loadMore(artistId: Int) {
disposable += repository.getArtistByIdFlowable(artistId)
.map {
@@ -64,7 +64,6 @@ interface AlbumDetailsPresenter : Presenter {
}
}
- private var disposable: CompositeDisposable = CompositeDisposable()
override fun loadAlbum(albumId: Int) {
disposable += repository.getAlbumFlowable(albumId)
diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/SongPresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/SongPresenter.kt
index 93af6393..3f3a639c 100644
--- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/SongPresenter.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/SongPresenter.kt
@@ -42,9 +42,9 @@ interface SongPresenter : Presenter {
override fun loadSongs() {
disposable = repository.allSongsFlowable
- .subscribe {
- view.songs(it)
- }
+ .subscribe({
+ view?.songs(it)
+ }, { t -> print(t) })
}
override fun detachView() {
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
index a2dd738f..6667a330 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt
@@ -74,8 +74,9 @@ class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPa
viewPager.pageMargin = ViewUtil.convertDpToPixel(32f, resources).toInt()
viewPager.currentItem = PreferenceUtil.getInstance(requireContext()).albumCoverStyle.ordinal
- return MaterialDialog(activity!!).show {
+ return MaterialDialog(requireActivity()).show {
title(R.string.pref_title_album_cover_style)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
positiveButton(R.string.set) {
val nowPlayingScreen = AlbumCoverStyle.values()[viewPagerPosition]
PreferenceUtil.getInstance(requireContext()).albumCoverStyle = nowPlayingScreen
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 c9710a0e..ab856a40 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
@@ -26,6 +26,8 @@ import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreferenc
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.dialogs.BlacklistFolderChooserDialog
import code.name.monkey.retromusic.providers.BlacklistStore
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItems
@@ -58,15 +60,17 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
val blacklistFolderChooserDialog = childFragmentManager.findFragmentByTag("FOLDER_CHOOSER") as BlacklistFolderChooserDialog?
blacklistFolderChooserDialog?.setCallback(this)
refreshBlacklistData()
- return MaterialDialog(context!!, BottomSheet()).show {
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(code.name.monkey.retromusic.R.string.blacklist)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
positiveButton(android.R.string.ok) {
dismiss()
}
neutralButton(text = getString(R.string.clear_action)) {
- MaterialDialog(context, BottomSheet()).show {
+ MaterialDialog(context, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
title(code.name.monkey.retromusic.R.string.clear_blacklist)
message(code.name.monkey.retromusic.R.string.do_you_want_to_clear_the_blacklist)
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
positiveButton(code.name.monkey.retromusic.R.string.clear_action) {
BlacklistStore.getInstance(context).clear()
refreshBlacklistData()
@@ -80,7 +84,8 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
dialog.show(childFragmentManager, "FOLDER_CHOOSER");
}
listItems(items = paths, waitForPositiveButton = false) { _, _, text ->
- MaterialDialog(context, BottomSheet()).show {
+ MaterialDialog(context, BottomSheet(LayoutMode.WRAP_CONTENT)).show {
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
title(code.name.monkey.retromusic.R.string.remove_from_blacklist)
message(text = Html.fromHtml(getString(code.name.monkey.retromusic.R.string.do_you_want_to_remove_from_the_blacklist, text)))
positiveButton(code.name.monkey.retromusic.R.string.remove_action) {
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
index eaa457a5..21700811 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/LibraryPreference.kt
@@ -28,6 +28,7 @@ import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreferenc
import code.name.monkey.retromusic.adapter.CategoryInfoAdapter
import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.customview.customView
@@ -73,8 +74,9 @@ class LibraryPreferenceDialog : PreferenceDialogFragmentCompat() {
adapter.attachToRecyclerView(recyclerView)
- return MaterialDialog(context!!, BottomSheet())
+ return MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.title(code.name.monkey.retromusic.R.string.library_categories)
+ .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
.customView(view = view)
.positiveButton(android.R.string.ok) {
updateCategories(adapter.categoryInfos)
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 f5ead3cc..3b4ca6e8 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
@@ -24,6 +24,8 @@ import androidx.preference.ListPreference
import androidx.preference.PreferenceDialogFragmentCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
+import code.name.monkey.retromusic.util.PreferenceUtil
+import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.list.listItemsSingleChoice
@@ -78,9 +80,10 @@ class MaterialListPreferenceDialog : PreferenceDialogFragmentCompat() {
val entries = arguments?.getStringArrayList(EXTRA_ENTRIES)
val entriesValues = arguments?.getStringArrayList(EXTRA_ENTRIES_VALUES)
- materialDialog = MaterialDialog(requireContext(), BottomSheet())
+ materialDialog = MaterialDialog(requireContext(), BottomSheet(LayoutMode.WRAP_CONTENT))
.title(text = materialListPreference.title.toString())
.positiveButton(R.string.set)
+ .cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
.listItemsSingleChoice(items = entries, initialSelection = position, waitForPositiveButton = true) { _, index, _ ->
materialListPreference.callChangeListener(entriesValues!![index])
materialListPreference.setCustomValue(entriesValues[index])
diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
index 1e1ca372..e174471a 100644
--- a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
+++ b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt
@@ -91,7 +91,7 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
viewPager.currentItem = PreferenceUtil.getInstance(requireContext()).nowPlayingScreen.ordinal
- return MaterialDialog(activity!!).show {
+ return MaterialDialog(requireContext()).show {
title(R.string.pref_title_album_cover_style)
positiveButton(R.string.set) {
val nowPlayingScreen = NowPlayingScreen.values()[viewPagerPosition]
@@ -103,6 +103,7 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP
PreferenceUtil.getInstance(requireContext()).nowPlayingScreen = nowPlayingScreen
}
}
+ cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
negativeButton(android.R.string.cancel)
customView(view = view, scrollable = false, noVerticalPadding = false)
}
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 853ae2d4..6e408f06 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
@@ -88,7 +88,8 @@ import code.name.monkey.retromusic.util.RetroUtil;
/**
* @author Karim Abou Zeid (kabouzeid), Andrew Neal
*/
-public class MusicService extends MediaBrowserServiceCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Playback.PlaybackCallbacks {
+public class MusicService extends MediaBrowserServiceCompat implements
+ SharedPreferences.OnSharedPreferenceChangeListener, Playback.PlaybackCallbacks {
public static final String TAG = MusicService.class.getSimpleName();
public static final String RETRO_MUSIC_PACKAGE_NAME = "code.name.monkey.retromusic";
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 c567f146..837500c7 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
@@ -15,6 +15,7 @@
package code.name.monkey.retromusic.util;
import android.app.Activity;
+import android.app.ActivityOptions;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@@ -62,6 +63,12 @@ public class NavigationUtil {
ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle());
}
+ public static void goToAlbumOptions(@NonNull Activity activity, int albumId, @NonNull ActivityOptions activityOptions) {
+ Intent intent = new Intent(activity, AlbumDetailsActivity.class);
+ intent.putExtra(AlbumDetailsActivity.EXTRA_ALBUM_ID, albumId);
+ ActivityCompat.startActivity(activity, intent, activityOptions.toBundle());
+ }
+
public static void goToArtist(@NonNull Activity activity, int i,
@Nullable Pair... sharedElements) {
Intent intent = new Intent(activity, ArtistDetailActivity.class);
diff --git a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java
index 304617e9..952d3b91 100644
--- a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java
+++ b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java
@@ -56,6 +56,7 @@ import code.name.monkey.retromusic.transform.VerticalStackTransformer;
public final class PreferenceUtil {
public static final String LIBRARY_CATEGORIES = "library_categories";
+ public static final String DIALOG_CORNER = "dialog_corner";
public static final String KEEP_SCREEN_ON = "keep_screen_on";
public static final String TOGGLE_HOME_BANNER = "toggle_home_banner";
public static final String NOW_PLAYING_SCREEN_ID = "now_playing_screen_id";
@@ -185,6 +186,10 @@ public final class PreferenceUtil {
return mPreferences.getInt(FILTER_SONG, 20);
}
+ public float getDialogCorner() {
+ return mPreferences.getInt(DIALOG_CORNER, 16);
+ }
+
public boolean isSnowFall() {
return mPreferences.getBoolean(SNOW_FALL_EFFECT, false);
}
diff --git a/app/src/main/res/layout/preference_category_title.xml b/app/src/main/res/layout/preference_category_title.xml
new file mode 100644
index 00000000..62d8b552
--- /dev/null
+++ b/app/src/main/res/layout/preference_category_title.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 35c90471..1b165aa7 100755
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -45,7 +45,11 @@
- @string/dark_theme_name
- @string/black_theme_name
-
+
+ - light
+ - dark
+ - black
+
- @string/normal_style
- @string/card_style
@@ -91,11 +95,6 @@
- @layout/item_album_card
-
- - light
- - dark
- - black
-
- always
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f7996ef1..ba01099d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -657,4 +657,5 @@
Cycle repeat mode
Toggle shuffle mode
Toggle favorite
+ Dialog corner
diff --git a/app/src/main/res/values/styles_parents.xml b/app/src/main/res/values/styles_parents.xml
index caaaef92..c2e6b6f2 100644
--- a/app/src/main/res/values/styles_parents.xml
+++ b/app/src/main/res/values/styles_parents.xml
@@ -4,7 +4,6 @@