commit
16d256e210
40 changed files with 514 additions and 327 deletions
|
@ -34,6 +34,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||||
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
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.color.MediaNotificationProcessor
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.android.synthetic.main.activity_drive_mode.*
|
import kotlinx.android.synthetic.main.activity_drive_mode.*
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
@ -217,7 +218,7 @@ class DriveModeActivity : AbsMusicServiceActivity(), Callback {
|
||||||
.build()
|
.build()
|
||||||
.transform(BlurTransformation.Builder(this).build())
|
.transform(BlurTransformation.Builder(this).build())
|
||||||
.into(object : RetroMusicColoredTarget(image) {
|
.into(object : RetroMusicColoredTarget(image) {
|
||||||
override fun onColorReady(color: Int) {
|
override fun onColorReady(color: MediaNotificationProcessor) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
|
||||||
TINY -> TinyPlayerFragment()
|
TINY -> TinyPlayerFragment()
|
||||||
PEAK -> PeakPlayerFragment()
|
PEAK -> PeakPlayerFragment()
|
||||||
CIRCLE -> CirclePlayerFragment()
|
CIRCLE -> CirclePlayerFragment()
|
||||||
EXAMPLE -> ClassicPlayerFragment()
|
CLASSIC -> ClassicPlayerFragment()
|
||||||
else -> PlayerFragment()
|
else -> PlayerFragment()
|
||||||
} // must implement AbsPlayerFragment
|
} // must implement AbsPlayerFragment
|
||||||
supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment)
|
supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
import code.name.monkey.retromusic.fragments.AlbumCoverStyle
|
||||||
|
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
import code.name.monkey.retromusic.misc.CustomFragmentStatePagerAdapter
|
import code.name.monkey.retromusic.misc.CustomFragmentStatePagerAdapter
|
||||||
|
@ -63,7 +64,7 @@ class AlbumCoverPagerAdapter(
|
||||||
|
|
||||||
lateinit var albumCover: ImageView
|
lateinit var albumCover: ImageView
|
||||||
private var isColorReady: Boolean = false
|
private var isColorReady: Boolean = false
|
||||||
private var color: Int = 0
|
private lateinit var color: MediaNotificationProcessor
|
||||||
private lateinit var song: Song
|
private lateinit var song: Song
|
||||||
private var colorReceiver: ColorReceiver? = null
|
private var colorReceiver: ColorReceiver? = null
|
||||||
private var request: Int = 0
|
private var request: Int = 0
|
||||||
|
@ -94,12 +95,7 @@ class AlbumCoverPagerAdapter(
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
val finalLayout = when {
|
val view = inflater.inflate(getLayoutWithPlayerTheme(), container, false)
|
||||||
PreferenceUtil.getInstance(requireContext())
|
|
||||||
.carouselEffect() -> R.layout.fragment_album_carousel_cover
|
|
||||||
else -> layout
|
|
||||||
}
|
|
||||||
val view = inflater.inflate(finalLayout, container, false)
|
|
||||||
albumCover = view.findViewById(R.id.player_image)
|
albumCover = view.findViewById(R.id.player_image)
|
||||||
albumCover.setOnClickListener {
|
albumCover.setOnClickListener {
|
||||||
NavigationUtil.goToLyrics(requireActivity())
|
NavigationUtil.goToLyrics(requireActivity())
|
||||||
|
@ -107,6 +103,35 @@ class AlbumCoverPagerAdapter(
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getLayoutWithPlayerTheme(): Int {
|
||||||
|
return when (PreferenceUtil.getInstance(requireContext()).nowPlayingScreen) {
|
||||||
|
NowPlayingScreen.CARD,
|
||||||
|
NowPlayingScreen.FIT,
|
||||||
|
NowPlayingScreen.TINY,
|
||||||
|
NowPlayingScreen.CLASSIC,
|
||||||
|
NowPlayingScreen.MATERIAL,
|
||||||
|
NowPlayingScreen.FULL -> R.layout.fragment_album_full_cover
|
||||||
|
else -> {
|
||||||
|
if (PreferenceUtil.getInstance(requireContext())
|
||||||
|
.carouselEffect()
|
||||||
|
) {
|
||||||
|
R.layout.fragment_album_carousel_cover
|
||||||
|
} else {
|
||||||
|
when (PreferenceUtil.getInstance(requireContext()).albumCoverStyle) {
|
||||||
|
AlbumCoverStyle.NORMAL -> R.layout.fragment_album_cover
|
||||||
|
AlbumCoverStyle.FLAT -> R.layout.fragment_album_flat_cover
|
||||||
|
AlbumCoverStyle.CIRCLE -> R.layout.fragment_album_circle_cover
|
||||||
|
AlbumCoverStyle.CARD -> R.layout.fragment_album_card_cover
|
||||||
|
AlbumCoverStyle.MATERIAL -> R.layout.fragment_album_material_cover
|
||||||
|
AlbumCoverStyle.FULL -> R.layout.fragment_album_full_cover
|
||||||
|
AlbumCoverStyle.FULL_CARD -> R.layout.fragment_album_full_card_cover
|
||||||
|
else -> R.layout.fragment_album_cover
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
loadAlbumCover()
|
loadAlbumCover()
|
||||||
|
@ -123,12 +148,12 @@ class AlbumCoverPagerAdapter(
|
||||||
.generatePalette(requireContext()).build()
|
.generatePalette(requireContext()).build()
|
||||||
.into(object : RetroMusicColoredTarget(albumCover) {
|
.into(object : RetroMusicColoredTarget(albumCover) {
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
override fun onColorReady(colors: MediaNotificationProcessor) {
|
||||||
setColor(colors.backgroundColor)
|
setColor(colors)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setColor(color: Int) {
|
private fun setColor(color: MediaNotificationProcessor) {
|
||||||
this.color = color
|
this.color = color
|
||||||
isColorReady = true
|
isColorReady = true
|
||||||
if (colorReceiver != null) {
|
if (colorReceiver != null) {
|
||||||
|
@ -147,7 +172,7 @@ class AlbumCoverPagerAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ColorReceiver {
|
interface ColorReceiver {
|
||||||
fun onColorReady(color: Int, request: Int)
|
fun onColorReady(color: MediaNotificationProcessor, request: Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -20,30 +20,25 @@ import androidx.fragment.app.DialogFragment
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.loaders.PlaylistLoader
|
import code.name.monkey.retromusic.loaders.PlaylistLoader
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel
|
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||||
import code.name.monkey.retromusic.room.playlist.PlaylistEntity
|
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
import com.afollestad.materialdialogs.LayoutMode
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
|
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||||
import com.afollestad.materialdialogs.list.listItems
|
import com.afollestad.materialdialogs.list.listItems
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
class AddToPlaylistDialog : DialogFragment() {
|
class AddToPlaylistDialog : DialogFragment() {
|
||||||
|
|
||||||
override fun onCreateDialog(
|
override fun onCreateDialog(
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): Dialog {
|
): Dialog {
|
||||||
|
|
||||||
val names = requireArguments().getParcelableArrayList<PlaylistEntity>("names")
|
|
||||||
val playlists = PlaylistLoader.getAllPlaylists(requireContext())
|
val playlists = PlaylistLoader.getAllPlaylists(requireContext())
|
||||||
val playlistNames: MutableList<String> = mutableListOf()
|
val playlistNames: MutableList<String> = mutableListOf()
|
||||||
playlistNames.add(requireContext().resources.getString(R.string.action_new_playlist))
|
playlistNames.add(requireContext().resources.getString(R.string.action_new_playlist))
|
||||||
for (p in names!!) {
|
for (p in playlists) {
|
||||||
playlistNames.add(p.playlistName)
|
playlistNames.add(p.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return MaterialDialog(requireContext()).show {
|
return MaterialDialog(requireContext()).show {
|
||||||
title(R.string.add_playlist_title)
|
title(R.string.add_playlist_title)
|
||||||
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner)
|
||||||
|
@ -57,18 +52,12 @@ class AddToPlaylistDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
/*PlaylistsUtil.addToPlaylist(
|
PlaylistsUtil.addToPlaylist(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
songs,
|
songs,
|
||||||
playlists[index - 1].id,
|
playlists[index - 1].id,
|
||||||
true
|
true
|
||||||
)*/
|
)
|
||||||
|
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
|
||||||
PlaylistDatabaseModel().also {
|
|
||||||
it.addSongsToPlaylist(songs, names[index - 1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,17 +78,5 @@ class AddToPlaylistDialog : DialogFragment() {
|
||||||
dialog.arguments = args
|
dialog.arguments = args
|
||||||
return dialog
|
return dialog
|
||||||
}
|
}
|
||||||
|
|
||||||
fun create(
|
|
||||||
songs: ArrayList<Song>,
|
|
||||||
names: List<PlaylistEntity>
|
|
||||||
): AddToPlaylistDialog {
|
|
||||||
val dialog = AddToPlaylistDialog()
|
|
||||||
val args = Bundle()
|
|
||||||
args.putParcelableArrayList("songs", ArrayList(songs))
|
|
||||||
args.putParcelableArrayList("names", ArrayList(names))
|
|
||||||
dialog.arguments = args
|
|
||||||
return dialog
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,10 +24,7 @@ import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.R.layout
|
import code.name.monkey.retromusic.R.layout
|
||||||
import code.name.monkey.retromusic.R.string
|
import code.name.monkey.retromusic.R.string
|
||||||
import code.name.monkey.retromusic.extensions.appHandleColor
|
import code.name.monkey.retromusic.extensions.appHandleColor
|
||||||
import code.name.monkey.retromusic.fragments.playlists.PlaylistViewModel
|
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel
|
|
||||||
import code.name.monkey.retromusic.room.playlist.PlaylistEntity
|
|
||||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import com.afollestad.materialdialogs.LayoutMode
|
import com.afollestad.materialdialogs.LayoutMode
|
||||||
|
@ -60,14 +57,13 @@ class CreatePlaylistDialog : DialogFragment() {
|
||||||
?: return@positiveButton
|
?: return@positiveButton
|
||||||
|
|
||||||
if (playlistView.text.toString().trim { it <= ' ' }.isNotEmpty()) {
|
if (playlistView.text.toString().trim { it <= ' ' }.isNotEmpty()) {
|
||||||
/*val playlistId = PlaylistsUtil.createPlaylist(
|
val playlistId = PlaylistsUtil.createPlaylist(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
playlistView.text.toString()
|
playlistView.text.toString()
|
||||||
)
|
)
|
||||||
if (playlistId != -1) {
|
if (playlistId != -1) {
|
||||||
PlaylistsUtil.addToPlaylist(requireContext(), songs, playlistId, true)
|
PlaylistsUtil.addToPlaylist(requireContext(), songs, playlistId, true)
|
||||||
}*/
|
}
|
||||||
PlaylistDatabaseModel().savePlaylist(PlaylistEntity(playlistView.text.toString()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,5 @@ enum class NowPlayingScreen constructor(
|
||||||
PLAIN(R.string.plain, R.drawable.np_plain, 3),
|
PLAIN(R.string.plain, R.drawable.np_plain, 3),
|
||||||
SIMPLE(R.string.simple, R.drawable.np_simple, 8),
|
SIMPLE(R.string.simple, R.drawable.np_simple, 8),
|
||||||
TINY(R.string.tiny, R.drawable.np_tiny, 7),
|
TINY(R.string.tiny, R.drawable.np_tiny, 7),
|
||||||
EXAMPLE(R.string.tiny, R.drawable.np_tiny, 16),
|
CLASSIC(R.string.classic, R.drawable.np_tiny, 16),
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,11 +62,9 @@ abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(),
|
||||||
|
|
||||||
private fun hideVolumeIfAvailable() {
|
private fun hideVolumeIfAvailable() {
|
||||||
if (PreferenceUtil.getInstance(requireContext()).volumeToggle) {
|
if (PreferenceUtil.getInstance(requireContext()).volumeToggle) {
|
||||||
childFragmentManager.beginTransaction()
|
childFragmentManager.beginTransaction().replace(R.id.volumeFragmentContainer, VolumeFragment()).commit()
|
||||||
.replace(R.id.volumeFragmentContainer, VolumeFragment()).commit()
|
|
||||||
childFragmentManager.executePendingTransactions()
|
childFragmentManager.executePendingTransactions()
|
||||||
volumeFragment =
|
volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragmentContainer) as VolumeFragment?
|
||||||
childFragmentManager.findFragmentById(R.id.volumeFragmentContainer) as VolumeFragment?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,14 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
|
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
|
||||||
import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
|
import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_player_album_cover.*
|
import kotlinx.android.synthetic.main.fragment_player_album_cover.*
|
||||||
|
|
||||||
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
|
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
|
||||||
private var callbacks: Callbacks? = null
|
private var callbacks: Callbacks? = null
|
||||||
private var currentPosition: Int = 0
|
private var currentPosition: Int = 0
|
||||||
private val colorReceiver = object : AlbumCoverFragment.ColorReceiver {
|
private val colorReceiver = object : AlbumCoverFragment.ColorReceiver {
|
||||||
override fun onColorReady(color: Int, request: Int) {
|
override fun onColorReady(color: MediaNotificationProcessor, request: Int) {
|
||||||
if (currentPosition == request) {
|
if (currentPosition == request) {
|
||||||
notifyColorChange(color)
|
notifyColorChange(color)
|
||||||
}
|
}
|
||||||
|
@ -103,7 +104,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
|
||||||
override fun onPageScrollStateChanged(state: Int) {
|
override fun onPageScrollStateChanged(state: Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun notifyColorChange(color: Int) {
|
private fun notifyColorChange(color: MediaNotificationProcessor) {
|
||||||
callbacks?.onColorChanged(color)
|
callbacks?.onColorChanged(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
|
||||||
|
|
||||||
interface Callbacks {
|
interface Callbacks {
|
||||||
|
|
||||||
fun onColorChanged(color: Int)
|
fun onColorChanged(color: MediaNotificationProcessor)
|
||||||
|
|
||||||
fun onFavoriteToggled()
|
fun onFavoriteToggled()
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ 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.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_adaptive_player.*
|
import kotlinx.android.synthetic.main.fragment_adaptive_player.*
|
||||||
|
|
||||||
class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
||||||
|
@ -194,9 +195,9 @@ class AdaptiveFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Call
|
||||||
toggleFavorite(MusicPlayerRemote.currentSong)
|
toggleFavorite(MusicPlayerRemote.currentSong)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
playerToolbar,
|
playerToolbar,
|
||||||
|
|
|
@ -65,9 +65,9 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
|
||||||
toggleFavorite(MusicPlayerRemote.currentSong)
|
toggleFavorite(MusicPlayerRemote.currentSong)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_card_player.*
|
import kotlinx.android.synthetic.main.fragment_card_player.*
|
||||||
|
|
||||||
class CardFragment : AbsPlayerFragment() {
|
class CardFragment : AbsPlayerFragment() {
|
||||||
|
@ -43,9 +44,9 @@ class CardFragment : AbsPlayerFragment() {
|
||||||
return Color.WHITE
|
return Color.WHITE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks!!.onPaletteColorChanged()
|
callbacks!!.onPaletteColorChanged()
|
||||||
|
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
||||||
|
|
|
@ -50,9 +50,9 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen
|
||||||
return Color.WHITE
|
return Color.WHITE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks!!.onPaletteColorChanged()
|
callbacks!!.onPaletteColorChanged()
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||||
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.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import code.name.monkey.retromusic.views.SeekArc
|
import code.name.monkey.retromusic.views.SeekArc
|
||||||
import code.name.monkey.retromusic.views.SeekArc.OnSeekArcChangeListener
|
import code.name.monkey.retromusic.views.SeekArc.OnSeekArcChangeListener
|
||||||
import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
import code.name.monkey.retromusic.volume.AudioVolumeObserver
|
||||||
|
@ -161,7 +162,7 @@ class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChanged
|
||||||
override val paletteColor: Int
|
override val paletteColor: Int
|
||||||
get() = Color.BLACK
|
get() = Color.BLACK
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFavoriteToggled() {
|
override fun onFavoriteToggled() {
|
||||||
|
|
|
@ -30,6 +30,7 @@ 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.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.card.MaterialCardView
|
import com.google.android.material.card.MaterialCardView
|
||||||
import kotlinx.android.synthetic.main.fragment_clasic_player.*
|
import kotlinx.android.synthetic.main.fragment_clasic_player.*
|
||||||
|
@ -116,6 +117,11 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
getQueuePanel().removeBottomSheetCallback(bottomSheetCallbackList)
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateSong() {
|
private fun updateSong() {
|
||||||
val song = MusicPlayerRemote.currentSong
|
val song = MusicPlayerRemote.currentSong
|
||||||
title.text = song.title
|
title.text = song.title
|
||||||
|
@ -175,7 +181,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
||||||
MusicPlayerRemote.position,
|
MusicPlayerRemote.position,
|
||||||
R.layout.item_queue
|
R.layout.item_queue
|
||||||
)
|
)
|
||||||
recyclerView .apply {
|
recyclerView.apply {
|
||||||
adapter = queueAdapter
|
adapter = queueAdapter
|
||||||
layoutManager = LinearLayoutManager(requireContext())
|
layoutManager = LinearLayoutManager(requireContext())
|
||||||
}
|
}
|
||||||
|
@ -225,8 +231,8 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
||||||
override val paletteColor: Int
|
override val paletteColor: Int
|
||||||
get() = lastColor
|
get() = lastColor
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
playerToolbar,
|
playerToolbar,
|
||||||
Color.WHITE,
|
Color.WHITE,
|
||||||
|
@ -246,7 +252,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
color
|
color.backgroundColor
|
||||||
} else {
|
} else {
|
||||||
ThemeStore.accentColor(requireContext())
|
ThemeStore.accentColor(requireContext())
|
||||||
}.ripAlpha()
|
}.ripAlpha()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package code.name.monkey.retromusic.fragments.player.color
|
package code.name.monkey.retromusic.fragments.player.color
|
||||||
|
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -9,19 +8,13 @@ import android.view.ViewGroup
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
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.appthemehelper.util.MaterialValueHelper
|
|
||||||
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.fragments.base.AbsPlayerFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.glide.SongGlideRequest.Builder
|
|
||||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
|
||||||
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.request.animation.GlideAnimation
|
|
||||||
import kotlinx.android.synthetic.main.fragment_color_player.*
|
import kotlinx.android.synthetic.main.fragment_color_player.*
|
||||||
|
|
||||||
class ColorFragment : AbsPlayerFragment() {
|
class ColorFragment : AbsPlayerFragment() {
|
||||||
|
@ -38,12 +31,22 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
override val paletteColor: Int
|
override val paletteColor: Int
|
||||||
get() = backgroundColor
|
get() = backgroundColor
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
|
playbackControlsFragment.setDark(color)
|
||||||
|
lastColor = color.backgroundColor
|
||||||
|
callbacks?.onPaletteColorChanged()
|
||||||
|
|
||||||
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
|
playerToolbar,
|
||||||
|
color.secondaryTextColor,
|
||||||
|
requireActivity()
|
||||||
|
)
|
||||||
|
colorGradientBackground?.setBackgroundColor(color.backgroundColor)
|
||||||
|
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(color.backgroundColor))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFavoriteToggled() {
|
override fun onFavoriteToggled() {
|
||||||
//toggleFavorite(MusicPlayerRemote.currentSong)
|
toggleFavorite(MusicPlayerRemote.currentSong)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShow() {
|
override fun onShow() {
|
||||||
|
@ -90,9 +93,9 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
setUpSubFragments()
|
setUpSubFragments()
|
||||||
setUpPlayerToolbar()
|
setUpPlayerToolbar()
|
||||||
playerImage.setOnClickListener {
|
val playerAlbumCoverFragment =
|
||||||
NavigationUtil.goToLyrics(requireActivity())
|
childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
|
||||||
}
|
playerAlbumCoverFragment.setCallbacks(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSubFragments() {
|
private fun setUpSubFragments() {
|
||||||
|
@ -113,70 +116,6 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPlayingMetaChanged() {
|
|
||||||
super.onPlayingMetaChanged()
|
|
||||||
updateSong()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
|
||||||
super.onServiceConnected()
|
|
||||||
updateSong()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateSong() {
|
|
||||||
Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong)
|
|
||||||
.checkIgnoreMediaStore(requireContext())
|
|
||||||
.generatePalette(requireContext())
|
|
||||||
.build()
|
|
||||||
.into(object : RetroMusicColoredTarget(playerImage) {
|
|
||||||
override fun onColorReady(colors: MediaNotificationProcessor) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResourceReady(
|
|
||||||
resource: BitmapPaletteWrapper?,
|
|
||||||
glideAnimation: GlideAnimation<in BitmapPaletteWrapper>?
|
|
||||||
) {
|
|
||||||
super.onResourceReady(resource, glideAnimation)
|
|
||||||
resource?.let {
|
|
||||||
|
|
||||||
|
|
||||||
val colors =
|
|
||||||
MediaNotificationProcessor(requireContext(), resource.bitmap)
|
|
||||||
|
|
||||||
|
|
||||||
/* val palette = resource.palette
|
|
||||||
val swatch = RetroColorUtil.getSwatch(palette)
|
|
||||||
|
|
||||||
val textColor = RetroColorUtil.getTextColor(palette)
|
|
||||||
val backgroundColor = getSuitableColorFor(
|
|
||||||
palette,
|
|
||||||
ATHUtil.resolveColor(requireContext(), R.attr.colorSurface),
|
|
||||||
Color.BLACK
|
|
||||||
)
|
|
||||||
if (ATHUtil.isWindowBackgroundDark(requireContext())) {
|
|
||||||
ColorUtil.desaturateColor(backgroundColor, 0.5f)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
setColors(colors)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {
|
|
||||||
super.onLoadFailed(e, errorDrawable)
|
|
||||||
val backgroundColor = defaultFooterColor
|
|
||||||
val textColor =
|
|
||||||
if (ColorUtil.isColorLight(defaultFooterColor)) MaterialValueHelper.getPrimaryTextColor(
|
|
||||||
requireContext(),
|
|
||||||
true
|
|
||||||
)
|
|
||||||
else MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
|
||||||
//setColors(backgroundColor, textColor)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setColors(colors: MediaNotificationProcessor) {
|
private fun setColors(colors: MediaNotificationProcessor) {
|
||||||
this.lastColor = colors.backgroundColor
|
this.lastColor = colors.backgroundColor
|
||||||
this.backgroundColor = colors.backgroundColor
|
this.backgroundColor = colors.backgroundColor
|
||||||
|
@ -193,10 +132,7 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(): ColorFragment {
|
fun newInstance(): ColorFragment {
|
||||||
val args = Bundle()
|
return ColorFragment()
|
||||||
val fragment = ColorFragment()
|
|
||||||
fragment.arguments = args
|
|
||||||
return fragment
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
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.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_fit.*
|
import kotlinx.android.synthetic.main.fragment_fit.*
|
||||||
|
|
||||||
class FitFragment : AbsPlayerFragment() {
|
class FitFragment : AbsPlayerFragment() {
|
||||||
|
@ -42,9 +43,9 @@ class FitFragment : AbsPlayerFragment() {
|
||||||
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
playerToolbar,
|
playerToolbar,
|
||||||
|
|
|
@ -19,6 +19,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
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
|
||||||
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.views.DrawableGradient
|
import code.name.monkey.retromusic.views.DrawableGradient
|
||||||
import kotlinx.android.synthetic.main.fragment_flat_player.*
|
import kotlinx.android.synthetic.main.fragment_flat_player.*
|
||||||
|
|
||||||
|
@ -103,18 +104,18 @@ class FlatPlayerFragment : AbsPlayerFragment() {
|
||||||
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
flatPlaybackControlsFragment.setDark(color)
|
flatPlaybackControlsFragment.setDark(color.backgroundColor)
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
val isLight = ColorUtil.isColorLight(color)
|
val isLight = ColorUtil.isColorLight(color.backgroundColor)
|
||||||
val iconColor = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor)
|
val iconColor = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor)
|
||||||
MaterialValueHelper.getPrimaryTextColor(requireContext(), isLight)
|
MaterialValueHelper.getPrimaryTextColor(requireContext(), isLight)
|
||||||
else
|
else
|
||||||
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, iconColor, requireActivity())
|
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, iconColor, requireActivity())
|
||||||
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
colorize(color)
|
colorize(color.backgroundColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,9 +197,9 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
return Color.WHITE
|
return Color.WHITE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
fullPlaybackControlsFragment.setDark(color)
|
fullPlaybackControlsFragment.setDark(color.backgroundColor)
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
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.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.extensions.hide
|
import code.name.monkey.retromusic.extensions.hide
|
||||||
|
@ -99,24 +98,22 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDark(color: Int) {
|
override fun setDark(color: Int) {
|
||||||
val colorBg = ATHUtil.resolveColor(requireContext(), R.attr.colorSurface)
|
if (ATHUtil.isWindowBackgroundDark(requireContext())) {
|
||||||
if (ColorUtil.isColorLight(colorBg)) {
|
|
||||||
lastPlaybackControlsColor =
|
|
||||||
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
|
||||||
lastDisabledPlaybackControlsColor =
|
|
||||||
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
|
||||||
} else {
|
|
||||||
lastPlaybackControlsColor =
|
lastPlaybackControlsColor =
|
||||||
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||||
lastDisabledPlaybackControlsColor =
|
lastDisabledPlaybackControlsColor =
|
||||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||||
|
}else{
|
||||||
|
lastPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||||
|
lastDisabledPlaybackControlsColor =
|
||||||
|
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRepeatState()
|
updateRepeatState()
|
||||||
updateShuffleState()
|
updateShuffleState()
|
||||||
|
|
||||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
color
|
lastPlaybackControlsColor
|
||||||
} else {
|
} else {
|
||||||
textColorSecondary(requireContext())
|
textColorSecondary(requireContext())
|
||||||
}.ripAlpha()
|
}.ripAlpha()
|
||||||
|
@ -126,12 +123,14 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
volumeFragment?.setTintable(colorFinal)
|
volumeFragment?.setTintable(colorFinal)
|
||||||
|
|
||||||
updatePlayPauseColor(colorFinal)
|
updateRepeatState()
|
||||||
updatePrevNextColor(colorFinal)
|
updateShuffleState()
|
||||||
|
updatePlayPauseColor()
|
||||||
|
updatePrevNextColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePlayPauseColor(color: Int) {
|
private fun updatePlayPauseColor() {
|
||||||
playPauseButton.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
playPauseButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpPlayPauseFab() {
|
private fun setUpPlayPauseFab() {
|
||||||
|
@ -140,9 +139,9 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
|
|
||||||
private fun updatePlayPauseDrawableState() {
|
private fun updatePlayPauseDrawableState() {
|
||||||
if (MusicPlayerRemote.isPlaying) {
|
if (MusicPlayerRemote.isPlaying) {
|
||||||
playPauseButton.setImageResource(R.drawable.ic_pause_white_64dp)
|
playPauseButton.setImageResource(R.drawable.ic_pause_sharp_white_64dp)
|
||||||
} else {
|
} else {
|
||||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_64dp)
|
playPauseButton.setImageResource(R.drawable.ic_play_arrow_sharp_white_64dp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,14 +154,14 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpPrevNext() {
|
private fun setUpPrevNext() {
|
||||||
updatePrevNextColor(textColorSecondary(requireContext()))
|
updatePrevNextColor()
|
||||||
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
|
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
|
||||||
previousButton.setOnClickListener { MusicPlayerRemote.back() }
|
previousButton.setOnClickListener { MusicPlayerRemote.back() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePrevNextColor(color: Int) {
|
private fun updatePrevNextColor() {
|
||||||
nextButton.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
nextButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
previousButton.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpShuffleButton() {
|
private fun setUpShuffleButton() {
|
||||||
|
@ -189,18 +188,18 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
|
||||||
override fun updateRepeatState() {
|
override fun updateRepeatState() {
|
||||||
when (MusicPlayerRemote.repeatMode) {
|
when (MusicPlayerRemote.repeatMode) {
|
||||||
MusicService.REPEAT_MODE_NONE -> {
|
MusicService.REPEAT_MODE_NONE -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_sharp_white_24dp)
|
||||||
repeatButton.setColorFilter(
|
repeatButton.setColorFilter(
|
||||||
lastDisabledPlaybackControlsColor,
|
lastDisabledPlaybackControlsColor,
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_ALL -> {
|
MusicService.REPEAT_MODE_ALL -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_sharp_white_24dp)
|
||||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
}
|
}
|
||||||
MusicService.REPEAT_MODE_THIS -> {
|
MusicService.REPEAT_MODE_THIS -> {
|
||||||
repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp)
|
repeatButton.setImageResource(R.drawable.ic_repeat_one_sharp_white_24dp)
|
||||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,21 +4,57 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
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.CustomBottomSheetBehavior
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||||
|
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||||
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
|
||||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import kotlinx.android.synthetic.main.fragment_material.*
|
import kotlinx.android.synthetic.main.fragment_material.*
|
||||||
|
import kotlinx.android.synthetic.main.status_bar.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hemanth S (h4h13).
|
* @author Hemanth S (h4h13).
|
||||||
*/
|
*/
|
||||||
class MaterialFragment : AbsPlayerFragment() {
|
class MaterialFragment : AbsPlayerFragment(), View.OnLayoutChangeListener {
|
||||||
|
private lateinit var queueAdapter: PlayingQueueAdapter
|
||||||
|
private val bottomSheetCallbackList = object : BottomSheetBehavior.BottomSheetCallback() {
|
||||||
|
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
||||||
|
(requireActivity() as AbsSlidingMusicPanelActivity).getBottomSheetBehavior()
|
||||||
|
.setAllowDragging(false)
|
||||||
|
|
||||||
|
sheetContent.setPadding(
|
||||||
|
sheetContent.paddingLeft,
|
||||||
|
(slideOffset * status_bar.height).toInt(),
|
||||||
|
sheetContent.paddingRight,
|
||||||
|
sheetContent.paddingBottom
|
||||||
|
)
|
||||||
|
|
||||||
|
playerControlsContainer.layoutParams.height = playerContainer.width
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStateChanged(bottomSheet: View, newState: Int) {
|
||||||
|
val activity = requireActivity() as AbsSlidingMusicPanelActivity
|
||||||
|
if (newState == BottomSheetBehavior.STATE_EXPANDED || newState == BottomSheetBehavior.STATE_DRAGGING) {
|
||||||
|
activity.getBottomSheetBehavior().setAllowDragging(false)
|
||||||
|
} else {
|
||||||
|
activity.getBottomSheetBehavior().setAllowDragging(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun playerToolbar(): Toolbar {
|
override fun playerToolbar(): Toolbar {
|
||||||
return playerToolbar
|
return playerToolbar
|
||||||
|
@ -48,9 +84,12 @@ class MaterialFragment : AbsPlayerFragment() {
|
||||||
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
val darkColor = ColorUtil.darkenColorTheme(color.backgroundColor)
|
||||||
lastColor = color
|
playerContainer?.setBackgroundColor(ColorUtil.darkenColorTheme(color.backgroundColor))
|
||||||
|
upComing?.setBackgroundColor(ColorUtil.darkenColorTheme(darkColor))
|
||||||
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
|
lastColor = color.backgroundColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
|
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
|
@ -82,6 +121,40 @@ class MaterialFragment : AbsPlayerFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
setUpSubFragments()
|
setUpSubFragments()
|
||||||
setUpPlayerToolbar()
|
setUpPlayerToolbar()
|
||||||
|
setupPanel()
|
||||||
|
setUpQueue()
|
||||||
|
getQueuePanel().addBottomSheetCallback(bottomSheetCallbackList)
|
||||||
|
|
||||||
|
playerQueueSheet.setOnTouchListener { _, _ ->
|
||||||
|
(requireActivity() as AbsSlidingMusicPanelActivity).getBottomSheetBehavior()
|
||||||
|
.setAllowDragging(false)
|
||||||
|
getQueuePanel().setAllowDragging(true)
|
||||||
|
return@setOnTouchListener false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setUpQueue() {
|
||||||
|
queueAdapter = PlayingQueueAdapter(
|
||||||
|
requireActivity() as AppCompatActivity, mutableListOf(),
|
||||||
|
MusicPlayerRemote.position,
|
||||||
|
R.layout.item_queue
|
||||||
|
)
|
||||||
|
recyclerView.apply {
|
||||||
|
adapter = queueAdapter
|
||||||
|
layoutManager = LinearLayoutManager(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupPanel() {
|
||||||
|
if (!ViewCompat.isLaidOut(playerContainer) || playerContainer.isLayoutRequested) {
|
||||||
|
playerContainer.addOnLayoutChangeListener(this)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val height = playerContainer?.height ?: 0
|
||||||
|
val width = playerContainer?.width ?: 0
|
||||||
|
val finalHeight = height - (playerControlsContainer.height - width)
|
||||||
|
val panel = getQueuePanel()
|
||||||
|
panel.peekHeight = finalHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSubFragments() {
|
private fun setUpSubFragments() {
|
||||||
|
@ -107,6 +180,7 @@ class MaterialFragment : AbsPlayerFragment() {
|
||||||
|
|
||||||
override fun onServiceConnected() {
|
override fun onServiceConnected() {
|
||||||
updateIsFavorite()
|
updateIsFavorite()
|
||||||
|
queueAdapter.swapDataSet(MusicPlayerRemote.playingQueue)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPlayingMetaChanged() {
|
override fun onPlayingMetaChanged() {
|
||||||
|
@ -119,4 +193,32 @@ class MaterialFragment : AbsPlayerFragment() {
|
||||||
return PlayerFragment()
|
return PlayerFragment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getQueuePanel(): CustomBottomSheetBehavior<FrameLayout> {
|
||||||
|
return CustomBottomSheetBehavior.from(playerQueueSheet) as CustomBottomSheetBehavior<FrameLayout>
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
getQueuePanel().removeBottomSheetCallback(bottomSheetCallbackList)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLayoutChange(
|
||||||
|
v: View?,
|
||||||
|
left: Int,
|
||||||
|
top: Int,
|
||||||
|
right: Int,
|
||||||
|
bottom: Int,
|
||||||
|
oldLeft: Int,
|
||||||
|
oldTop: Int,
|
||||||
|
oldRight: Int,
|
||||||
|
oldBottom: Int
|
||||||
|
) {
|
||||||
|
val height = playerContainer?.height ?: 0
|
||||||
|
val width = playerContainer?.width ?: 0
|
||||||
|
val finalHeight = height - width
|
||||||
|
playerControlsContainer.layoutParams.height = height - width
|
||||||
|
val panel = getQueuePanel()
|
||||||
|
panel.peekHeight = finalHeight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
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
|
||||||
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.views.DrawableGradient
|
import code.name.monkey.retromusic.views.DrawableGradient
|
||||||
import kotlinx.android.synthetic.main.fragment_player.*
|
import kotlinx.android.synthetic.main.fragment_player.*
|
||||||
|
|
||||||
|
@ -73,9 +74,9 @@ class PlayerFragment : AbsPlayerFragment() {
|
||||||
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
|
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
|
@ -85,7 +86,7 @@ class PlayerFragment : AbsPlayerFragment() {
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
colorize(color)
|
colorize(color.backgroundColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,9 @@ class PeakPlayerFragment : AbsPlayerFragment() {
|
||||||
override val paletteColor: Int
|
override val paletteColor: Int
|
||||||
get() = lastColor
|
get() = lastColor
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
playbackControlsFragment.setDark(color)
|
playbackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
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.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_plain_player.*
|
import kotlinx.android.synthetic.main.fragment_plain_player.*
|
||||||
|
|
||||||
class PlainPlayerFragment : AbsPlayerFragment() {
|
class PlainPlayerFragment : AbsPlayerFragment() {
|
||||||
|
@ -93,9 +94,9 @@ class PlainPlayerFragment : AbsPlayerFragment() {
|
||||||
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
plainPlaybackControlsFragment.setDark(color)
|
plainPlaybackControlsFragment.setDark(color.backgroundColor)
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks!!.onPaletteColorChanged()
|
callbacks!!.onPaletteColorChanged()
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
playerToolbar,
|
playerToolbar,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||||
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.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_simple_player.*
|
import kotlinx.android.synthetic.main.fragment_simple_player.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,10 +69,10 @@ class SimplePlayerFragment : AbsPlayerFragment() {
|
||||||
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
return ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
lastColor = color
|
lastColor = color.backgroundColor
|
||||||
callbacks?.onPaletteColorChanged()
|
callbacks?.onPaletteColorChanged()
|
||||||
simplePlaybackControlsFragment.setDark(color)
|
simplePlaybackControlsFragment.setDark(color.backgroundColor)
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(
|
||||||
playerToolbar,
|
playerToolbar,
|
||||||
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),
|
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),
|
||||||
|
|
|
@ -25,6 +25,7 @@ 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
|
||||||
import code.name.monkey.retromusic.util.ViewUtil
|
import code.name.monkey.retromusic.util.ViewUtil
|
||||||
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||||
import kotlinx.android.synthetic.main.fragment_tiny_player.*
|
import kotlinx.android.synthetic.main.fragment_tiny_player.*
|
||||||
|
|
||||||
class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
|
||||||
|
@ -71,10 +72,10 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
|
||||||
private var textColorPrimary = 0
|
private var textColorPrimary = 0
|
||||||
private var textColorPrimaryDisabled = 0
|
private var textColorPrimaryDisabled = 0
|
||||||
|
|
||||||
override fun onColorChanged(color: Int) {
|
override fun onColorChanged(color: MediaNotificationProcessor) {
|
||||||
|
|
||||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||||
color
|
color.backgroundColor
|
||||||
} else {
|
} else {
|
||||||
ThemeStore.accentColor(requireContext())
|
ThemeStore.accentColor(requireContext())
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,17 +29,12 @@ 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.PaletteColorHolder
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel
|
|
||||||
import code.name.monkey.retromusic.util.MusicUtil
|
import code.name.monkey.retromusic.util.MusicUtil
|
||||||
import code.name.monkey.retromusic.util.NavigationUtil
|
import code.name.monkey.retromusic.util.NavigationUtil
|
||||||
import code.name.monkey.retromusic.util.RingtoneManager
|
import code.name.monkey.retromusic.util.RingtoneManager
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.async
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
object SongMenuHelper {
|
object SongMenuHelper {
|
||||||
val MENU_RES = R.menu.menu_item_song
|
const val MENU_RES = R.menu.menu_item_song
|
||||||
|
|
||||||
fun handleMenuClick(activity: FragmentActivity, song: Song, menuItemId: Int): Boolean {
|
fun handleMenuClick(activity: FragmentActivity, song: Song, menuItemId: Int): Boolean {
|
||||||
when (menuItemId) {
|
when (menuItemId) {
|
||||||
|
@ -66,15 +61,8 @@ object SongMenuHelper {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.action_add_to_playlist -> {
|
R.id.action_add_to_playlist -> {
|
||||||
/* AddToPlaylistDialog.create(song)
|
AddToPlaylistDialog.create(song)
|
||||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")*/
|
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||||
|
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
|
||||||
val names = async { PlaylistDatabaseModel().getPlaylistNames() }.await()
|
|
||||||
println(names.toString())
|
|
||||||
AddToPlaylistDialog.create(arrayListOf(song), names)
|
|
||||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.action_play_next -> {
|
R.id.action_play_next -> {
|
||||||
|
|
|
@ -21,11 +21,6 @@ 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.helper.MusicPlayerRemote
|
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.async
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,12 +40,8 @@ object SongsMenuHelper {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.action_add_to_playlist -> {
|
R.id.action_add_to_playlist -> {
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
AddToPlaylistDialog.create(songs)
|
||||||
val names = async { PlaylistDatabaseModel().getPlaylistNames() }.await()
|
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||||
println(names.toString())
|
|
||||||
/*AddToPlaylistDialog.create(songs, names.await())
|
|
||||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")*/
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.action_delete_from_device -> {
|
R.id.action_delete_from_device -> {
|
||||||
|
|
24
app/src/main/res/drawable/ic_pause_sharp_white_64dp.xml
Normal file
24
app/src/main/res/drawable/ic_pause_sharp_white_64dp.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Copyright (c) 2019 Hemanth Savarala.
|
||||||
|
~
|
||||||
|
~ Licensed under the GNU General Public License v3
|
||||||
|
~
|
||||||
|
~ This is free software: you can redistribute it and/or modify it under
|
||||||
|
~ the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
~ See the GNU General Public License for more details.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/md_white_1000"
|
||||||
|
android:pathData="M6 19h4V5H6v14zm8-14v14h4V5h-4z" />
|
||||||
|
</vector>
|
24
app/src/main/res/drawable/ic_play_arrow_sharp_white_64dp.xml
Normal file
24
app/src/main/res/drawable/ic_play_arrow_sharp_white_64dp.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Copyright (c) 2020 Hemanth Savarala.
|
||||||
|
~
|
||||||
|
~ Licensed under the GNU General Public License v3
|
||||||
|
~
|
||||||
|
~ This is free software: you can redistribute it and/or modify it under
|
||||||
|
~ the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
~ See the GNU General Public License for more details.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/md_white_1000"
|
||||||
|
android:pathData="M8 5v14l11-7L8 5z" />
|
||||||
|
</vector>
|
11
app/src/main/res/drawable/ic_repeat_one_sharp_white_24dp.xml
Normal file
11
app/src/main/res/drawable/ic_repeat_one_sharp_white_24dp.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/md_white_1000"
|
||||||
|
android:pathData="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4zm-4-2V9h-1l-2 1v1h1.5v4H13z" />
|
||||||
|
</vector>
|
11
app/src/main/res/drawable/ic_repeat_sharp_white_24dp.xml
Normal file
11
app/src/main/res/drawable/ic_repeat_sharp_white_24dp.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/md_white_1000"
|
||||||
|
android:pathData="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" />
|
||||||
|
</vector>
|
11
app/src/main/res/drawable/ic_shuffle_sharp_white_24dp.xml
Normal file
11
app/src/main/res/drawable/ic_shuffle_sharp_white_24dp.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/md_white_1000"
|
||||||
|
android:pathData="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm0.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z" />
|
||||||
|
</vector>
|
11
app/src/main/res/drawable/ic_skip_next_sharp_white_24dp.xml
Normal file
11
app/src/main/res/drawable/ic_skip_next_sharp_white_24dp.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="@dimen/icon_notification_dimen"
|
||||||
|
android:height="@dimen/icon_notification_dimen"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/md_white_1000"
|
||||||
|
android:pathData="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z" />
|
||||||
|
</vector>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="@dimen/icon_notification_dimen"
|
||||||
|
android:height="@dimen/icon_notification_dimen"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/md_white_1000"
|
||||||
|
android:pathData="M6 6h2v12H6V6zm3.5 6l8.5 6V6l-8.5 6z" />
|
||||||
|
</vector>
|
|
@ -36,24 +36,12 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<fragment
|
||||||
|
android:id="@+id/playerAlbumCoverFragment"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="12dp"
|
tools:layout="@layout/fragment_album_cover" />
|
||||||
app:cardCornerRadius="8dp"
|
|
||||||
app:cardElevation="8dp"
|
|
||||||
app:cardPreventCornerOverlap="false"
|
|
||||||
app:cardUseCompatPadding="true">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/playerImage"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
|
||||||
</code.name.monkey.retromusic.views.HeightFitSquareLayout>
|
</code.name.monkey.retromusic.views.HeightFitSquareLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
android:id="@+id/playerContainer"
|
android:id="@+id/playerContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
|
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
|
||||||
</LinearLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/playerQueueSheet"
|
android:id="@+id/playerQueueSheet"
|
||||||
|
@ -51,7 +51,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:tag="nested_bottom_sheet"
|
|
||||||
app:behavior_hideable="false"
|
app:behavior_hideable="false"
|
||||||
app:cardCornerRadius="0dp"
|
app:cardCornerRadius="0dp"
|
||||||
app:layout_behavior="code.name.monkey.retromusic.CustomBottomSheetBehavior">
|
app:layout_behavior="code.name.monkey.retromusic.CustomBottomSheetBehavior">
|
||||||
|
@ -92,7 +91,6 @@
|
||||||
android:background="?attr/colorSurface"
|
android:background="?attr/colorSurface"
|
||||||
tools:listitem="@layout/item_list" />
|
tools:listitem="@layout/item_list" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -27,26 +27,19 @@
|
||||||
<include layout="@layout/status_bar" />
|
<include layout="@layout/status_bar" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
<code.name.monkey.retromusic.views.WidthFitSquareLayout
|
||||||
|
android:id="@+id/playerAlbumCoverContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_weight="0">
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
app:cardCornerRadius="8dp"
|
|
||||||
app:cardElevation="4dp"
|
|
||||||
app:cardPreventCornerOverlap="false"
|
|
||||||
app:cardUseCompatPadding="true">
|
|
||||||
|
|
||||||
|
<fragment
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
android:id="@+id/playerAlbumCoverFragment"
|
||||||
android:id="@+id/playerImage"
|
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="centerCrop"
|
tools:layout="@layout/fragment_album_cover" />
|
||||||
tools:ignore="ContentDescription,UnusedAttribute"
|
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
|
||||||
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
|
|
||||||
|
|
||||||
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -7,25 +7,14 @@
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true">
|
android:focusable="true">
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?attr/colorSurface" />
|
|
||||||
|
|
||||||
<include layout="@layout/shadow_statusbar_toolbar" />
|
<include layout="@layout/shadow_statusbar_toolbar" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/playerContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<include layout="@layout/status_bar" />
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<code.name.monkey.retromusic.views.WidthFitSquareLayout
|
<code.name.monkey.retromusic.views.WidthFitSquareLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
@ -35,33 +24,101 @@
|
||||||
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:layout="@layout/fragment_album_cover" />
|
tools:layout="@layout/fragment_album_full_cover" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<include layout="@layout/status_bar" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
|
android:id="@+id/playerToolbar"
|
||||||
|
style="@style/Toolbar"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
|
||||||
|
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
||||||
|
</FrameLayout>
|
||||||
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
|
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
|
||||||
|
|
||||||
<FrameLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<fragment
|
<FrameLayout
|
||||||
android:id="@+id/playbackControlsFragment"
|
android:id="@+id/playerQueueSheet"
|
||||||
android:name="code.name.monkey.retromusic.fragments.player.material.MaterialControlsFragment"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:gravity="bottom"
|
||||||
tools:layout="@layout/fragment_material_playback_controls" />
|
app:behavior_hideable="false"
|
||||||
</FrameLayout>
|
app:layout_behavior="code.name.monkey.retromusic.CustomBottomSheetBehavior">
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/sheetContent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0">
|
android:background="?attr/colorSurface"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<LinearLayout
|
||||||
android:id="@+id/playerToolbar"
|
android:id="@+id/playerControlsContainer"
|
||||||
style="@style/Toolbar"
|
android:layout_width="match_parent"
|
||||||
android:layout_gravity="bottom"
|
android:layout_height="wrap_content"
|
||||||
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp"
|
android:orientation="vertical">
|
||||||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black_24dp" />
|
|
||||||
</FrameLayout>
|
<fragment
|
||||||
</LinearLayout>
|
android:id="@+id/playbackControlsFragment"
|
||||||
</FrameLayout>
|
android:name="code.name.monkey.retromusic.fragments.player.material.MaterialControlsFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:layout="@layout/fragment_material_playback_controls" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:id="@+id/upComing"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="end"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp"
|
||||||
|
app:srcCompat="@drawable/ic_shuffle_sharp_white_24dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/player_queue_sub_header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/listPreferredItemHeightSmall"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:text="@string/up_next"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||||
|
android:textColor="?android:attr/textColorSecondary" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/colorSurface"
|
||||||
|
tools:listitem="@layout/item_list" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -30,9 +30,10 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
app:labelBehavior="gone"
|
app:labelBehavior="gone"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/playPauseButton"
|
||||||
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
app:layout_constraintEnd_toStartOf="@id/songTotalTime"
|
||||||
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
app:layout_constraintStart_toEndOf="@id/songCurrentProgress"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toBottomOf="@id/songInfo"
|
||||||
app:thumbRadius="@dimen/slider_thumb_radius"
|
app:thumbRadius="@dimen/slider_thumb_radius"
|
||||||
app:trackHeight="@dimen/slider_track_height"
|
app:trackHeight="@dimen/slider_track_height"
|
||||||
tools:ignore="RtlHardcoded,UnusedAttribute"
|
tools:ignore="RtlHardcoded,UnusedAttribute"
|
||||||
|
@ -61,7 +62,7 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/progressSlider">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
|
@ -114,7 +115,10 @@
|
||||||
android:paddingEnd="16dp"
|
android:paddingEnd="16dp"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"
|
app:layout_constraintBottom_toTopOf="@+id/progressSlider"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/text"
|
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||||
tools:text="@tools:sample/lorem/random" />
|
tools:text="@tools:sample/lorem/random" />
|
||||||
|
|
||||||
|
@ -146,7 +150,7 @@
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toEndOf="@+id/repeatButton"
|
app:layout_constraintStart_toEndOf="@+id/repeatButton"
|
||||||
app:layout_constraintTop_toTopOf="@+id/playPauseButton"
|
app:layout_constraintTop_toTopOf="@+id/playPauseButton"
|
||||||
app:srcCompat="@drawable/ic_skip_previous_white_24dp"
|
app:srcCompat="@drawable/ic_skip_previous_sharp_white_24dp"
|
||||||
tools:ignore="MissingPrefix"
|
tools:ignore="MissingPrefix"
|
||||||
tools:tint="@color/md_black_1000" />
|
tools:tint="@color/md_black_1000" />
|
||||||
|
|
||||||
|
@ -155,12 +159,12 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/roundSelector"
|
android:background="?attr/roundSelector"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/volumeFragmentContainer"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/nextButton"
|
app:layout_constraintEnd_toStartOf="@+id/nextButton"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toEndOf="@+id/previousButton"
|
app:layout_constraintStart_toEndOf="@+id/previousButton"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/songInfo"
|
app:layout_constraintTop_toBottomOf="@+id/progressSlider"
|
||||||
app:srcCompat="@drawable/ic_pause_white_64dp"
|
app:srcCompat="@drawable/ic_pause_sharp_white_64dp"
|
||||||
tools:tint="@color/md_black_1000" />
|
tools:tint="@color/md_black_1000" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageButton
|
<androidx.appcompat.widget.AppCompatImageButton
|
||||||
|
@ -175,7 +179,7 @@
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toEndOf="@+id/playPauseButton"
|
app:layout_constraintStart_toEndOf="@+id/playPauseButton"
|
||||||
app:layout_constraintTop_toTopOf="@+id/playPauseButton"
|
app:layout_constraintTop_toTopOf="@+id/playPauseButton"
|
||||||
app:srcCompat="@drawable/ic_skip_next_white_24dp"
|
app:srcCompat="@drawable/ic_skip_next_sharp_white_24dp"
|
||||||
tools:ignore="MissingPrefix"
|
tools:ignore="MissingPrefix"
|
||||||
tools:tint="@color/md_black_1000" />
|
tools:tint="@color/md_black_1000" />
|
||||||
|
|
||||||
|
@ -190,19 +194,16 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/nextButton"
|
app:layout_constraintStart_toEndOf="@+id/nextButton"
|
||||||
app:layout_constraintTop_toTopOf="@+id/nextButton"
|
app:layout_constraintTop_toTopOf="@+id/nextButton"
|
||||||
app:srcCompat="@drawable/ic_shuffle_white_24dp"
|
app:srcCompat="@drawable/ic_shuffle_sharp_white_24dp"
|
||||||
tools:ignore="MissingPrefix"
|
tools:ignore="MissingPrefix"
|
||||||
tools:tint="@color/md_black_1000" />
|
tools:tint="@color/md_black_1000" />
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/volumeFragmentContainer"
|
android:id="@+id/volumeFragmentContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="0"
|
android:visibility="gone"
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
tools:backgroundTint="@color/md_red_400"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
tools:layout_height="52dp" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -33,13 +33,19 @@ object ColorUtil {
|
||||||
return shiftColor(color, 0.9f)
|
return shiftColor(color, 0.9f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
fun darkenColorTheme(@ColorInt color: Int): Int {
|
||||||
|
return shiftColor(color, 0.8f)
|
||||||
|
}
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
fun lightenColor(@ColorInt color: Int): Int {
|
fun lightenColor(@ColorInt color: Int): Int {
|
||||||
return shiftColor(color, 1.1f)
|
return shiftColor(color, 1.1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isColorLight(@ColorInt color: Int): Boolean {
|
fun isColorLight(@ColorInt color: Int): Boolean {
|
||||||
val darkness = 1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255
|
val darkness =
|
||||||
|
1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255
|
||||||
return darkness < 0.4
|
return darkness < 0.4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +100,14 @@ object ColorUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isColorSaturated(@ColorInt color: Int): Boolean {
|
fun isColorSaturated(@ColorInt color: Int): Boolean {
|
||||||
val max = Math.max(0.299 * Color.red(color), Math.max(0.587 * Color.green(color), 0.114 * Color.blue(color)))
|
val max = Math.max(
|
||||||
val min = Math.min(0.299 * Color.red(color), Math.min(0.587 * Color.green(color), 0.114 * Color.blue(color)))
|
0.299 * Color.red(color),
|
||||||
|
Math.max(0.587 * Color.green(color), 0.114 * Color.blue(color))
|
||||||
|
)
|
||||||
|
val min = Math.min(
|
||||||
|
0.299 * Color.red(color),
|
||||||
|
Math.min(0.587 * Color.green(color), 0.114 * Color.blue(color))
|
||||||
|
)
|
||||||
val diff = Math.abs(max - min)
|
val diff = Math.abs(max - min)
|
||||||
return diff > 20
|
return diff > 20
|
||||||
}
|
}
|
||||||
|
@ -122,12 +134,17 @@ object ColorUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
fun getReadableText(@ColorInt textColor: Int, @ColorInt backgroundColor: Int, difference: Int): Int {
|
fun getReadableText(
|
||||||
|
@ColorInt textColor: Int,
|
||||||
|
@ColorInt backgroundColor: Int,
|
||||||
|
difference: Int
|
||||||
|
): Int {
|
||||||
var textColorFinal = textColor
|
var textColorFinal = textColor
|
||||||
val isLight = isColorLight(backgroundColor)
|
val isLight = isColorLight(backgroundColor)
|
||||||
var i = 0
|
var i = 0
|
||||||
while (getDifference(textColorFinal, backgroundColor) < difference && i < 100) {
|
while (getDifference(textColorFinal, backgroundColor) < difference && i < 100) {
|
||||||
textColorFinal = getMixedColor(textColorFinal, if (isLight) Color.BLACK else Color.WHITE)
|
textColorFinal =
|
||||||
|
getMixedColor(textColorFinal, if (isLight) Color.BLACK else Color.WHITE)
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +154,8 @@ object ColorUtil {
|
||||||
@ColorInt
|
@ColorInt
|
||||||
fun getContrastColor(@ColorInt color: Int): Int {
|
fun getContrastColor(@ColorInt color: Int): Int {
|
||||||
// Counting the perceptive luminance - human eye favors green color...
|
// Counting the perceptive luminance - human eye favors green color...
|
||||||
val a = 1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255
|
val a =
|
||||||
|
1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255
|
||||||
return if (a < 0.5) Color.BLACK else Color.WHITE
|
return if (a < 0.5) Color.BLACK else Color.WHITE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue