Classified fragment classes into suitable packages & optimized imports
This commit is contained in:
parent
5e16b79d23
commit
9f5b9d32ad
21 changed files with 279 additions and 290 deletions
|
@ -107,11 +107,9 @@
|
||||||
<data android:mimeType="vnd.android.cursor.dir/audio" />
|
<data android:mimeType="vnd.android.cursor.dir/audio" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activities.PlayingQueueActivity" />
|
|
||||||
<activity android:name=".activities.SettingsActivity" />
|
<activity android:name=".activities.SettingsActivity" />
|
||||||
<activity android:name=".activities.tageditor.AlbumTagEditorActivity" />
|
<activity android:name=".activities.tageditor.AlbumTagEditorActivity" />
|
||||||
<activity android:name=".activities.tageditor.SongTagEditorActivity" />
|
<activity android:name=".activities.tageditor.SongTagEditorActivity" />
|
||||||
<activity android:name=".fragments.LyricsActivity" />
|
|
||||||
<activity android:name=".activities.SupportDevelopmentActivity" />
|
<activity android:name=".activities.SupportDevelopmentActivity" />
|
||||||
<activity android:name=".activities.LicenseActivity" />
|
<activity android:name=".activities.LicenseActivity" />
|
||||||
<activity android:name=".activities.PurchaseActivity" />
|
<activity android:name=".activities.PurchaseActivity" />
|
||||||
|
|
|
@ -1,202 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020 Hemanth Savarla.
|
|
||||||
*
|
|
||||||
* 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.activities
|
|
||||||
|
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.MenuItem
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
|
||||||
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.activities.base.AbsMusicServiceActivity
|
|
||||||
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
|
||||||
import code.name.monkey.retromusic.databinding.ActivityPlayingQueueBinding
|
|
||||||
import code.name.monkey.retromusic.extensions.accentColor
|
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
|
||||||
import code.name.monkey.retromusic.util.ThemedFastScroller
|
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
|
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
|
||||||
|
|
||||||
open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|
||||||
|
|
||||||
private lateinit var binding: ActivityPlayingQueueBinding
|
|
||||||
private var wrappedAdapter: RecyclerView.Adapter<*>? = null
|
|
||||||
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
|
|
||||||
private var recyclerViewSwipeManager: RecyclerViewSwipeManager? = null
|
|
||||||
private var recyclerViewTouchActionGuardManager: RecyclerViewTouchActionGuardManager? = null
|
|
||||||
private var playingQueueAdapter: PlayingQueueAdapter? = null
|
|
||||||
private lateinit var linearLayoutManager: LinearLayoutManager
|
|
||||||
|
|
||||||
private fun getUpNextAndQueueTime(): String {
|
|
||||||
val duration = MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.position)
|
|
||||||
return MusicUtil.buildInfoString(
|
|
||||||
resources.getString(R.string.up_next),
|
|
||||||
MusicUtil.getReadableDurationString(duration)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
setDrawUnderStatusBar()
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
binding = ActivityPlayingQueueBinding.inflate(layoutInflater)
|
|
||||||
setContentView(binding.root)
|
|
||||||
setLightStatusbarAuto(ATHUtil.resolveColor(this, R.attr.colorSurface))
|
|
||||||
setTaskDescriptionColorAuto()
|
|
||||||
|
|
||||||
setupToolbar()
|
|
||||||
setUpRecyclerView()
|
|
||||||
|
|
||||||
binding.clearQueue.setOnClickListener {
|
|
||||||
MusicPlayerRemote.clearQueue()
|
|
||||||
}
|
|
||||||
checkForPadding()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
return when (item.itemId) {
|
|
||||||
android.R.id.home -> {
|
|
||||||
onBackPressed()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
else -> super.onOptionsItemSelected(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setUpRecyclerView() {
|
|
||||||
recyclerViewTouchActionGuardManager = RecyclerViewTouchActionGuardManager()
|
|
||||||
recyclerViewDragDropManager = RecyclerViewDragDropManager()
|
|
||||||
recyclerViewSwipeManager = RecyclerViewSwipeManager()
|
|
||||||
|
|
||||||
val animator = DraggableItemAnimator()
|
|
||||||
animator.supportsChangeAnimations = false
|
|
||||||
|
|
||||||
playingQueueAdapter = PlayingQueueAdapter(
|
|
||||||
this,
|
|
||||||
MusicPlayerRemote.playingQueue.toMutableList(),
|
|
||||||
MusicPlayerRemote.position,
|
|
||||||
R.layout.item_queue
|
|
||||||
)
|
|
||||||
wrappedAdapter = recyclerViewDragDropManager?.createWrappedAdapter(playingQueueAdapter!!)
|
|
||||||
wrappedAdapter = wrappedAdapter?.let { recyclerViewSwipeManager?.createWrappedAdapter(it) }
|
|
||||||
|
|
||||||
linearLayoutManager = LinearLayoutManager(this)
|
|
||||||
|
|
||||||
binding.recyclerView.layoutManager = linearLayoutManager
|
|
||||||
binding.recyclerView.adapter = wrappedAdapter
|
|
||||||
binding.recyclerView.itemAnimator = animator
|
|
||||||
recyclerViewTouchActionGuardManager?.attachRecyclerView(binding.recyclerView)
|
|
||||||
recyclerViewDragDropManager?.attachRecyclerView(binding.recyclerView)
|
|
||||||
recyclerViewSwipeManager?.attachRecyclerView(binding.recyclerView)
|
|
||||||
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
|
||||||
|
|
||||||
binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
||||||
super.onScrolled(recyclerView, dx, dy)
|
|
||||||
if (dy > 0) {
|
|
||||||
binding.clearQueue.shrink()
|
|
||||||
} else if (dy < 0) {
|
|
||||||
binding.clearQueue.extend()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
ThemedFastScroller.create(binding.recyclerView)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkForPadding() {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onQueueChanged() {
|
|
||||||
if (MusicPlayerRemote.playingQueue.isEmpty()) {
|
|
||||||
finish()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
checkForPadding()
|
|
||||||
updateQueue()
|
|
||||||
updateCurrentSong()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMediaStoreChanged() {
|
|
||||||
updateQueue()
|
|
||||||
updateCurrentSong()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateCurrentSong() {
|
|
||||||
binding.toolbar.subtitle = getUpNextAndQueueTime()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPlayingMetaChanged() {
|
|
||||||
updateQueuePosition()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateQueuePosition() {
|
|
||||||
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
|
|
||||||
resetToCurrentPosition()
|
|
||||||
binding.toolbar.subtitle = getUpNextAndQueueTime()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateQueue() {
|
|
||||||
playingQueueAdapter?.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
|
|
||||||
resetToCurrentPosition()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun resetToCurrentPosition() {
|
|
||||||
binding.recyclerView.stopScroll()
|
|
||||||
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
if (recyclerViewDragDropManager != null) {
|
|
||||||
recyclerViewDragDropManager!!.cancelDrag()
|
|
||||||
}
|
|
||||||
super.onPause()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
if (recyclerViewDragDropManager != null) {
|
|
||||||
recyclerViewDragDropManager!!.release()
|
|
||||||
recyclerViewDragDropManager = null
|
|
||||||
}
|
|
||||||
if (recyclerViewSwipeManager != null) {
|
|
||||||
recyclerViewSwipeManager?.release()
|
|
||||||
recyclerViewSwipeManager = null
|
|
||||||
}
|
|
||||||
if (wrappedAdapter != null) {
|
|
||||||
WrapperAdapterUtils.releaseAll(wrappedAdapter)
|
|
||||||
wrappedAdapter = null
|
|
||||||
}
|
|
||||||
playingQueueAdapter = null
|
|
||||||
super.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupToolbar() {
|
|
||||||
binding.toolbar.subtitle = getUpNextAndQueueTime()
|
|
||||||
//binding.toolbar.setBackgroundColor(surfaceColor())
|
|
||||||
setSupportActionBar(binding.toolbar)
|
|
||||||
binding.clearQueue.backgroundTintList = ColorStateList.valueOf(accentColor())
|
|
||||||
ColorStateList.valueOf(
|
|
||||||
MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(accentColor()))
|
|
||||||
).apply {
|
|
||||||
binding.clearQueue.setTextColor(this)
|
|
||||||
binding.clearQueue.iconTint = this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,10 +32,10 @@ import code.name.monkey.retromusic.RetroBottomSheetBehavior
|
||||||
import code.name.monkey.retromusic.databinding.SlidingMusicPanelLayoutBinding
|
import code.name.monkey.retromusic.databinding.SlidingMusicPanelLayoutBinding
|
||||||
import code.name.monkey.retromusic.extensions.*
|
import code.name.monkey.retromusic.extensions.*
|
||||||
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.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.base.AbsPlayerFragment
|
||||||
|
import code.name.monkey.retromusic.fragments.other.MiniPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.adaptive.AdaptiveFragment
|
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.blur.BlurPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.card.CardFragment
|
import code.name.monkey.retromusic.fragments.player.card.CardFragment
|
||||||
|
|
|
@ -29,7 +29,6 @@ import android.view.LayoutInflater
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.databinding.ActivityAlbumTagEditorBinding
|
import code.name.monkey.retromusic.databinding.ActivityAlbumTagEditorBinding
|
||||||
import code.name.monkey.retromusic.extensions.appHandleColor
|
import code.name.monkey.retromusic.extensions.appHandleColor
|
||||||
|
|
|
@ -16,7 +16,6 @@ package code.name.monkey.retromusic.adapter.song
|
||||||
|
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.glide.GlideApp
|
import code.name.monkey.retromusic.glide.GlideApp
|
||||||
|
@ -41,7 +40,7 @@ import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultAct
|
||||||
import me.zhanghai.android.fastscroll.PopupTextProvider
|
import me.zhanghai.android.fastscroll.PopupTextProvider
|
||||||
|
|
||||||
class PlayingQueueAdapter(
|
class PlayingQueueAdapter(
|
||||||
activity: AppCompatActivity,
|
activity: FragmentActivity,
|
||||||
dataSet: MutableList<Song>,
|
dataSet: MutableList<Song>,
|
||||||
private var current: Int,
|
private var current: Int,
|
||||||
itemLayoutRes: Int
|
itemLayoutRes: Int
|
||||||
|
|
|
@ -20,7 +20,7 @@ import android.view.animation.AccelerateInterpolator
|
||||||
import android.view.animation.DecelerateInterpolator
|
import android.view.animation.DecelerateInterpolator
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.fragments.VolumeFragment
|
import code.name.monkey.retromusic.fragments.other.VolumeFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package code.name.monkey.retromusic.fragments
|
package code.name.monkey.retromusic.fragments.other
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
|
@ -12,7 +12,7 @@
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package code.name.monkey.retromusic.fragments
|
package code.name.monkey.retromusic.fragments.other
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.InputType
|
import android.text.InputType
|
|
@ -12,7 +12,7 @@
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package code.name.monkey.retromusic.fragments
|
package code.name.monkey.retromusic.fragments.other
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
|
@ -0,0 +1,159 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 Hemanth Savarla.
|
||||||
|
*
|
||||||
|
* 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.fragments.other
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.navigation.findNavController
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import code.name.monkey.retromusic.R
|
||||||
|
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||||
|
import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewFragment
|
||||||
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
|
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
|
||||||
|
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
||||||
|
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
||||||
|
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
||||||
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hemanths on 2019-12-08.
|
||||||
|
*/
|
||||||
|
class PlayingQueueRVFragment : AbsRecyclerViewFragment<PlayingQueueAdapter, LinearLayoutManager>() {
|
||||||
|
|
||||||
|
private lateinit var wrappedAdapter: RecyclerView.Adapter<*>
|
||||||
|
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
|
||||||
|
private var recyclerViewSwipeManager: RecyclerViewSwipeManager? = null
|
||||||
|
private var recyclerViewTouchActionGuardManager: RecyclerViewTouchActionGuardManager? = null
|
||||||
|
override val titleRes: Int
|
||||||
|
get() = R.string.now_playing_queue
|
||||||
|
override val isShuffleVisible: Boolean
|
||||||
|
get() = false
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
setupRecyclerView()
|
||||||
|
setupToolbar()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupToolbar() {
|
||||||
|
toolbar().apply {
|
||||||
|
setNavigationOnClickListener {
|
||||||
|
findNavController().navigateUp()
|
||||||
|
}
|
||||||
|
setNavigationIcon(R.drawable.ic_keyboard_backspace_black)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupRecyclerView() {
|
||||||
|
recyclerViewTouchActionGuardManager = RecyclerViewTouchActionGuardManager()
|
||||||
|
recyclerViewDragDropManager = RecyclerViewDragDropManager()
|
||||||
|
recyclerViewSwipeManager = RecyclerViewSwipeManager()
|
||||||
|
|
||||||
|
val animator = DraggableItemAnimator()
|
||||||
|
animator.supportsChangeAnimations = false
|
||||||
|
wrappedAdapter =
|
||||||
|
recyclerViewDragDropManager?.createWrappedAdapter(adapter!!) as RecyclerView.Adapter<*>
|
||||||
|
wrappedAdapter =
|
||||||
|
recyclerViewSwipeManager?.createWrappedAdapter(wrappedAdapter) as RecyclerView.Adapter<*>
|
||||||
|
recyclerView().layoutManager = layoutManager
|
||||||
|
recyclerView().adapter = wrappedAdapter
|
||||||
|
recyclerView().itemAnimator = animator
|
||||||
|
recyclerViewTouchActionGuardManager?.attachRecyclerView(recyclerView())
|
||||||
|
recyclerViewDragDropManager?.attachRecyclerView(recyclerView())
|
||||||
|
recyclerViewSwipeManager?.attachRecyclerView(recyclerView())
|
||||||
|
|
||||||
|
layoutManager?.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createLayoutManager(): LinearLayoutManager {
|
||||||
|
return LinearLayoutManager(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createAdapter(): PlayingQueueAdapter {
|
||||||
|
return PlayingQueueAdapter(
|
||||||
|
requireActivity() as AppCompatActivity,
|
||||||
|
MusicPlayerRemote.playingQueue.toMutableList(),
|
||||||
|
MusicPlayerRemote.position,
|
||||||
|
R.layout.item_queue
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onServiceConnected() {
|
||||||
|
super.onServiceConnected()
|
||||||
|
updateQueue()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onQueueChanged() {
|
||||||
|
super.onQueueChanged()
|
||||||
|
updateQueue()
|
||||||
|
mainActivity.hideBottomBar(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPlayingMetaChanged() {
|
||||||
|
updateQueuePosition()
|
||||||
|
mainActivity.hideBottomBar(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateQueuePosition() {
|
||||||
|
adapter?.setCurrent(MusicPlayerRemote.position)
|
||||||
|
resetToCurrentPosition()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateQueue() {
|
||||||
|
adapter?.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
|
||||||
|
resetToCurrentPosition()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun resetToCurrentPosition() {
|
||||||
|
recyclerView().stopScroll()
|
||||||
|
layoutManager?.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
recyclerViewDragDropManager?.cancelDrag()
|
||||||
|
super.onPause()
|
||||||
|
}
|
||||||
|
|
||||||
|
override val emptyMessage: Int
|
||||||
|
get() = R.string.no_playing_queue
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
if (recyclerViewDragDropManager != null) {
|
||||||
|
recyclerViewDragDropManager?.release()
|
||||||
|
recyclerViewDragDropManager = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (recyclerViewSwipeManager != null) {
|
||||||
|
recyclerViewSwipeManager?.release()
|
||||||
|
recyclerViewSwipeManager = null
|
||||||
|
}
|
||||||
|
|
||||||
|
WrapperAdapterUtils.releaseAll(wrappedAdapter)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmField
|
||||||
|
val TAG: String = PlayingQueueRVFragment::class.java.simpleName
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun newInstance(): PlayingQueueRVFragment {
|
||||||
|
return PlayingQueueRVFragment()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package code.name.monkey.retromusic.fragments
|
package code.name.monkey.retromusic.fragments.other
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
|
@ -12,7 +12,7 @@
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package code.name.monkey.retromusic.fragments
|
package code.name.monkey.retromusic.fragments.other
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
|
@ -38,11 +38,11 @@ import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||||
import code.name.monkey.retromusic.databinding.FragmentClassicPlayerBinding
|
import code.name.monkey.retromusic.databinding.FragmentClassicPlayerBinding
|
||||||
import code.name.monkey.retromusic.extensions.hide
|
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.fragments.VolumeFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.base.goToAlbum
|
import code.name.monkey.retromusic.fragments.base.goToAlbum
|
||||||
import code.name.monkey.retromusic.fragments.base.goToArtist
|
import code.name.monkey.retromusic.fragments.base.goToArtist
|
||||||
|
import code.name.monkey.retromusic.fragments.other.VolumeFragment
|
||||||
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.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
|
|
|
@ -21,7 +21,6 @@ import android.view.View
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.core.animation.doOnEnd
|
import androidx.core.animation.doOnEnd
|
||||||
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.ToolbarContentTintHelper
|
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.databinding.FragmentColorPlayerBinding
|
import code.name.monkey.retromusic.databinding.FragmentColorPlayerBinding
|
||||||
|
|
|
@ -43,11 +43,11 @@ import code.name.monkey.retromusic.db.toSongEntity
|
||||||
import code.name.monkey.retromusic.extensions.hide
|
import code.name.monkey.retromusic.extensions.hide
|
||||||
import code.name.monkey.retromusic.extensions.ripAlpha
|
import code.name.monkey.retromusic.extensions.ripAlpha
|
||||||
import code.name.monkey.retromusic.extensions.show
|
import code.name.monkey.retromusic.extensions.show
|
||||||
import code.name.monkey.retromusic.fragments.VolumeFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerControlsFragment
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.base.goToAlbum
|
import code.name.monkey.retromusic.fragments.base.goToAlbum
|
||||||
import code.name.monkey.retromusic.fragments.base.goToArtist
|
import code.name.monkey.retromusic.fragments.base.goToArtist
|
||||||
|
import code.name.monkey.retromusic.fragments.other.VolumeFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||||
|
@ -55,7 +55,6 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
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
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior.*
|
import com.google.android.material.bottomsheet.BottomSheetBehavior.*
|
||||||
|
|
|
@ -36,7 +36,6 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||||
import code.name.monkey.retromusic.service.MusicService
|
import code.name.monkey.retromusic.service.MusicService
|
||||||
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
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,146 +14,185 @@
|
||||||
*/
|
*/
|
||||||
package code.name.monkey.retromusic.fragments.queue
|
package code.name.monkey.retromusic.fragments.queue
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
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.R
|
||||||
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewFragment
|
import code.name.monkey.retromusic.databinding.FragmentPlayingQueueBinding
|
||||||
|
import code.name.monkey.retromusic.extensions.accentColor
|
||||||
|
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
|
import code.name.monkey.retromusic.util.ThemedFastScroller
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
|
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||||
|
|
||||||
/**
|
class PlayingQueueFragment : AbsMusicServiceFragment(R.layout.fragment_playing_queue) {
|
||||||
* Created by hemanths on 2019-12-08.
|
|
||||||
*/
|
|
||||||
class PlayingQueueFragment : AbsRecyclerViewFragment<PlayingQueueAdapter, LinearLayoutManager>() {
|
|
||||||
|
|
||||||
private lateinit var wrappedAdapter: RecyclerView.Adapter<*>
|
private var _binding: FragmentPlayingQueueBinding? = null
|
||||||
|
private val binding get() = _binding!!
|
||||||
|
private var wrappedAdapter: RecyclerView.Adapter<*>? = null
|
||||||
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
|
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
|
||||||
private var recyclerViewSwipeManager: RecyclerViewSwipeManager? = null
|
private var recyclerViewSwipeManager: RecyclerViewSwipeManager? = null
|
||||||
private var recyclerViewTouchActionGuardManager: RecyclerViewTouchActionGuardManager? = null
|
private var recyclerViewTouchActionGuardManager: RecyclerViewTouchActionGuardManager? = null
|
||||||
override val titleRes: Int
|
private var playingQueueAdapter: PlayingQueueAdapter? = null
|
||||||
get() = R.string.now_playing_queue
|
private lateinit var linearLayoutManager: LinearLayoutManager
|
||||||
override val isShuffleVisible: Boolean
|
|
||||||
get() = false
|
private fun getUpNextAndQueueTime(): String {
|
||||||
|
val duration = MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.position)
|
||||||
|
return MusicUtil.buildInfoString(
|
||||||
|
resources.getString(R.string.up_next),
|
||||||
|
MusicUtil.getReadableDurationString(duration)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
setupRecyclerView()
|
_binding = FragmentPlayingQueueBinding.bind(view)
|
||||||
|
|
||||||
setupToolbar()
|
setupToolbar()
|
||||||
|
setUpRecyclerView()
|
||||||
|
|
||||||
|
binding.clearQueue.setOnClickListener {
|
||||||
|
MusicPlayerRemote.clearQueue()
|
||||||
|
}
|
||||||
|
checkForPadding()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupToolbar() {
|
private fun setUpRecyclerView() {
|
||||||
toolbar().apply {
|
|
||||||
setNavigationOnClickListener {
|
|
||||||
findNavController().navigateUp()
|
|
||||||
}
|
|
||||||
setNavigationIcon(R.drawable.ic_keyboard_backspace_black)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupRecyclerView() {
|
|
||||||
recyclerViewTouchActionGuardManager = RecyclerViewTouchActionGuardManager()
|
recyclerViewTouchActionGuardManager = RecyclerViewTouchActionGuardManager()
|
||||||
recyclerViewDragDropManager = RecyclerViewDragDropManager()
|
recyclerViewDragDropManager = RecyclerViewDragDropManager()
|
||||||
recyclerViewSwipeManager = RecyclerViewSwipeManager()
|
recyclerViewSwipeManager = RecyclerViewSwipeManager()
|
||||||
|
|
||||||
val animator = DraggableItemAnimator()
|
val animator = DraggableItemAnimator()
|
||||||
animator.supportsChangeAnimations = false
|
animator.supportsChangeAnimations = false
|
||||||
wrappedAdapter =
|
|
||||||
recyclerViewDragDropManager?.createWrappedAdapter(adapter!!) as RecyclerView.Adapter<*>
|
|
||||||
wrappedAdapter =
|
|
||||||
recyclerViewSwipeManager?.createWrappedAdapter(wrappedAdapter) as RecyclerView.Adapter<*>
|
|
||||||
recyclerView().layoutManager = layoutManager
|
|
||||||
recyclerView().adapter = wrappedAdapter
|
|
||||||
recyclerView().itemAnimator = animator
|
|
||||||
recyclerViewTouchActionGuardManager?.attachRecyclerView(recyclerView())
|
|
||||||
recyclerViewDragDropManager?.attachRecyclerView(recyclerView())
|
|
||||||
recyclerViewSwipeManager?.attachRecyclerView(recyclerView())
|
|
||||||
|
|
||||||
layoutManager?.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
playingQueueAdapter = PlayingQueueAdapter(
|
||||||
}
|
requireActivity(),
|
||||||
|
|
||||||
override fun createLayoutManager(): LinearLayoutManager {
|
|
||||||
return LinearLayoutManager(requireContext())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createAdapter(): PlayingQueueAdapter {
|
|
||||||
return PlayingQueueAdapter(
|
|
||||||
requireActivity() as AppCompatActivity,
|
|
||||||
MusicPlayerRemote.playingQueue.toMutableList(),
|
MusicPlayerRemote.playingQueue.toMutableList(),
|
||||||
MusicPlayerRemote.position,
|
MusicPlayerRemote.position,
|
||||||
R.layout.item_queue
|
R.layout.item_queue
|
||||||
)
|
)
|
||||||
|
wrappedAdapter = recyclerViewDragDropManager?.createWrappedAdapter(playingQueueAdapter!!)
|
||||||
|
wrappedAdapter = wrappedAdapter?.let { recyclerViewSwipeManager?.createWrappedAdapter(it) }
|
||||||
|
|
||||||
|
linearLayoutManager = LinearLayoutManager(requireContext())
|
||||||
|
|
||||||
|
binding.recyclerView.layoutManager = linearLayoutManager
|
||||||
|
binding.recyclerView.adapter = wrappedAdapter
|
||||||
|
binding.recyclerView.itemAnimator = animator
|
||||||
|
recyclerViewTouchActionGuardManager?.attachRecyclerView(binding.recyclerView)
|
||||||
|
recyclerViewDragDropManager?.attachRecyclerView(binding.recyclerView)
|
||||||
|
recyclerViewSwipeManager?.attachRecyclerView(binding.recyclerView)
|
||||||
|
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
||||||
|
|
||||||
|
binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||||
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
|
if (dy > 0) {
|
||||||
|
binding.clearQueue.shrink()
|
||||||
|
} else if (dy < 0) {
|
||||||
|
binding.clearQueue.extend()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ThemedFastScroller.create(binding.recyclerView)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
private fun checkForPadding() {
|
||||||
super.onServiceConnected()
|
|
||||||
updateQueue()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onQueueChanged() {
|
override fun onQueueChanged() {
|
||||||
super.onQueueChanged()
|
if (MusicPlayerRemote.playingQueue.isEmpty()) {
|
||||||
|
findNavController().navigateUp()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
checkForPadding()
|
||||||
updateQueue()
|
updateQueue()
|
||||||
mainActivity.hideBottomBar(true)
|
updateCurrentSong()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onMediaStoreChanged() {
|
||||||
|
updateQueue()
|
||||||
|
updateCurrentSong()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateCurrentSong() {
|
||||||
|
binding.toolbar.subtitle = getUpNextAndQueueTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPlayingMetaChanged() {
|
override fun onPlayingMetaChanged() {
|
||||||
updateQueuePosition()
|
updateQueuePosition()
|
||||||
mainActivity.hideBottomBar(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateQueuePosition() {
|
private fun updateQueuePosition() {
|
||||||
adapter?.setCurrent(MusicPlayerRemote.position)
|
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
|
||||||
resetToCurrentPosition()
|
resetToCurrentPosition()
|
||||||
|
binding.toolbar.subtitle = getUpNextAndQueueTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateQueue() {
|
private fun updateQueue() {
|
||||||
adapter?.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
|
playingQueueAdapter?.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
|
||||||
resetToCurrentPosition()
|
resetToCurrentPosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resetToCurrentPosition() {
|
private fun resetToCurrentPosition() {
|
||||||
recyclerView().stopScroll()
|
binding.recyclerView.stopScroll()
|
||||||
layoutManager?.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
recyclerViewDragDropManager?.cancelDrag()
|
if (recyclerViewDragDropManager != null) {
|
||||||
|
recyclerViewDragDropManager!!.cancelDrag()
|
||||||
|
}
|
||||||
super.onPause()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val emptyMessage: Int
|
override fun onDestroy() {
|
||||||
get() = R.string.no_playing_queue
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
|
||||||
super.onDestroyView()
|
|
||||||
if (recyclerViewDragDropManager != null) {
|
if (recyclerViewDragDropManager != null) {
|
||||||
recyclerViewDragDropManager?.release()
|
recyclerViewDragDropManager!!.release()
|
||||||
recyclerViewDragDropManager = null
|
recyclerViewDragDropManager = null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recyclerViewSwipeManager != null) {
|
if (recyclerViewSwipeManager != null) {
|
||||||
recyclerViewSwipeManager?.release()
|
recyclerViewSwipeManager?.release()
|
||||||
recyclerViewSwipeManager = null
|
recyclerViewSwipeManager = null
|
||||||
}
|
}
|
||||||
|
if (wrappedAdapter != null) {
|
||||||
WrapperAdapterUtils.releaseAll(wrappedAdapter)
|
WrapperAdapterUtils.releaseAll(wrappedAdapter)
|
||||||
|
wrappedAdapter = null
|
||||||
|
}
|
||||||
|
playingQueueAdapter = null
|
||||||
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
private fun setupToolbar() {
|
||||||
@JvmField
|
binding.toolbar.subtitle = getUpNextAndQueueTime()
|
||||||
val TAG: String = PlayingQueueFragment::class.java.simpleName
|
binding.clearQueue.backgroundTintList = ColorStateList.valueOf(accentColor())
|
||||||
|
ColorStateList.valueOf(
|
||||||
@JvmStatic
|
MaterialValueHelper.getPrimaryTextColor(
|
||||||
fun newInstance(): PlayingQueueFragment {
|
requireContext(),
|
||||||
return PlayingQueueFragment()
|
ColorUtil.isColorLight(accentColor())
|
||||||
|
)
|
||||||
|
).apply {
|
||||||
|
binding.clearQueue.setTextColor(this)
|
||||||
|
binding.clearQueue.iconTint = this
|
||||||
|
}
|
||||||
|
binding.toolbar.apply {
|
||||||
|
setNavigationOnClickListener {
|
||||||
|
findNavController().navigateUp()
|
||||||
|
}
|
||||||
|
setNavigationIcon(R.drawable.ic_keyboard_backspace_black)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
0
app/src/main/res/layout/activity_playing_queue.xml → app/src/main/res/layout/fragment_playing_queue.xml
Executable file → Normal file
0
app/src/main/res/layout/activity_playing_queue.xml → app/src/main/res/layout/fragment_playing_queue.xml
Executable file → Normal file
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/miniPlayerFragment"
|
android:id="@+id/miniPlayerFragment"
|
||||||
android:name="code.name.monkey.retromusic.fragments.MiniPlayerFragment"
|
android:name="code.name.monkey.retromusic.fragments.other.MiniPlayerFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/mini_player_height"
|
android:layout_height="@dimen/mini_player_height"
|
||||||
tools:layout="@layout/fragment_mini_player" />
|
tools:layout="@layout/fragment_mini_player" />
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/detailListFragment"
|
android:id="@+id/detailListFragment"
|
||||||
android:name="code.name.monkey.retromusic.fragments.DetailListFragment"
|
android:name="code.name.monkey.retromusic.fragments.other.DetailListFragment"
|
||||||
android:label="DetailListFragment">
|
android:label="DetailListFragment">
|
||||||
<argument
|
<argument
|
||||||
android:name="type"
|
android:name="type"
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/user_info_fragment"
|
android:id="@+id/user_info_fragment"
|
||||||
android:name="code.name.monkey.retromusic.fragments.UserInfoFragment" />
|
android:name="code.name.monkey.retromusic.fragments.other.UserInfoFragment" />
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/playing_queue_fragment"
|
android:id="@+id/playing_queue_fragment"
|
||||||
|
@ -132,5 +132,5 @@
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/lyrics_fragment"
|
android:id="@+id/lyrics_fragment"
|
||||||
android:name="code.name.monkey.retromusic.fragments.LyricsFragment" />
|
android:name="code.name.monkey.retromusic.fragments.other.LyricsFragment" />
|
||||||
</navigation>
|
</navigation>
|
Loading…
Reference in a new issue