Updated code

Added Fragment options
Renamed Interfaces
Rolled back to previous implementaion for Now playing to handle backpress
This commit is contained in:
Hemanth S 2020-09-24 02:25:12 +05:30
parent 7c0b3ee82c
commit 3f368e186b
45 changed files with 274 additions and 457 deletions

View file

@ -12,7 +12,6 @@ import code.name.monkey.retromusic.fragments.albums.AlbumDetailsViewModel
import code.name.monkey.retromusic.fragments.artists.ArtistDetailsViewModel import code.name.monkey.retromusic.fragments.artists.ArtistDetailsViewModel
import code.name.monkey.retromusic.fragments.genres.GenreDetailsViewModel import code.name.monkey.retromusic.fragments.genres.GenreDetailsViewModel
import code.name.monkey.retromusic.fragments.playlists.PlaylistDetailsViewModel import code.name.monkey.retromusic.fragments.playlists.PlaylistDetailsViewModel
import code.name.monkey.retromusic.fragments.search.SearchViewModel
import code.name.monkey.retromusic.model.Genre import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.network.* import code.name.monkey.retromusic.network.*
import code.name.monkey.retromusic.repository.* import code.name.monkey.retromusic.repository.*
@ -189,10 +188,6 @@ private val viewModules = module {
genre genre
) )
} }
viewModel {
SearchViewModel(get())
}
} }
val appModules = listOf(mainModule, dataModule, viewModules, networkModule, roomModule) val appModules = listOf(mainModule, dataModule, viewModules, networkModule, roomModule)

View file

@ -8,7 +8,7 @@ import androidx.lifecycle.lifecycleScope
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.db.toPlayCount import code.name.monkey.retromusic.db.toPlayCount
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
import code.name.monkey.retromusic.service.MusicService.* import code.name.monkey.retromusic.service.MusicService.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -17,9 +17,9 @@ import org.koin.android.ext.android.inject
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import java.util.* import java.util.*
abstract class AbsMusicServiceActivity : AbsBaseActivity(), MusicServiceEventListener { abstract class AbsMusicServiceActivity : AbsBaseActivity(), IMusicServiceEventListener {
private val mMusicServiceEventListeners = ArrayList<MusicServiceEventListener>() private val mMusicServiceEventListeners = ArrayList<IMusicServiceEventListener>()
private val repository: RealRepository by inject() private val repository: RealRepository by inject()
private var serviceToken: MusicPlayerRemote.ServiceToken? = null private var serviceToken: MusicPlayerRemote.ServiceToken? = null
private var musicStateReceiver: MusicStateReceiver? = null private var musicStateReceiver: MusicStateReceiver? = null
@ -49,15 +49,15 @@ abstract class AbsMusicServiceActivity : AbsBaseActivity(), MusicServiceEventLis
} }
} }
fun addMusicServiceEventListener(listener: MusicServiceEventListener?) { fun addMusicServiceEventListener(listenerI: IMusicServiceEventListener?) {
if (listener != null) { if (listenerI != null) {
mMusicServiceEventListeners.add(listener) mMusicServiceEventListeners.add(listenerI)
} }
} }
fun removeMusicServiceEventListener(listener: MusicServiceEventListener?) { fun removeMusicServiceEventListener(listenerI: IMusicServiceEventListener?) {
if (listener != null) { if (listenerI != null) {
mMusicServiceEventListeners.remove(listener) mMusicServiceEventListeners.remove(listenerI)
} }
} }

View file

@ -8,25 +8,41 @@ import android.view.ViewTreeObserver
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.RetroBottomSheetBehavior import code.name.monkey.retromusic.RetroBottomSheetBehavior
import code.name.monkey.retromusic.extensions.hide import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.peekHeightAnimate
import code.name.monkey.retromusic.extensions.translateXAnimate
import code.name.monkey.retromusic.extensions.whichFragment import code.name.monkey.retromusic.extensions.whichFragment
import code.name.monkey.retromusic.fragments.LibraryViewModel import code.name.monkey.retromusic.fragments.LibraryViewModel
import code.name.monkey.retromusic.fragments.MiniPlayerFragment import code.name.monkey.retromusic.fragments.MiniPlayerFragment
import code.name.monkey.retromusic.fragments.NowPlayingScreen import code.name.monkey.retromusic.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.NowPlayingScreen.* import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.adaptive.AdaptiveFragment
import code.name.monkey.retromusic.fragments.player.blur.BlurPlayerFragment
import code.name.monkey.retromusic.fragments.player.card.CardFragment
import code.name.monkey.retromusic.fragments.player.cardblur.CardBlurFragment
import code.name.monkey.retromusic.fragments.player.circle.CirclePlayerFragment
import code.name.monkey.retromusic.fragments.player.color.ColorFragment
import code.name.monkey.retromusic.fragments.player.fit.FitFragment
import code.name.monkey.retromusic.fragments.player.flat.FlatPlayerFragment
import code.name.monkey.retromusic.fragments.player.full.FullPlayerFragment
import code.name.monkey.retromusic.fragments.player.gradient.GradientPlayerFragment
import code.name.monkey.retromusic.fragments.player.material.MaterialFragment
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
import code.name.monkey.retromusic.fragments.player.plain.PlainPlayerFragment
import code.name.monkey.retromusic.fragments.player.simple.SimplePlayerFragment
import code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.CategoryInfo import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.state.NowPlayingPanelState.* import code.name.monkey.retromusic.state.NowPlayingPanelState.*
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.BottomNavigationBarTinted import code.name.monkey.retromusic.views.BottomNavigationBarTinted
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior.*
import kotlinx.android.synthetic.main.sliding_music_panel_layout.* import kotlinx.android.synthetic.main.sliding_music_panel_layout.*
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
@ -36,9 +52,9 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
} }
protected val libraryViewModel by viewModel<LibraryViewModel>() protected val libraryViewModel by viewModel<LibraryViewModel>()
private lateinit var behavior: RetroBottomSheetBehavior<FrameLayout> private lateinit var bottomSheetBehavior: RetroBottomSheetBehavior<FrameLayout>
private var miniPlayerFragment: MiniPlayerFragment? = null private var miniPlayerFragment: MiniPlayerFragment? = null
private var cps: NowPlayingScreen? = null private var nowPlayingScreen: NowPlayingScreen? = null
private var navigationBarColor: Int = 0 private var navigationBarColor: Int = 0
private var taskColor: Int = 0 private var taskColor: Int = 0
private var lightStatusBar: Boolean = false private var lightStatusBar: Boolean = false
@ -46,9 +62,9 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
private var paletteColor: Int = Color.WHITE private var paletteColor: Int = Color.WHITE
protected abstract fun createContentView(): View protected abstract fun createContentView(): View
private val panelState: Int private val panelState: Int
get() = behavior.state get() = bottomSheetBehavior.state
private val bottomSheetCallbackList = object : BottomSheetBehavior.BottomSheetCallback() { private val bottomSheetCallbackList = object : BottomSheetCallback() {
override fun onSlide(bottomSheet: View, slideOffset: Float) { override fun onSlide(bottomSheet: View, slideOffset: Float) {
setMiniPlayerAlphaProgress(slideOffset) setMiniPlayerAlphaProgress(slideOffset)
@ -56,14 +72,14 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
override fun onStateChanged(bottomSheet: View, newState: Int) { override fun onStateChanged(bottomSheet: View, newState: Int) {
when (newState) { when (newState) {
BottomSheetBehavior.STATE_EXPANDED -> { STATE_EXPANDED -> {
onPanelExpanded() onPanelExpanded()
} }
BottomSheetBehavior.STATE_COLLAPSED -> { STATE_COLLAPSED -> {
onPanelCollapsed() onPanelCollapsed()
} }
else -> { else -> {
println("Do something")
} }
} }
} }
@ -75,34 +91,29 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
setContentView(createContentView()) setContentView(createContentView())
chooseFragmentForTheme() chooseFragmentForTheme()
setupSlidingUpPanel() setupSlidingUpPanel()
setupBottomSheet() setupBottomSheet()
updatePanelState() updatePanelState()
updateColor() updateColor()
} }
fun getBottomSheetBehavior() = behavior fun getBottomSheetBehavior() = bottomSheetBehavior
private fun setupBottomSheet() { private fun setupBottomSheet() {
behavior = BottomSheetBehavior.from(slidingPanel) as RetroBottomSheetBehavior bottomSheetBehavior = from(slidingPanel) as RetroBottomSheetBehavior
behavior.addBottomSheetCallback(bottomSheetCallbackList) bottomSheetBehavior.addBottomSheetCallback(bottomSheetCallbackList)
if (behavior.state == BottomSheetBehavior.STATE_EXPANDED) {
setMiniPlayerAlphaProgress(1f)
}
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (cps != PreferenceUtil.nowPlayingScreen) { if (nowPlayingScreen != PreferenceUtil.nowPlayingScreen) {
postRecreate() postRecreate()
} }
} }
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
behavior.removeBottomSheetCallback(bottomSheetCallbackList) bottomSheetBehavior.removeBottomSheetCallback(bottomSheetCallbackList)
} }
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View { protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
@ -115,17 +126,14 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
} }
fun collapsePanel() { fun collapsePanel() {
behavior.state = BottomSheetBehavior.STATE_COLLAPSED bottomSheetBehavior.state = STATE_COLLAPSED
setMiniPlayerAlphaProgress(0f)
} }
fun expandPanel() { fun expandPanel() {
behavior.state = BottomSheetBehavior.STATE_EXPANDED bottomSheetBehavior.state = STATE_EXPANDED
setMiniPlayerAlphaProgress(1f)
} }
private fun setMiniPlayerAlphaProgress(progress: Float) { private fun setMiniPlayerAlphaProgress(progress: Float) {
if (miniPlayerFragment?.view == null) return
val alpha = 1 - progress val alpha = 1 - progress
miniPlayerFragment?.view?.alpha = alpha miniPlayerFragment?.view?.alpha = alpha
miniPlayerFragment?.view?.visibility = if (alpha == 0f) View.GONE else View.VISIBLE miniPlayerFragment?.view?.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
@ -151,8 +159,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
override fun onGlobalLayout() { override fun onGlobalLayout() {
slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this) slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this)
when (panelState) { when (panelState) {
BottomSheetBehavior.STATE_EXPANDED -> onPanelExpanded() STATE_EXPANDED -> onPanelExpanded()
BottomSheetBehavior.STATE_COLLAPSED -> onPanelCollapsed() STATE_COLLAPSED -> onPanelCollapsed()
else -> { else -> {
//playerFragment!!.onHide() //playerFragment!!.onHide()
} }
@ -175,24 +183,20 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
val isBottomBarVisible = bottomNavigationView.isVisible val isBottomBarVisible = bottomNavigationView.isVisible
if (hide) { if (hide) {
behavior.isHideable = true bottomSheetBehavior.isHideable = true
behavior.peekHeight = 0 bottomSheetBehavior.peekHeight = 0
collapsePanel() collapsePanel()
ViewCompat.setElevation(slidingPanel, 0f) ViewCompat.setElevation(slidingPanel, 0f)
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)
} else { } else {
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)
ViewCompat.setElevation(slidingPanel, 10f) ViewCompat.setElevation(slidingPanel, 10f)
behavior.isHideable = false bottomSheetBehavior.isHideable = false
behavior.peekHeight = (if (isBottomBarVisible) heightOfBar * 2 else heightOfBar) - 24 bottomSheetBehavior.peekHeight =
(if (isBottomBarVisible) heightOfBar * 2 else heightOfBar) - 24
} }
} }
private fun chooseFragmentForTheme() {
cps = PreferenceUtil.nowPlayingScreen
miniPlayerFragment = whichFragment<MiniPlayerFragment>(R.id.miniPlayerFragment)
miniPlayerFragment?.view?.setOnClickListener { expandPanel() }
}
override fun onServiceConnected() { override fun onServiceConnected() {
super.onServiceConnected() super.onServiceConnected()
@ -229,8 +233,9 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
if (!handleBackPress()) super.onBackPressed() if (!handleBackPress()) super.onBackPressed()
} }
open fun handleBackPress(): Boolean { private fun handleBackPress(): Boolean {
if (panelState == BottomSheetBehavior.STATE_EXPANDED) { if (bottomSheetBehavior.peekHeight != 0 && playerFragment!!.onBackPressed()) return true
if (panelState == STATE_EXPANDED) {
collapsePanel() collapsePanel()
return true return true
} }
@ -238,27 +243,27 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
} }
private fun onPaletteColorChanged() { private fun onPaletteColorChanged() {
if (panelState == BottomSheetBehavior.STATE_EXPANDED) { if (panelState == STATE_EXPANDED) {
super.setTaskDescriptionColor(paletteColor) super.setTaskDescriptionColor(paletteColor)
val isColorLight = ColorUtil.isColorLight(paletteColor) val isColorLight = ColorUtil.isColorLight(paletteColor)
if (PreferenceUtil.isAdaptiveColor && (cps == Normal || cps == Flat)) { if (PreferenceUtil.isAdaptiveColor && (nowPlayingScreen == Normal || nowPlayingScreen == Flat)) {
super.setLightNavigationBar(true) super.setLightNavigationBar(true)
super.setLightStatusbar(isColorLight) super.setLightStatusbar(isColorLight)
} else if (cps == Card || cps == Blur || cps == BlurCard) { } else if (nowPlayingScreen == Card || nowPlayingScreen == Blur || nowPlayingScreen == BlurCard) {
super.setLightStatusbar(false) super.setLightStatusbar(false)
super.setLightNavigationBar(true) super.setLightNavigationBar(true)
super.setNavigationbarColor(Color.BLACK) super.setNavigationbarColor(Color.BLACK)
} else if (cps == Color || cps == Tiny || cps == Gradient) { } else if (nowPlayingScreen == Color || nowPlayingScreen == Tiny || nowPlayingScreen == Gradient) {
super.setNavigationbarColor(paletteColor) super.setNavigationbarColor(paletteColor)
super.setLightNavigationBar(isColorLight) super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(isColorLight) super.setLightStatusbar(isColorLight)
} else if (cps == Full) { } else if (nowPlayingScreen == Full) {
super.setNavigationbarColor(paletteColor) super.setNavigationbarColor(paletteColor)
super.setLightNavigationBar(isColorLight) super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(false) super.setLightStatusbar(false)
} else if (cps == Classic) { } else if (nowPlayingScreen == Classic) {
super.setLightStatusbar(false) super.setLightStatusbar(false)
} else if (cps == Fit) { } else if (nowPlayingScreen == Fit) {
super.setLightStatusbar(false) super.setLightStatusbar(false)
} else { } else {
super.setLightStatusbar( super.setLightStatusbar(
@ -276,28 +281,28 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
override fun setLightStatusbar(enabled: Boolean) { override fun setLightStatusbar(enabled: Boolean) {
lightStatusBar = enabled lightStatusBar = enabled
if (panelState == BottomSheetBehavior.STATE_COLLAPSED) { if (panelState == STATE_COLLAPSED) {
super.setLightStatusbar(enabled) super.setLightStatusbar(enabled)
} }
} }
override fun setLightNavigationBar(enabled: Boolean) { override fun setLightNavigationBar(enabled: Boolean) {
lightNavigationBar = enabled lightNavigationBar = enabled
if (panelState == BottomSheetBehavior.STATE_COLLAPSED) { if (panelState == STATE_COLLAPSED) {
super.setLightNavigationBar(enabled) super.setLightNavigationBar(enabled)
} }
} }
override fun setNavigationbarColor(color: Int) { override fun setNavigationbarColor(color: Int) {
navigationBarColor = color navigationBarColor = color
if (panelState == BottomSheetBehavior.STATE_COLLAPSED) { if (panelState == STATE_COLLAPSED) {
super.setNavigationbarColor(color) super.setNavigationbarColor(color)
} }
} }
override fun setTaskDescriptionColor(color: Int) { override fun setTaskDescriptionColor(color: Int) {
taskColor = color taskColor = color
if (panelState == BottomSheetBehavior.STATE_COLLAPSED) { if (panelState == STATE_COLLAPSED) {
super.setTaskDescriptionColor(color) super.setTaskDescriptionColor(color)
} }
} }
@ -335,32 +340,38 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
println("HIDE") println("HIDE")
ViewCompat.setElevation(slidingPanel, 0f) ViewCompat.setElevation(slidingPanel, 0f)
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)
behavior.isHideable = true bottomSheetBehavior.isHideable = true
behavior.peekHeightAnimate(0) bottomSheetBehavior.setPeekHeight(0, true)
collapsePanel() bottomSheetBehavior.state = STATE_COLLAPSED
} }
COLLAPSED_WITH -> { COLLAPSED_WITH -> {
println("COLLAPSED_WITH") println("COLLAPSED_WITH")
val heightOfBar = bottomNavigationView.height val heightOfBar = bottomNavigationView.height
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)
ViewCompat.setElevation(slidingPanel, 10f) ViewCompat.setElevation(slidingPanel, 10f)
behavior.isHideable = false bottomSheetBehavior.isHideable = false
behavior.peekHeightAnimate(if(isQueueEmpty) 0 else (heightOfBar * 2) - 24) bottomSheetBehavior.setPeekHeight(
bottomNavigationView.translateXAnimate(0f) if (isQueueEmpty) 0 else (heightOfBar * 2) - 24,
true
)
bottomNavigationView.isVisible = true
} }
COLLAPSED_WITHOUT -> { COLLAPSED_WITHOUT -> {
println("COLLAPSED_WITHOUT") println("COLLAPSED_WITHOUT")
val heightOfBar = bottomNavigationView.height val heightOfBar = bottomNavigationView.height
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)
ViewCompat.setElevation(slidingPanel, 10f) ViewCompat.setElevation(slidingPanel, 10f)
behavior.isHideable = false bottomSheetBehavior.isHideable = false
behavior.peekHeightAnimate(if(isQueueEmpty) 0 else heightOfBar - 24) bottomSheetBehavior.setPeekHeight(
bottomNavigationView.translateXAnimate(heightOfBar.toFloat()) if (isQueueEmpty) 0 else heightOfBar - 24,
true
)
bottomNavigationView.isGone = true
} }
else -> { else -> {
println("ELSE") println("ELSE")
behavior.isHideable = true bottomSheetBehavior.isHideable = true
behavior.peekHeight = 0 bottomSheetBehavior.peekHeight = 0
collapsePanel() collapsePanel()
ViewCompat.setElevation(slidingPanel, 0f) ViewCompat.setElevation(slidingPanel, 0f)
ViewCompat.setElevation(bottomNavigationView, 10f) ViewCompat.setElevation(bottomNavigationView, 10f)
@ -368,4 +379,35 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
} }
}) })
} }
private var playerFragment: AbsPlayerFragment? = null
private fun chooseFragmentForTheme() {
nowPlayingScreen = PreferenceUtil.nowPlayingScreen
val fragment: Fragment = when (nowPlayingScreen) {
Blur -> BlurPlayerFragment()
Adaptive -> AdaptiveFragment()
Normal -> PlayerFragment()
Card -> CardFragment()
BlurCard -> CardBlurFragment()
Fit -> FitFragment()
Flat -> FlatPlayerFragment()
Full -> FullPlayerFragment()
Plain -> PlainPlayerFragment()
Simple -> SimplePlayerFragment()
Material -> MaterialFragment()
Color -> ColorFragment()
Gradient -> GradientPlayerFragment()
Tiny -> TinyPlayerFragment()
//PEAK -> PeakPlayerFragment()
Circle -> CirclePlayerFragment()
else -> PlayerFragment()
} // must implement AbsPlayerFragment
supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment)
.commit()
supportFragmentManager.executePendingTransactions()
playerFragment = supportFragmentManager.findFragmentById(R.id.playerFragmentContainer) as AbsPlayerFragment
miniPlayerFragment = whichFragment<MiniPlayerFragment>(R.id.miniPlayerFragment)
miniPlayerFragment?.view?.setOnClickListener { expandPanel() }
}
} }

View file

@ -25,7 +25,7 @@ class SearchAdapter(
private var dataSet: List<Any> private var dataSet: List<Any>
) : RecyclerView.Adapter<SearchAdapter.ViewHolder>() { ) : RecyclerView.Adapter<SearchAdapter.ViewHolder>() {
fun swapDataSet(dataSet: MutableList<Any>) { fun swapDataSet(dataSet: List<Any>) {
this.dataSet = dataSet this.dataSet = dataSet
notifyDataSetChanged() notifyDataSetChanged()
} }

View file

@ -26,8 +26,8 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.glide.audiocover.AudioFileCover import code.name.monkey.retromusic.glide.audiocover.AudioFileCover
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.interfaces.Callbacks import code.name.monkey.retromusic.interfaces.ICallbacks
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.RetroUtil
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
@ -43,10 +43,10 @@ class SongFileAdapter(
private val activity: AppCompatActivity, private val activity: AppCompatActivity,
private var dataSet: List<File>, private var dataSet: List<File>,
private val itemLayoutRes: Int, private val itemLayoutRes: Int,
private val callbacks: Callbacks?, private val ICallbacks: ICallbacks?,
cabHolder: CabHolder? ICabHolder: ICabHolder?
) : AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File>( ) : AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File>(
activity, cabHolder, R.menu.menu_media_selection activity, ICabHolder, R.menu.menu_media_selection
), PopupTextProvider { ), PopupTextProvider {
init { init {
@ -136,8 +136,8 @@ class SongFileAdapter(
} }
override fun onMultipleItemAction(menuItem: MenuItem, selection: List<File>) { override fun onMultipleItemAction(menuItem: MenuItem, selection: List<File>) {
if (callbacks == null) return if (ICallbacks == null) return
callbacks.onMultipleItemAction(menuItem, selection as ArrayList<File>) ICallbacks.onMultipleItemAction(menuItem, selection as ArrayList<File>)
} }
override fun getPopupText(position: Int): String { override fun getPopupText(position: Int): String {
@ -152,11 +152,11 @@ class SongFileAdapter(
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
init { init {
if (menu != null && callbacks != null) { if (menu != null && ICallbacks != null) {
menu?.setOnClickListener { v -> menu?.setOnClickListener { v ->
val position = layoutPosition val position = layoutPosition
if (isPositionInRange(position)) { if (isPositionInRange(position)) {
callbacks.onFileMenuClicked(dataSet[position], v) ICallbacks.onFileMenuClicked(dataSet[position], v)
} }
} }
} }
@ -171,7 +171,7 @@ class SongFileAdapter(
if (isInQuickSelectMode) { if (isInQuickSelectMode) {
toggleChecked(position) toggleChecked(position)
} else { } else {
callbacks?.onFileSelected(dataSet[position]) ICallbacks?.onFileSelected(dataSet[position])
} }
} }
} }

View file

@ -16,7 +16,7 @@ import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.SortOrder import code.name.monkey.retromusic.helper.SortOrder
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
@ -29,11 +29,11 @@ open class AlbumAdapter(
protected val activity: FragmentActivity, protected val activity: FragmentActivity,
var dataSet: List<Album>, var dataSet: List<Album>,
protected var itemLayoutRes: Int, protected var itemLayoutRes: Int,
cabHolder: CabHolder?, ICabHolder: ICabHolder?,
private val albumClickListener: AlbumClickListener? private val albumClickListener: AlbumClickListener?
) : AbsMultiSelectAdapter<AlbumAdapter.ViewHolder, Album>( ) : AbsMultiSelectAdapter<AlbumAdapter.ViewHolder, Album>(
activity, activity,
cabHolder, ICabHolder,
R.menu.menu_media_selection R.menu.menu_media_selection
), PopupTextProvider { ), PopupTextProvider {

View file

@ -7,7 +7,7 @@ import code.name.monkey.retromusic.fragments.albums.AlbumClickListener
import code.name.monkey.retromusic.glide.AlbumGlideRequest import code.name.monkey.retromusic.glide.AlbumGlideRequest
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.HorizontalAdapterHelper import code.name.monkey.retromusic.helper.HorizontalAdapterHelper
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
@ -16,10 +16,10 @@ import com.bumptech.glide.Glide
class HorizontalAlbumAdapter( class HorizontalAlbumAdapter(
activity: FragmentActivity, activity: FragmentActivity,
dataSet: List<Album>, dataSet: List<Album>,
cabHolder: CabHolder?, ICabHolder: ICabHolder?,
albumClickListener: AlbumClickListener albumClickListener: AlbumClickListener
) : AlbumAdapter( ) : AlbumAdapter(
activity, dataSet, HorizontalAdapterHelper.LAYOUT_RES, cabHolder, albumClickListener activity, dataSet, HorizontalAdapterHelper.LAYOUT_RES, ICabHolder, albumClickListener
) { ) {
override fun createViewHolder(view: View, viewType: Int): ViewHolder { override fun createViewHolder(view: View, viewType: Int): ViewHolder {

View file

@ -16,7 +16,7 @@ import code.name.monkey.retromusic.fragments.artists.ArtistClickListener
import code.name.monkey.retromusic.glide.ArtistGlideRequest import code.name.monkey.retromusic.glide.ArtistGlideRequest
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Artist import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
@ -29,10 +29,10 @@ class ArtistAdapter(
val activity: FragmentActivity, val activity: FragmentActivity,
var dataSet: List<Artist>, var dataSet: List<Artist>,
var itemLayoutRes: Int, var itemLayoutRes: Int,
cabHolder: CabHolder?, ICabHolder: ICabHolder?,
private val artistClickListener: ArtistClickListener private val artistClickListener: ArtistClickListener
) : AbsMultiSelectAdapter<ArtistAdapter.ViewHolder, Artist>( ) : AbsMultiSelectAdapter<ArtistAdapter.ViewHolder, Artist>(
activity, cabHolder, R.menu.menu_media_selection activity, ICabHolder, R.menu.menu_media_selection
), PopupTextProvider { ), PopupTextProvider {
init { init {

View file

@ -15,21 +15,21 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.interfaces.CabHolder; import code.name.monkey.retromusic.interfaces.ICabHolder;
public abstract class AbsMultiSelectAdapter<V extends RecyclerView.ViewHolder, I> extends RecyclerView.Adapter<V> public abstract class AbsMultiSelectAdapter<V extends RecyclerView.ViewHolder, I> extends RecyclerView.Adapter<V>
implements MaterialCab.Callback { implements MaterialCab.Callback {
@Nullable @Nullable
private final CabHolder cabHolder; private final ICabHolder ICabHolder;
private final Context context; private final Context context;
private MaterialCab cab; private MaterialCab cab;
private List<I> checked; private List<I> checked;
private int menuRes; private int menuRes;
public AbsMultiSelectAdapter(@NonNull Context context, @Nullable CabHolder cabHolder, @MenuRes int menuRes) { public AbsMultiSelectAdapter(@NonNull Context context, @Nullable ICabHolder ICabHolder, @MenuRes int menuRes) {
this.cabHolder = cabHolder; this.ICabHolder = ICabHolder;
checked = new ArrayList<>(); checked = new ArrayList<>();
this.menuRes = menuRes; this.menuRes = menuRes;
this.context = context; this.context = context;
@ -59,7 +59,7 @@ public abstract class AbsMultiSelectAdapter<V extends RecyclerView.ViewHolder, I
} }
protected void checkAll() { protected void checkAll() {
if (cabHolder != null) { if (ICabHolder != null) {
checked.clear(); checked.clear();
for (int i = 0; i < getItemCount(); i++) { for (int i = 0; i < getItemCount(); i++) {
I identifier = getIdentifier(i); I identifier = getIdentifier(i);
@ -94,7 +94,7 @@ public abstract class AbsMultiSelectAdapter<V extends RecyclerView.ViewHolder, I
} }
protected boolean toggleChecked(final int position) { protected boolean toggleChecked(final int position) {
if (cabHolder != null) { if (ICabHolder != null) {
I identifier = getIdentifier(position); I identifier = getIdentifier(position);
if (identifier == null) { if (identifier == null) {
return false; return false;
@ -117,9 +117,9 @@ public abstract class AbsMultiSelectAdapter<V extends RecyclerView.ViewHolder, I
} }
private void updateCab() { private void updateCab() {
if (cabHolder != null) { if (ICabHolder != null) {
if (cab == null || !cab.isActive()) { if (cab == null || !cab.isActive()) {
cab = cabHolder.openCab(menuRes, this); cab = ICabHolder.openCab(menuRes, this);
} }
final int size = checked.size(); final int size = checked.size();
if (size <= 0) { if (size <= 0) {

View file

@ -27,7 +27,7 @@ import code.name.monkey.retromusic.extensions.hide
import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Playlist import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.repository.PlaylistSongsLoader import code.name.monkey.retromusic.repository.PlaylistSongsLoader
@ -39,10 +39,10 @@ class PlaylistAdapter(
private val activity: FragmentActivity, private val activity: FragmentActivity,
var dataSet: List<PlaylistWithSongs>, var dataSet: List<PlaylistWithSongs>,
private var itemLayoutRes: Int, private var itemLayoutRes: Int,
cabHolder: CabHolder? ICabHolder: ICabHolder?
) : AbsMultiSelectAdapter<PlaylistAdapter.ViewHolder, PlaylistWithSongs>( ) : AbsMultiSelectAdapter<PlaylistAdapter.ViewHolder, PlaylistWithSongs>(
activity, activity,
cabHolder, ICabHolder,
R.menu.menu_playlists_selection R.menu.menu_playlists_selection
) { ) {

View file

@ -7,15 +7,15 @@ import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
abstract class AbsOffsetSongAdapter( abstract class AbsOffsetSongAdapter(
activity: AppCompatActivity, activity: AppCompatActivity,
dataSet: MutableList<Song>, dataSet: MutableList<Song>,
@LayoutRes itemLayoutRes: Int, @LayoutRes itemLayoutRes: Int,
cabHolder: CabHolder? ICabHolder: ICabHolder?
) : SongAdapter(activity, dataSet, itemLayoutRes, cabHolder) { ) : SongAdapter(activity, dataSet, itemLayoutRes, ICabHolder) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongAdapter.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongAdapter.ViewHolder {
if (viewType == OFFSET_ITEM) { if (viewType == OFFSET_ITEM) {

View file

@ -9,7 +9,7 @@ import code.name.monkey.retromusic.db.PlaylistEntity
import code.name.monkey.retromusic.db.toSongEntity import code.name.monkey.retromusic.db.toSongEntity
import code.name.monkey.retromusic.db.toSongs import code.name.monkey.retromusic.db.toSongs
import code.name.monkey.retromusic.dialogs.RemoveSongFromPlaylistDialog import code.name.monkey.retromusic.dialogs.RemoveSongFromPlaylistDialog
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.PlaylistSong import code.name.monkey.retromusic.model.PlaylistSong
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.ViewUtil import code.name.monkey.retromusic.util.ViewUtil
@ -23,13 +23,13 @@ class OrderablePlaylistSongAdapter(
activity: FragmentActivity, activity: FragmentActivity,
dataSet: ArrayList<Song>, dataSet: ArrayList<Song>,
itemLayoutRes: Int, itemLayoutRes: Int,
cabHolder: CabHolder?, ICabHolder: ICabHolder?,
private val onMoveItemListener: OnMoveItemListener? private val onMoveItemListener: OnMoveItemListener?
) : SongAdapter( ) : SongAdapter(
activity, activity,
dataSet, dataSet,
itemLayoutRes, itemLayoutRes,
cabHolder ICabHolder
), DraggableItemAdapter<OrderablePlaylistSongAdapter.ViewHolder> { ), DraggableItemAdapter<OrderablePlaylistSongAdapter.ViewHolder> {
init { init {

View file

@ -8,7 +8,7 @@ import androidx.navigation.findNavController
import code.name.monkey.retromusic.EXTRA_ALBUM_ID import code.name.monkey.retromusic.EXTRA_ALBUM_ID
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
@ -16,8 +16,8 @@ open class PlaylistSongAdapter(
activity: AppCompatActivity, activity: AppCompatActivity,
dataSet: MutableList<Song>, dataSet: MutableList<Song>,
itemLayoutRes: Int, itemLayoutRes: Int,
cabHolder: CabHolder? ICabHolder: ICabHolder?
) : AbsOffsetSongAdapter(activity, dataSet, itemLayoutRes, cabHolder) { ) : AbsOffsetSongAdapter(activity, dataSet, itemLayoutRes, ICabHolder) {
init { init {
this.setMultiSelectMenuRes(R.menu.menu_cannot_delete_single_songs_playlist_songs_selection) this.setMultiSelectMenuRes(R.menu.menu_cannot_delete_single_songs_playlist_songs_selection)

View file

@ -4,7 +4,7 @@ import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
@ -12,8 +12,8 @@ class ShuffleButtonSongAdapter(
activity: AppCompatActivity, activity: AppCompatActivity,
dataSet: MutableList<Song>, dataSet: MutableList<Song>,
itemLayoutRes: Int, itemLayoutRes: Int,
cabHolder: CabHolder? ICabHolder: ICabHolder?
) : AbsOffsetSongAdapter(activity, dataSet, itemLayoutRes, cabHolder) { ) : AbsOffsetSongAdapter(activity, dataSet, itemLayoutRes, ICabHolder) {
override fun createViewHolder(view: View): SongAdapter.ViewHolder { override fun createViewHolder(view: View): SongAdapter.ViewHolder {
return ViewHolder(view) return ViewHolder(view)

View file

@ -3,7 +3,7 @@ package code.name.monkey.retromusic.adapter.song
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import java.util.* import java.util.*
@ -12,8 +12,8 @@ class SimpleSongAdapter(
context: FragmentActivity, context: FragmentActivity,
songs: ArrayList<Song>, songs: ArrayList<Song>,
layoutRes: Int, layoutRes: Int,
cabHolder: CabHolder? ICabHolder: ICabHolder?
) : SongAdapter(context, songs, layoutRes, cabHolder) { ) : SongAdapter(context, songs, layoutRes, ICabHolder) {
override fun swapDataSet(dataSet: List<Song>) { override fun swapDataSet(dataSet: List<Song>) {
this.dataSet = dataSet.toMutableList() this.dataSet = dataSet.toMutableList()

View file

@ -21,7 +21,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.SortOrder import code.name.monkey.retromusic.helper.SortOrder
import code.name.monkey.retromusic.helper.menu.SongMenuHelper import code.name.monkey.retromusic.helper.menu.SongMenuHelper
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper import code.name.monkey.retromusic.helper.menu.SongsMenuHelper
import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
@ -38,11 +38,11 @@ open class SongAdapter(
protected val activity: FragmentActivity, protected val activity: FragmentActivity,
var dataSet: MutableList<Song>, var dataSet: MutableList<Song>,
protected var itemLayoutRes: Int, protected var itemLayoutRes: Int,
cabHolder: CabHolder?, ICabHolder: ICabHolder?,
showSectionName: Boolean = true showSectionName: Boolean = true
) : AbsMultiSelectAdapter<SongAdapter.ViewHolder, Song>( ) : AbsMultiSelectAdapter<SongAdapter.ViewHolder, Song>(
activity, activity,
cabHolder, ICabHolder,
R.menu.menu_media_selection R.menu.menu_media_selection
), MaterialCab.Callback, PopupTextProvider { ), MaterialCab.Callback, PopupTextProvider {

View file

@ -1,6 +1,7 @@
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog
import android.media.MediaScannerConnection
import android.os.Bundle import android.os.Bundle
import android.widget.Toast import android.widget.Toast
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
@ -33,9 +34,15 @@ class SavePlaylistDialog : DialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
val playlistWithSongs: PlaylistWithSongs = val playlistWithSongs = extraNotNull<PlaylistWithSongs>(EXTRA_PLAYLIST).value
extraNotNull<PlaylistWithSongs>(EXTRA_PLAYLIST).value val file = PlaylistsUtil.savePlaylistWithSongs(playlistWithSongs)
val file = PlaylistsUtil.savePlaylistWithSongs(requireContext(), playlistWithSongs) MediaScannerConnection.scanFile(
requireActivity(),
arrayOf<String>(file.path),
null
) { _, _ ->
}
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
Toast.makeText( Toast.makeText(
requireContext(), requireContext(),

View file

@ -20,7 +20,6 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.EditText import android.widget.EditText
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.core.animation.doOnEnd
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior
@ -55,12 +54,6 @@ fun View.translateXAnimate(value: Float) {
.apply { .apply {
duration = 300 duration = 300
start() start()
doOnEnd {
if (value != 0f) {
this@translateXAnimate.hide()
}
}
} }
} }

View file

@ -8,7 +8,7 @@ import code.name.monkey.retromusic.TOP_ARTISTS
import code.name.monkey.retromusic.db.* import code.name.monkey.retromusic.db.*
import code.name.monkey.retromusic.fragments.ReloadType.* import code.name.monkey.retromusic.fragments.ReloadType.*
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.model.* import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
@ -21,24 +21,21 @@ import kotlinx.coroutines.launch
class LibraryViewModel( class LibraryViewModel(
private val repository: RealRepository private val repository: RealRepository
) : ViewModel(), MusicServiceEventListener { ) : ViewModel(), IMusicServiceEventListener {
private val _paletteColor = MutableLiveData<Int>() private val _paletteColor = MutableLiveData<Int>()
private val home = MutableLiveData<List<Home>>()
private val albums = MutableLiveData<List<Album>>() private val albums = MutableLiveData<List<Album>>()
private val songs = MutableLiveData<List<Song>>() private val songs = MutableLiveData<List<Song>>()
private val artists = MutableLiveData<List<Artist>>() private val artists = MutableLiveData<List<Artist>>()
private val playlists = MutableLiveData<List<PlaylistWithSongs>>() private val playlists = MutableLiveData<List<PlaylistWithSongs>>()
private val legacyPlaylists = MutableLiveData<List<Playlist>>() private val legacyPlaylists = MutableLiveData<List<Playlist>>()
private val genres = MutableLiveData<List<Genre>>() private val genres = MutableLiveData<List<Genre>>()
private val home = MutableLiveData<List<Home>>() private val searchResults = MutableLiveData<List<Any>>()
val paletteColor: LiveData<Int> = _paletteColor val paletteColor: LiveData<Int> = _paletteColor
val panelState: MutableLiveData<NowPlayingPanelState> = MutableLiveData<NowPlayingPanelState>() val panelState: MutableLiveData<NowPlayingPanelState> = MutableLiveData<NowPlayingPanelState>()
init {
fetchHomeSections()
}
fun setPanelState(state: NowPlayingPanelState) { fun setPanelState(state: NowPlayingPanelState) {
panelState.postValue(state) panelState.postValue(state)
} }
@ -52,6 +49,8 @@ class LibraryViewModel(
fetchPlaylists() fetchPlaylists()
} }
fun getSearchResult(): LiveData<List<Any>> = searchResults
fun getSongs(): LiveData<List<Song>> { fun getSongs(): LiveData<List<Song>> {
fetchSongs() fetchSongs()
return songs return songs
@ -83,6 +82,7 @@ class LibraryViewModel(
} }
fun getHome(): LiveData<List<Home>> { fun getHome(): LiveData<List<Home>> {
fetchHomeSections()
return home return home
} }
@ -134,6 +134,11 @@ class LibraryViewModel(
} }
} }
fun search(query: String?) = viewModelScope.launch(IO) {
val result = repository.search(query)
searchResults.postValue(result)
}
fun forceReload(reloadType: ReloadType) = viewModelScope.launch { fun forceReload(reloadType: ReloadType) = viewModelScope.launch {
when (reloadType) { when (reloadType) {
Songs -> fetchSongs() Songs -> fetchSongs()
@ -278,6 +283,16 @@ class LibraryViewModel(
} }
} }
} }
fun clearSearchResult() {
viewModelScope.launch {
searchResults.postValue(emptyList())
}
}
fun artist(artistId: Long): LiveData<Artist> = liveData {
emit(repository.artistById(artistId))
}
} }
enum class ReloadType { enum class ReloadType {

View file

@ -133,7 +133,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
playerActivity?.removeMusicServiceEventListener(detailsViewModel) serviceActivity?.removeMusicServiceEventListener(detailsViewModel)
} }

View file

@ -3,7 +3,7 @@ package code.name.monkey.retromusic.fragments.albums
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.liveData import androidx.lifecycle.liveData
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Artist import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.network.Result import code.name.monkey.retromusic.network.Result
@ -14,7 +14,7 @@ import kotlinx.coroutines.Dispatchers.IO
class AlbumDetailsViewModel( class AlbumDetailsViewModel(
private val repository: RealRepository, private val repository: RealRepository,
private val albumId: Long private val albumId: Long
) : ViewModel(), MusicServiceEventListener { ) : ViewModel(), IMusicServiceEventListener {
fun getAlbum(): LiveData<Album> = liveData(IO) { fun getAlbum(): LiveData<Album> = liveData(IO) {
emit(repository.albumByIdAsync(albumId)) emit(repository.albumByIdAsync(albumId))

View file

@ -3,7 +3,7 @@ package code.name.monkey.retromusic.fragments.artists
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.liveData import androidx.lifecycle.liveData
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.model.Artist import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.network.Result import code.name.monkey.retromusic.network.Result
import code.name.monkey.retromusic.network.model.LastFmArtist import code.name.monkey.retromusic.network.model.LastFmArtist
@ -13,7 +13,7 @@ import kotlinx.coroutines.Dispatchers.IO
class ArtistDetailsViewModel( class ArtistDetailsViewModel(
private val realRepository: RealRepository, private val realRepository: RealRepository,
private val artistId: Long private val artistId: Long
) : ViewModel(), MusicServiceEventListener { ) : ViewModel(), IMusicServiceEventListener {
fun getArtist(): LiveData<Artist> = liveData(IO) { fun getArtist(): LiveData<Artist> = liveData(IO) {
val artist = realRepository.artistById(artistId) val artist = realRepository.artistById(artistId)

View file

@ -10,7 +10,7 @@ import androidx.fragment.app.Fragment
import androidx.navigation.navOptions import androidx.navigation.navOptions
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.RetroUtil
import org.jaudiotagger.audio.AudioFileIO import org.jaudiotagger.audio.AudioFileIO
@ -23,7 +23,7 @@ import java.util.*
*/ */
open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout), open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout),
MusicServiceEventListener { IMusicServiceEventListener {
val navOptions by lazy { val navOptions by lazy {
navOptions { navOptions {
@ -40,13 +40,13 @@ open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout),
} }
} }
var playerActivity: AbsMusicServiceActivity? = null var serviceActivity: AbsMusicServiceActivity? = null
private set private set
override fun onAttach(context: Context) { override fun onAttach(context: Context) {
super.onAttach(context) super.onAttach(context)
try { try {
playerActivity = context as AbsMusicServiceActivity? serviceActivity = context as AbsMusicServiceActivity?
} catch (e: ClassCastException) { } catch (e: ClassCastException) {
throw RuntimeException(context.javaClass.simpleName + " must be an instance of " + AbsMusicServiceActivity::class.java.simpleName) throw RuntimeException(context.javaClass.simpleName + " must be an instance of " + AbsMusicServiceActivity::class.java.simpleName)
} }
@ -54,17 +54,17 @@ open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout),
override fun onDetach() { override fun onDetach() {
super.onDetach() super.onDetach()
playerActivity = null serviceActivity = null
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
playerActivity?.addMusicServiceEventListener(this) serviceActivity?.addMusicServiceEventListener(this)
} }
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
playerActivity?.removeMusicServiceEventListener(this) serviceActivity?.removeMusicServiceEventListener(this)
} }
override fun onPlayingMetaChanged() { override fun onPlayingMetaChanged() {

View file

@ -31,7 +31,7 @@ import code.name.monkey.retromusic.fragments.LibraryViewModel
import code.name.monkey.retromusic.fragments.ReloadType import code.name.monkey.retromusic.fragments.ReloadType
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.PaletteColorHolder import code.name.monkey.retromusic.interfaces.IPaletteColorHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.lyrics.Lyrics import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
@ -47,7 +47,7 @@ import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import java.io.FileNotFoundException import java.io.FileNotFoundException
abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragment(layout), abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragment(layout),
Toolbar.OnMenuItemClickListener, PaletteColorHolder, PlayerAlbumCoverFragment.Callbacks { Toolbar.OnMenuItemClickListener, IPaletteColorHolder, PlayerAlbumCoverFragment.Callbacks {
private var playerAlbumCoverFragment: PlayerAlbumCoverFragment? = null private var playerAlbumCoverFragment: PlayerAlbumCoverFragment? = null
protected val libraryViewModel by sharedViewModel<LibraryViewModel>() protected val libraryViewModel by sharedViewModel<LibraryViewModel>()

View file

@ -21,6 +21,8 @@ import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.text.Html; import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -41,6 +43,8 @@ import com.afollestad.materialcab.MaterialCab;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.IOException; import java.io.IOException;
@ -59,9 +63,9 @@ import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.menu.SongMenuHelper; import code.name.monkey.retromusic.helper.menu.SongMenuHelper;
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper; import code.name.monkey.retromusic.helper.menu.SongsMenuHelper;
import code.name.monkey.retromusic.interfaces.CabHolder; import code.name.monkey.retromusic.interfaces.ICabHolder;
import code.name.monkey.retromusic.interfaces.Callbacks; import code.name.monkey.retromusic.interfaces.ICallbacks;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks; import code.name.monkey.retromusic.interfaces.IMainActivityFragmentCallbacks;
import code.name.monkey.retromusic.misc.DialogAsyncTask; import code.name.monkey.retromusic.misc.DialogAsyncTask;
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener; import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader; import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader;
@ -76,10 +80,10 @@ import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListene
import me.zhanghai.android.fastscroll.FastScroller; import me.zhanghai.android.fastscroll.FastScroller;
public class FoldersFragment extends AbsMainActivityFragment implements public class FoldersFragment extends AbsMainActivityFragment implements
MainActivityFragmentCallbacks, IMainActivityFragmentCallbacks,
CabHolder, ICabHolder,
BreadCrumbLayout.SelectionCallback, BreadCrumbLayout.SelectionCallback,
Callbacks, ICallbacks,
LoaderManager.LoaderCallbacks<List<File>> { LoaderManager.LoaderCallbacks<List<File>> {
public static final String TAG = FoldersFragment.class.getSimpleName(); public static final String TAG = FoldersFragment.class.getSimpleName();
@ -137,6 +141,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
} }
@NonNull @NonNull
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
@ -159,13 +164,12 @@ public class FoldersFragment extends AbsMainActivityFragment implements
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
if (savedInstanceState == null) { if (savedInstanceState == null) {
//noinspection ConstantConditions
setCrumb(new BreadCrumbLayout.Crumb(FileUtil.safeGetCanonicalFile(PreferenceUtil.INSTANCE.getStartDirectory())), true); setCrumb(new BreadCrumbLayout.Crumb(FileUtil.safeGetCanonicalFile(PreferenceUtil.INSTANCE.getStartDirectory())), true);
} else { } else {
breadCrumbs.restoreFromStateWrapper(savedInstanceState.getParcelable(CRUMBS)); breadCrumbs.restoreFromStateWrapper(savedInstanceState.getParcelable(CRUMBS));
getLoaderManager().initLoader(LOADER_ID, null, this); LoaderManager.getInstance(this).initLoader(LOADER_ID, null, this);
} }
} }
@ -181,7 +185,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
if (breadCrumbs != null) { if (breadCrumbs != null) {
outState.putParcelable(CRUMBS, breadCrumbs.getStateWrapper()); outState.putParcelable(CRUMBS, breadCrumbs.getStateWrapper());
} }
} }
@Override @Override
@ -209,7 +212,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
@Override @Override
public void onFileMenuClicked(final File file, View view) { public void onFileMenuClicked(final File file, @NotNull View view) {
PopupMenu popupMenu = new PopupMenu(getActivity(), view); PopupMenu popupMenu = new PopupMenu(getActivity(), view);
if (file.isDirectory()) { if (file.isDirectory()) {
popupMenu.inflate(R.menu.menu_item_directory); popupMenu.inflate(R.menu.menu_item_directory);
@ -222,7 +225,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
case R.id.action_delete_from_device: case R.id.action_delete_from_device:
new ListSongsAsyncTask(getActivity(), null, (songs, extra) -> { new ListSongsAsyncTask(getActivity(), null, (songs, extra) -> {
if (!songs.isEmpty()) { if (!songs.isEmpty()) {
SongsMenuHelper.INSTANCE.handleMenuClick(getActivity(), songs, itemId); SongsMenuHelper.INSTANCE.handleMenuClick(requireActivity(), songs, itemId);
} }
}).execute(new ListSongsAsyncTask.LoadingInfo(toList(file), AUDIO_FILE_FILTER, }).execute(new ListSongsAsyncTask.LoadingInfo(toList(file), AUDIO_FILE_FILTER,
getFileComparator())); getFileComparator()));
@ -256,7 +259,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
case R.id.action_set_as_ringtone: case R.id.action_set_as_ringtone:
case R.id.action_delete_from_device: case R.id.action_delete_from_device:
new ListSongsAsyncTask(getActivity(), null, new ListSongsAsyncTask(getActivity(), null,
(songs, extra) -> SongMenuHelper.INSTANCE.handleMenuClick(getActivity(), (songs, extra) -> SongMenuHelper.INSTANCE.handleMenuClick(requireActivity(),
songs.get(0), itemId)) songs.get(0), itemId))
.execute(new ListSongsAsyncTask.LoadingInfo(toList(file), AUDIO_FILE_FILTER, .execute(new ListSongsAsyncTask.LoadingInfo(toList(file), AUDIO_FILE_FILTER,
getFileComparator())); getFileComparator()));
@ -273,7 +276,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
@Override @Override
public void onFileSelected(File file) { public void onFileSelected(@NotNull File file) {
file = tryGetCanonicalFile(file); // important as we compare the path value later file = tryGetCanonicalFile(file); // important as we compare the path value later
if (file.isDirectory()) { if (file.isDirectory()) {
setCrumb(new BreadCrumbLayout.Crumb(file), true); setCrumb(new BreadCrumbLayout.Crumb(file), true);
@ -319,13 +322,23 @@ public class FoldersFragment extends AbsMainActivityFragment implements
} }
@Override @Override
public void onMultipleItemAction(MenuItem item, ArrayList<File> files) { public void onMultipleItemAction(MenuItem item, @NotNull ArrayList<File> files) {
final int itemId = item.getItemId(); final int itemId = item.getItemId();
new ListSongsAsyncTask(getActivity(), null, new ListSongsAsyncTask(getActivity(), null,
(songs, extra) -> SongsMenuHelper.INSTANCE.handleMenuClick(getActivity(), songs, itemId)) (songs, extra) -> SongsMenuHelper.INSTANCE.handleMenuClick(requireActivity(), songs, itemId))
.execute(new ListSongsAsyncTask.LoadingInfo(files, AUDIO_FILE_FILTER, getFileComparator())); .execute(new ListSongsAsyncTask.LoadingInfo(files, AUDIO_FILE_FILTER, getFileComparator()));
} }
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
menu.add(0, R.id.action_scan, 0, R.string.scan_media).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(0, R.id.action_go_to_start_directory, 1, R.string.action_go_to_start_directory).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.removeItem(R.id.action_grid_size);
menu.removeItem(R.id.action_layout_type);
menu.removeItem(R.id.action_sort_order);
}
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
@ -360,7 +373,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
@NonNull @NonNull
@Override @Override
public MaterialCab openCab(int menuRes, MaterialCab.Callback callback) { public MaterialCab openCab(int menuRes, @NotNull MaterialCab.Callback callback) {
if (cab != null && cab.isActive()) { if (cab != null && cab.isActive()) {
cab.finish(); cab.finish();
} }
@ -438,7 +451,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
if (addToHistory) { if (addToHistory) {
breadCrumbs.addHistory(crumb); breadCrumbs.addHistory(crumb);
} }
getLoaderManager().restartLoader(LOADER_ID, null, this); LoaderManager.getInstance(this).restartLoader(LOADER_ID, null, this);
} }
private void setUpAdapter() { private void setUpAdapter() {

View file

@ -4,7 +4,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.model.Genre import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
@ -15,7 +15,7 @@ import kotlinx.coroutines.withContext
class GenreDetailsViewModel( class GenreDetailsViewModel(
private val realRepository: RealRepository, private val realRepository: RealRepository,
private val genre: Genre private val genre: Genre
) : ViewModel(), MusicServiceEventListener { ) : ViewModel(), IMusicServiceEventListener {
private val _playListSongs = MutableLiveData<List<Song>>() private val _playListSongs = MutableLiveData<List<Song>>()
private val _genre = MutableLiveData<Genre>().apply { private val _genre = MutableLiveData<Genre>().apply {

View file

@ -19,7 +19,6 @@ import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.state.NowPlayingPanelState import code.name.monkey.retromusic.state.NowPlayingPanelState
import kotlinx.android.synthetic.main.fragment_library.* import kotlinx.android.synthetic.main.fragment_library.*
import org.koin.androidx.viewmodel.ext.android.sharedViewModel import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import java.lang.String
class LibraryFragment : AbsMainActivityFragment(R.layout.fragment_library) { class LibraryFragment : AbsMainActivityFragment(R.layout.fragment_library) {

View file

@ -1,42 +0,0 @@
package code.name.monkey.retromusic.fragments.player
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.findNavController
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
import code.name.monkey.retromusic.util.PreferenceUtil
class NowPlayingPlayerFragment : Fragment(R.layout.fragment_now_playing_player) {
companion object {
const val TAG = "NowPlaying"
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
val navController = findNavController(R.id.playerFragmentContainer)
updateNowPlaying(navController)
}
private fun updateNowPlaying(navController: NavController) {
when (PreferenceUtil.nowPlayingScreen) {
Adaptive -> navController.navigate(R.id.adaptiveFragment)
Blur -> navController.navigate(R.id.blurPlayerFragment)
BlurCard -> navController.navigate(R.id.cardBlurFragment)
Card -> navController.navigate(R.id.cardFragment)
Circle -> navController.navigate(R.id.circlePlayerFragment)
Classic -> navController.navigate(R.id.classicPlayerFragment)
Color -> navController.navigate(R.id.colorFragment)
Fit -> navController.navigate(R.id.fitFragment)
Flat -> navController.navigate(R.id.flatPlayerFragment)
Full -> navController.navigate(R.id.fullPlayerFragment)
Gradient -> navController.navigate(R.id.gradientPlayerFragment)
Material -> navController.navigate(R.id.materialFragment)
Plain -> navController.navigate(R.id.plainPlayerFragment)
Simple -> navController.navigate(R.id.simplePlayerFragment)
Tiny -> navController.navigate(R.id.tinyPlayerFragment)
else -> navController.navigate(R.id.playerFragment)
}
}
}

View file

@ -37,7 +37,7 @@ class ColorFragment : AbsPlayerFragment(R.layout.fragment_color_player) {
navigationColor = color.backgroundColor navigationColor = color.backgroundColor
colorGradientBackground?.setBackgroundColor(color.backgroundColor) colorGradientBackground?.setBackgroundColor(color.backgroundColor)
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(color.backgroundColor)) serviceActivity?.setLightNavigationBar(ColorUtil.isColorLight(color.backgroundColor))
Handler().post { Handler().post {
ToolbarContentTintHelper.colorizeToolbar( ToolbarContentTintHelper.colorizeToolbar(
playerToolbar, playerToolbar,

View file

@ -8,7 +8,6 @@ import android.widget.FrameLayout
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.lifecycle.lifecycleScope
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.EXTRA_ARTIST_ID import code.name.monkey.retromusic.EXTRA_ARTIST_ID
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
@ -25,18 +24,12 @@ import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
import code.name.monkey.retromusic.model.lyrics.Lyrics import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.repository.ArtistRepository
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.fragment_full.* import kotlinx.android.synthetic.main.fragment_full.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.koin.android.ext.android.inject
class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full), class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full),
MusicProgressViewUpdateHelper.Callback { MusicProgressViewUpdateHelper.Callback {
private val artistRepository by inject<ArtistRepository>()
private lateinit var lyricsLayout: FrameLayout private lateinit var lyricsLayout: FrameLayout
private lateinit var lyricsLine1: TextView private lateinit var lyricsLine1: TextView
private lateinit var lyricsLine2: TextView private lateinit var lyricsLine2: TextView
@ -222,9 +215,8 @@ class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full),
} }
private fun updateArtistImage() { private fun updateArtistImage() {
lifecycleScope.launch { libraryViewModel.artist(MusicPlayerRemote.currentSong.artistId)
val artist = artistRepository.artist(MusicPlayerRemote.currentSong.artistId) .observe(viewLifecycleOwner, { artist ->
withContext(Dispatchers.Main) {
ArtistGlideRequest.Builder.from(Glide.with(requireContext()), artist) ArtistGlideRequest.Builder.from(Glide.with(requireContext()), artist)
.generatePalette(requireContext()) .generatePalette(requireContext())
.build() .build()
@ -233,8 +225,8 @@ class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full),
} }
}) })
} })
}
} }
override fun onQueueChanged() { override fun onQueueChanged() {

View file

@ -5,14 +5,14 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import code.name.monkey.retromusic.db.PlaylistWithSongs import code.name.monkey.retromusic.db.PlaylistWithSongs
import code.name.monkey.retromusic.db.SongEntity import code.name.monkey.retromusic.db.SongEntity
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
class PlaylistDetailsViewModel( class PlaylistDetailsViewModel(
private val realRepository: RealRepository, private val realRepository: RealRepository,
private var playlist: PlaylistWithSongs private var playlist: PlaylistWithSongs
) : ViewModel(), MusicServiceEventListener { ) : ViewModel(), IMusicServiceEventListener {
private val _playListSongs = MutableLiveData<List<Song>>() private val _playListSongs = MutableLiveData<List<Song>>()
private val _playlist = MutableLiveData<PlaylistWithSongs>().apply { private val _playlist = MutableLiveData<PlaylistWithSongs>().apply {

View file

@ -12,20 +12,19 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat.getSystemService import androidx.core.content.ContextCompat.getSystemService
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.transition.TransitionManager import androidx.transition.TransitionManager
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.SearchAdapter import code.name.monkey.retromusic.adapter.SearchAdapter
import code.name.monkey.retromusic.extensions.accentColor import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.extensions.dipToPix
import code.name.monkey.retromusic.extensions.showToast import code.name.monkey.retromusic.extensions.showToast
import code.name.monkey.retromusic.fragments.LibraryViewModel import code.name.monkey.retromusic.fragments.LibraryViewModel
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.state.NowPlayingPanelState import code.name.monkey.retromusic.state.NowPlayingPanelState
import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputEditText
import kotlinx.android.synthetic.main.fragment_search.* import kotlinx.android.synthetic.main.fragment_search.*
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.sharedViewModel import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -37,38 +36,37 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
} }
private val libraryViewModel by sharedViewModel<LibraryViewModel>() private val libraryViewModel by sharedViewModel<LibraryViewModel>()
private val viewModel: SearchViewModel by inject()
private lateinit var searchAdapter: SearchAdapter private lateinit var searchAdapter: SearchAdapter
private var query: String? = null private var query: String? = null
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
mainActivity.setSupportActionBar(toolbar)
libraryViewModel.setPanelState(NowPlayingPanelState.COLLAPSED_WITHOUT) libraryViewModel.setPanelState(NowPlayingPanelState.COLLAPSED_WITHOUT)
mainActivity.setSupportActionBar(toolbar)
libraryViewModel.clearSearchResult();
setupRecyclerView() setupRecyclerView()
keyboardPopup.accentColor()
searchView.addTextChangedListener(this) searchView.addTextChangedListener(this)
voiceSearch.setOnClickListener { startMicSearch() } voiceSearch.setOnClickListener { startMicSearch() }
clearText.setOnClickListener { searchView.clearText() } clearText.setOnClickListener { searchView.clearText() }
keyboardPopup.setOnClickListener { keyboardPopup.apply {
val inputManager = accentColor()
getSystemService<InputMethodManager>( setOnClickListener {
val inputManager = getSystemService(
requireContext(), requireContext(),
InputMethodManager::class.java InputMethodManager::class.java
) )
inputManager?.showSoftInput(searchView, InputMethodManager.SHOW_IMPLICIT) inputManager?.showSoftInput(searchView, InputMethodManager.SHOW_IMPLICIT)
} }
}
if (savedInstanceState != null) { if (savedInstanceState != null) {
query = savedInstanceState.getString(QUERY) query = savedInstanceState.getString(QUERY)
} }
libraryViewModel.getSearchResult().observe(viewLifecycleOwner, {
viewModel.getSearchResult().observe(viewLifecycleOwner, Observer {
showData(it) showData(it)
}) })
} }
private fun showData(data: MutableList<Any>) { private fun showData(data: List<Any>) {
if (data.isNotEmpty()) { if (data.isNotEmpty()) {
searchAdapter.swapDataSet(data) searchAdapter.swapDataSet(data)
} else { } else {
@ -83,6 +81,8 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
override fun onChanged() { override fun onChanged() {
super.onChanged() super.onChanged()
empty.isVisible = searchAdapter.itemCount < 1 empty.isVisible = searchAdapter.itemCount < 1
val height = dipToPix(52f)
recyclerView.setPadding(0, 0, 0, height.toInt())
} }
}) })
recyclerView.apply { recyclerView.apply {
@ -118,7 +118,7 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
TransitionManager.beginDelayedTransition(appBarLayout) TransitionManager.beginDelayedTransition(appBarLayout)
voiceSearch.isGone = query.isNotEmpty() voiceSearch.isGone = query.isNotEmpty()
clearText.isVisible = query.isNotEmpty() clearText.isVisible = query.isNotEmpty()
viewModel.search(query) libraryViewModel.search(query)
} }
private fun startMicSearch() { private fun startMicSearch() {

View file

@ -1,20 +0,0 @@
package code.name.monkey.retromusic.fragments.search
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import code.name.monkey.retromusic.repository.RealRepository
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
class SearchViewModel(private val realRepository: RealRepository) : ViewModel() {
private val results = MutableLiveData<MutableList<Any>>()
fun getSearchResult(): LiveData<MutableList<Any>> = results
fun search(query: String?) = viewModelScope.launch(IO) {
val result = realRepository.search(query)
results.postValue(result)
}
}

View file

@ -30,7 +30,7 @@ import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog
import code.name.monkey.retromusic.dialogs.DeleteSongsDialog import code.name.monkey.retromusic.dialogs.DeleteSongsDialog
import code.name.monkey.retromusic.dialogs.SongDetailDialog import code.name.monkey.retromusic.dialogs.SongDetailDialog
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.PaletteColorHolder import code.name.monkey.retromusic.interfaces.IPaletteColorHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
@ -90,10 +90,10 @@ object SongMenuHelper : KoinComponent {
R.id.action_tag_editor -> { R.id.action_tag_editor -> {
val tagEditorIntent = Intent(activity, SongTagEditorActivity::class.java) val tagEditorIntent = Intent(activity, SongTagEditorActivity::class.java)
tagEditorIntent.putExtra(AbsTagEditorActivity.EXTRA_ID, song.id) tagEditorIntent.putExtra(AbsTagEditorActivity.EXTRA_ID, song.id)
if (activity is PaletteColorHolder) if (activity is IPaletteColorHolder)
tagEditorIntent.putExtra( tagEditorIntent.putExtra(
AbsTagEditorActivity.EXTRA_PALETTE, AbsTagEditorActivity.EXTRA_PALETTE,
(activity as PaletteColorHolder).paletteColor (activity as IPaletteColorHolder).paletteColor
) )
activity.startActivity(tagEditorIntent) activity.startActivity(tagEditorIntent)
return true return true

View file

@ -17,7 +17,7 @@ package code.name.monkey.retromusic.interfaces
import com.afollestad.materialcab.MaterialCab import com.afollestad.materialcab.MaterialCab
interface CabHolder { interface ICabHolder {
fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab fun openCab(menuRes: Int, callback: MaterialCab.Callback): MaterialCab
} }

View file

@ -4,7 +4,7 @@ import android.view.MenuItem
import android.view.View import android.view.View
import java.io.File import java.io.File
interface Callbacks { interface ICallbacks {
fun onFileSelected(file: File) fun onFileSelected(file: File)
fun onFileMenuClicked(file: File, view: View) fun onFileMenuClicked(file: File, view: View)

View file

@ -16,6 +16,6 @@ package code.name.monkey.retromusic.interfaces
/** /**
* Created by hemanths on 14/08/17. * Created by hemanths on 14/08/17.
*/ */
internal interface MainActivityFragmentCallbacks { interface IMainActivityFragmentCallbacks {
fun handleBackPress(): Boolean fun handleBackPress(): Boolean
} }

View file

@ -15,7 +15,7 @@
package code.name.monkey.retromusic.interfaces package code.name.monkey.retromusic.interfaces
interface MusicServiceEventListener { interface IMusicServiceEventListener {
fun onServiceConnected() fun onServiceConnected()
fun onServiceDisconnected() fun onServiceDisconnected()

View file

@ -17,6 +17,6 @@ package code.name.monkey.retromusic.interfaces
/** /**
* @author Aidan Follestad (afollestad) * @author Aidan Follestad (afollestad)
*/ */
interface PaletteColorHolder { interface IPaletteColorHolder {
val paletteColor: Int val paletteColor: Int
} }

View file

@ -24,6 +24,7 @@ import code.name.monkey.retromusic.Constants.IS_MUSIC
import code.name.monkey.retromusic.Constants.baseProjection import code.name.monkey.retromusic.Constants.baseProjection
import code.name.monkey.retromusic.extensions.getLong import code.name.monkey.retromusic.extensions.getLong
import code.name.monkey.retromusic.extensions.getString import code.name.monkey.retromusic.extensions.getString
import code.name.monkey.retromusic.extensions.getStringOrNull
import code.name.monkey.retromusic.model.Genre import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
@ -53,9 +54,9 @@ class RealGenreRepository(
private fun getGenreFromCursor(cursor: Cursor): Genre { private fun getGenreFromCursor(cursor: Cursor): Genre {
val id = cursor.getLong(Genres._ID) val id = cursor.getLong(Genres._ID)
val name = cursor.getString(Genres.NAME) val name = cursor.getStringOrNull(Genres.NAME)
val songCount = songs(id).size val songCount = songs(id).size
return Genre(id, name, songCount) return Genre(id, name ?: "", songCount)
} }

View file

@ -251,7 +251,7 @@ public class PlaylistsUtil {
return M3UWriter.write(new File(Environment.getExternalStorageDirectory(), "Playlists"), playlist); return M3UWriter.write(new File(Environment.getExternalStorageDirectory(), "Playlists"), playlist);
} }
public static File savePlaylistWithSongs(Context context, PlaylistWithSongs playlist) throws IOException { public static File savePlaylistWithSongs(PlaylistWithSongs playlist) throws IOException {
return M3UWriter.writeIO(new File(Environment.getExternalStorageDirectory(), "Playlists"), playlist); return M3UWriter.writeIO(new File(Environment.getExternalStorageDirectory(), "Playlists"), playlist);
} }

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/playerFragmentContainer"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/now_playing" />

View file

@ -21,9 +21,8 @@
app:behavior_peekHeight="0dp" app:behavior_peekHeight="0dp"
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior"> app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
<androidx.fragment.app.FragmentContainerView <FrameLayout
android:id="@+id/playerFragmentContainer" android:id="@+id/playerFragmentContainer"
android:name="code.name.monkey.retromusic.fragments.player.NowPlayingPlayerFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />

View file

@ -90,6 +90,7 @@
<menu></menu> <menu></menu>
</item> </item>
<item <item
android:orderInCategory="10"
android:id="@+id/action_settings" android:id="@+id/action_settings"
android:icon="@drawable/ic_settings" android:icon="@drawable/ic_settings"
android:title="@string/action_settings" android:title="@string/action_settings"

View file

@ -1,165 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/now_playing"
app:startDestination="@id/mainPlayerFragment">
<fragment
tools:layout="@layout/fragment_player"
android:id="@+id/playerFragment"
android:name="code.name.monkey.retromusic.fragments.player.normal.PlayerFragment"
android:label="PlayerFragment" />
<fragment
tools:layout="@layout/fragment_adaptive_player"
android:id="@+id/adaptiveFragment"
android:name="code.name.monkey.retromusic.fragments.player.adaptive.AdaptiveFragment"
android:label="AdaptiveFragment" />
<fragment
tools:layout="@layout/fragment_blur"
android:id="@+id/blurPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.blur.BlurPlayerFragment"
android:label="BlurPlayerFragment" />
<fragment
tools:layout="@layout/fragment_card_blur_player"
android:id="@+id/cardBlurFragment"
android:name="code.name.monkey.retromusic.fragments.player.cardblur.CardBlurFragment"
android:label="CardBlurFragment" />
<fragment
tools:layout="@layout/fragment_card_player"
android:id="@+id/cardFragment"
android:name="code.name.monkey.retromusic.fragments.player.card.CardFragment"
android:label="CardFragment" />
<fragment
tools:layout="@layout/fragment_circle_player"
android:id="@+id/circlePlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.circle.CirclePlayerFragment"
android:label="CirclePlayerFragment" />
<fragment
tools:layout="@layout/fragment_classic_player"
android:id="@+id/classicPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.classic.ClassicPlayerFragment"
android:label="ClassicPlayerFragment" />
<fragment
tools:layout="@layout/fragment_color_player"
android:id="@+id/colorFragment"
android:name="code.name.monkey.retromusic.fragments.player.color.ColorFragment"
android:label="ColorFragment" />
<fragment
tools:layout="@layout/fragment_fit"
android:id="@+id/fitFragment"
android:name="code.name.monkey.retromusic.fragments.player.fit.FitFragment"
android:label="FitFragment" />
<fragment
tools:layout="@layout/fragment_flat_player"
android:id="@+id/flatPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.flat.FlatPlayerFragment"
android:label="FlatPlayerFragment" />
<fragment
tools:layout="@layout/fragment_full"
android:id="@+id/fullPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.full.FullPlayerFragment"
android:label="FullPlayerFragment" />
<fragment
tools:layout="@layout/fragment_gradient_player"
android:id="@+id/gradientPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.gradient.GradientPlayerFragment"
android:label="GradientPlayerFragment" />
<fragment
tools:layout="@layout/fragment_material"
android:id="@+id/materialFragment"
android:name="code.name.monkey.retromusic.fragments.player.material.MaterialFragment"
android:label="MaterialFragment" />
<fragment
android:id="@+id/peakPlayerFragment"
tools:layout="@layout/fragment_peak_player"
android:name="code.name.monkey.retromusic.fragments.player.peak.PeakPlayerFragment"
android:label="PeakPlayerFragment" />
<fragment
android:id="@+id/plainPlayerFragment"
tools:layout="@layout/fragment_plain_player"
android:name="code.name.monkey.retromusic.fragments.player.plain.PlainPlayerFragment"
android:label="PlainPlayerFragment" />
<fragment
tools:layout="@layout/fragment_simple_player"
android:id="@+id/simplePlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.simple.SimplePlayerFragment"
android:label="SimplePlayerFragment" />
<fragment
tools:layout="@layout/fragment_tiny_player"
android:id="@+id/tinyPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment"
android:label="TinyPlayerFragment" />
<fragment
android:id="@+id/mainPlayerFragment"
android:name="code.name.monkey.retromusic.fragments.player.NowPlayingPlayerFragment"
android:label="MainPlayerFragment">
<action
android:id="@+id/action_mainPlayerFragment_to_adaptiveFragment"
app:destination="@id/adaptiveFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_cardBlurFragment"
app:destination="@id/cardBlurFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_circlePlayerFragment"
app:destination="@id/circlePlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_blurPlayerFragment"
app:destination="@id/blurPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_classicPlayerFragment"
app:destination="@id/classicPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_plainPlayerFragment"
app:destination="@id/plainPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_flatPlayerFragment"
app:destination="@id/flatPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_gradientPlayerFragment"
app:destination="@id/gradientPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_cardFragment"
app:destination="@id/cardFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_fitFragment"
app:destination="@id/fitFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_simplePlayerFragment"
app:destination="@id/simplePlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_fullPlayerFragment"
app:destination="@id/fullPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_colorFragment"
app:destination="@id/colorFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_peakPlayerFragment"
app:destination="@id/peakPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_tinyPlayerFragment"
app:destination="@id/tinyPlayerFragment" />
<action
android:id="@+id/action_mainPlayerFragment_to_materialFragment"
app:destination="@id/materialFragment" />
<action
android:id="@+id/action_mainPlayer_to_playerFragment"
app:destination="@id/playerFragment" />
</fragment>
</navigation>