Added more themes
This commit is contained in:
parent
df37529db8
commit
d8dbf26fa0
22 changed files with 1081 additions and 399 deletions
|
@ -32,12 +32,13 @@
|
|||
<option name="moduleName" value="app_sansDebug" />
|
||||
<option name="addCompilerBuiltIns" value="true" />
|
||||
<option name="loadBuiltInsFromDependencies" value="true" />
|
||||
<option name="languageVersion" value="1.3" />
|
||||
<option name="apiVersion" value="1.3" />
|
||||
<option name="pluginOptions">
|
||||
<array>
|
||||
<option value="plugin:org.jetbrains.kotlin.android:experimental=false" />
|
||||
<option value="plugin:org.jetbrains.kotlin.android:enabled=true" />
|
||||
<option value="plugin:org.jetbrains.kotlin.android:defaultCacheImplementation=hashMap" />
|
||||
<option value="plugin:org.jetbrains.kotlin.android:configuration=rO0ABXoAAAEvAAAAAwAIZmVhdHVyZXMAAAABAAV2aWV3cwAHcGFja2FnZQAAAAEAG2NvZGUubmFtZS5tb25rZXkucmV0cm9tdXNpYwAHdmFyaWFudAAAAAMAR21haW47L1VzZXJzL2hlbWFudGhzL0Rlc2t0b3AvS2VlcFNhZmUvUmV0cm9NdXNpY1BsYXllci9hcHAvc3JjL21haW4vcmVzAEtub3JtYWw7L1VzZXJzL2hlbWFudGhzL0Rlc2t0b3AvS2VlcFNhZmUvUmV0cm9NdXNpY1BsYXllci9hcHAvc3JjL25vcm1hbC9yZXMAR3NhbnM7L1VzZXJzL2hlbWFudGhzL0Rlc2t0b3AvS2VlcFNhZmUvUmV0cm9NdXNpY1BsYXllci9hcHAvc3JjL3NhbnMvcmVz" />
|
||||
</array>
|
||||
</option>
|
||||
<option name="pluginClasspaths">
|
||||
|
|
|
@ -24,7 +24,11 @@ import code.name.monkey.retromusic.ui.fragments.player.blur.BlurPlayerFragment
|
|||
import code.name.monkey.retromusic.ui.fragments.player.card.CardFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.cardblur.CardBlurFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.fit.FitFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.flat.FlatPlayerFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.full.FullPlayerFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.normal.PlayerFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlayerFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlayerFragment
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
|
@ -221,6 +225,10 @@ abstract class AbsSlidingMusicPanelActivity protected constructor() : AbsMusicSe
|
|||
NowPlayingScreen.CARD -> CardFragment()
|
||||
NowPlayingScreen.BLUR_CARD -> CardBlurFragment()
|
||||
NowPlayingScreen.FIT -> FitFragment()
|
||||
NowPlayingScreen.FLAT -> FlatPlayerFragment()
|
||||
NowPlayingScreen.FULL -> FullPlayerFragment()
|
||||
NowPlayingScreen.PLAIN -> PlainPlayerFragment()
|
||||
NowPlayingScreen.SIMPLE -> SimplePlayerFragment()
|
||||
else -> PlayerFragment()
|
||||
} // must implement AbsPlayerFragment
|
||||
supportFragmentManager.beginTransaction().replace(R.id.player_fragment_container, fragment).commit()
|
||||
|
|
|
@ -8,13 +8,13 @@ import code.name.monkey.retromusic.R;
|
|||
public enum NowPlayingScreen {
|
||||
NORMAL(R.string.normal, R.drawable.np_normal, 0),
|
||||
FLAT(R.string.flat, R.drawable.np_flat, 1),
|
||||
//FULL(R.string.full, R.drawable.np_full, 2),
|
||||
//PLAIN(R.string.plain, R.drawable.np_plain, 3),
|
||||
FULL(R.string.full, R.drawable.np_full, 2),
|
||||
PLAIN(R.string.plain, R.drawable.np_plain, 3),
|
||||
BLUR(R.string.blur, R.drawable.np_blur, 4),
|
||||
//COLOR(R.string.color, R.drawable.np_color, 5),
|
||||
CARD(R.string.card, R.drawable.np_card, 6),
|
||||
//TINY(R.string.tiny, R.drawable.np_tiny, 7),
|
||||
//SIMPLE(R.string.simple, R.drawable.np_simple, 8),
|
||||
SIMPLE(R.string.simple, R.drawable.np_simple, 8),
|
||||
BLUR_CARD(R.string.blur_card, R.drawable.np_blur_card, 9),
|
||||
ADAPTIVE(R.string.adaptive, R.drawable.np_adaptive, 10),
|
||||
//MATERIAL(R.string.material, R.drawable.np_material, 11),
|
||||
|
|
|
@ -4,11 +4,9 @@ import android.os.Bundle
|
|||
import android.view.View
|
||||
import android.view.animation.AccelerateInterpolator
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.widget.ImageButton
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatSeekBar
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.volume_controls.*
|
||||
|
||||
/**
|
||||
* Created by hemanths on 24/09/17.
|
||||
|
@ -28,54 +26,37 @@ abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(), MusicProgr
|
|||
|
||||
abstract fun setDark(color: Int)
|
||||
|
||||
fun showBouceAnimation(view: View) {
|
||||
view.clearAnimation()
|
||||
fun showBonceAnimation(view: View) {
|
||||
view.apply {
|
||||
clearAnimation()
|
||||
scaleX = 0.9f
|
||||
scaleY = 0.9f
|
||||
visibility = View.VISIBLE
|
||||
pivotX = (view.width / 2).toFloat()
|
||||
pivotY = (view.height / 2).toFloat()
|
||||
|
||||
view.scaleX = 0.9f
|
||||
view.scaleY = 0.9f
|
||||
view.visibility = View.VISIBLE
|
||||
view.pivotX = (view.width / 2).toFloat()
|
||||
view.pivotY = (view.height / 2).toFloat()
|
||||
|
||||
view.animate()
|
||||
.setDuration(200)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.scaleX(1.1f)
|
||||
.scaleY(1.1f)
|
||||
.withEndAction {
|
||||
view.animate()
|
||||
.setDuration(200)
|
||||
.setInterpolator(AccelerateInterpolator())
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.alpha(1f)
|
||||
.start()
|
||||
}
|
||||
.start()
|
||||
animate().setDuration(200)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.scaleX(1.1f)
|
||||
.scaleY(1.1f)
|
||||
.withEndAction {
|
||||
animate().setDuration(200)
|
||||
.setInterpolator(AccelerateInterpolator())
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.alpha(1f)
|
||||
.start()
|
||||
}
|
||||
.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* var prevButton: ImageButton? = null
|
||||
var nextButton: ImageButton? = null
|
||||
var repeatButton: ImageButton? = null
|
||||
var shuffleButton: ImageButton? = null
|
||||
var progressSlider: AppCompatSeekBar? = null
|
||||
var songTotalTime: TextView? = null
|
||||
var songCurrentProgress: TextView? = null
|
||||
var volumeContainer: View? = null
|
||||
var playPauseFab: ImageButton? = null*/
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
hideVolumeIfAvailable()
|
||||
}
|
||||
|
||||
/* playPauseFab = view.findViewById(R.id.player_play_pause_button)
|
||||
prevButton = view.findViewById(R.id.player_prev_button)
|
||||
nextButton = view.findViewById(R.id.player_next_button)
|
||||
repeatButton = view.findViewById(R.id.player_repeat_button)
|
||||
shuffleButton = view.findViewById(R.id.player_shuffle_button)
|
||||
progressSlider = view.findViewById(R.id.player_progress_slider)
|
||||
songTotalTime = view.findViewById(R.id.player_song_total_time)
|
||||
songCurrentProgress = view.findViewById(R.id.player_song_current_progress)
|
||||
volumeContainer = view.findViewById(R.id.volume_fragment_container)*/
|
||||
private fun hideVolumeIfAvailable() {
|
||||
volumeFragmentContainer.visibility = if (PreferenceUtil.getInstance().volumeToggle) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
|||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
|
||||
|
||||
class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
@ -42,7 +41,6 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
hideVolumeIfAvailable()
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
|
@ -50,7 +48,7 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
} else {
|
||||
MusicPlayerRemote.resumePlaying()
|
||||
}
|
||||
showBouceAnimation(playPauseButton)
|
||||
showBonceAnimation(playPauseButton)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,10 +178,6 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||
}
|
||||
|
||||
private fun hideVolumeIfAvailable() {
|
||||
volumeFragmentContainer.visibility = if (PreferenceUtil.getInstance().volumeToggle) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
public override fun show() {
|
||||
//Ignore
|
||||
}
|
||||
|
@ -203,6 +197,4 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -57,13 +57,6 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
if (PreferenceUtil.getInstance().volumeToggle) {
|
||||
volumeFragmentContainer.visibility = View.VISIBLE
|
||||
} else {
|
||||
volumeFragmentContainer.visibility = View.GONE
|
||||
}
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
|
|
|
@ -51,11 +51,7 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
setupVolumeControls()
|
||||
hideVolumeIfAvailable()
|
||||
}
|
||||
|
||||
private fun hideVolumeIfAvailable() {
|
||||
volumeFragmentContainer.visibility = if (PreferenceUtil.getInstance().volumeToggle) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
|
|
|
@ -141,13 +141,6 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setProgressBarColor(newColor: Int) {
|
||||
val ld = progressSlider!!.progressDrawable as LayerDrawable
|
||||
val clipDrawable = ld.findDrawableByLayerId(android.R.id.progress) as ClipDrawable
|
||||
clipDrawable.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
|
||||
private fun setUpMusicControllers() {
|
||||
setUpPlayPauseFab()
|
||||
setUpPrevNext()
|
||||
|
@ -265,7 +258,4 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||
}
|
||||
|
||||
private fun hideVolumeIfAvailable() {
|
||||
volumeFragmentContainer.visibility = if (PreferenceUtil.getInstance().volumeToggle) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,234 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.player.full
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.graphics.Color
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.ClipDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import androidx.core.content.ContextCompat
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.ui.fragments.VolumeFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_full_player_controls.*
|
||||
import kotlinx.android.synthetic.main.player_time.*
|
||||
|
||||
/**
|
||||
* Created by hemanths on 20/09/17.
|
||||
*/
|
||||
|
||||
class FullPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_full_player_controls, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
val volumeFragment = childFragmentManager.findFragmentById(R.id.volumeFragment) as VolumeFragment?
|
||||
volumeFragment!!.tintWhiteColor()
|
||||
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
progressViewUpdateHelper!!.start()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
progressViewUpdateHelper!!.stop()
|
||||
}
|
||||
|
||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||
progressSlider.max = total
|
||||
|
||||
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||
animator.duration = 1500
|
||||
animator.interpolator = LinearInterpolator()
|
||||
animator.start()
|
||||
|
||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||
}
|
||||
|
||||
public override fun show() {
|
||||
playPauseButton!!.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
}
|
||||
|
||||
|
||||
public override fun hide() {
|
||||
playPauseButton.apply {
|
||||
scaleX = 0f
|
||||
scaleY = 0f
|
||||
rotation = 0f
|
||||
}
|
||||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
lastPlaybackControlsColor = Color.WHITE
|
||||
lastDisabledPlaybackControlsColor = ContextCompat.getColor(context!!, R.color.md_grey_500)
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
setProgressBarColor(color)
|
||||
} else {
|
||||
val accentColor = ThemeStore.accentColor(context!!)
|
||||
setProgressBarColor(accentColor)
|
||||
}
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
|
||||
}
|
||||
|
||||
private fun setProgressBarColor(dark: Int) {
|
||||
val ld = progressSlider!!.progressDrawable as LayerDrawable
|
||||
val clipDrawable = ld.findDrawableByLayerId(android.R.id.progress) as ClipDrawable
|
||||
clipDrawable.setColorFilter(dark, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
updatePlayPauseDrawableState()
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updateSong()
|
||||
}
|
||||
|
||||
private fun updateSong() {
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
title.text = song.title
|
||||
text.text = song.artistName
|
||||
}
|
||||
|
||||
override fun onPlayingMetaChanged() {
|
||||
super.onPlayingMetaChanged()
|
||||
updateSong()
|
||||
}
|
||||
|
||||
override fun onPlayStateChanged() {
|
||||
updatePlayPauseDrawableState()
|
||||
}
|
||||
|
||||
private fun updatePlayPauseDrawableState() {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
|
||||
} else {
|
||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpPlayPauseFab() {
|
||||
|
||||
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
|
||||
playPauseButton.post {
|
||||
if (playPauseButton != null) {
|
||||
playPauseButton.pivotX = (playPauseButton.width / 2).toFloat()
|
||||
playPauseButton.pivotY = (playPauseButton.height / 2).toFloat()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpMusicControllers() {
|
||||
setUpPlayPauseFab()
|
||||
setUpPrevNext()
|
||||
setUpRepeatButton()
|
||||
setUpShuffleButton()
|
||||
setUpProgressSlider()
|
||||
}
|
||||
|
||||
private fun setUpPrevNext() {
|
||||
updatePrevNextColor()
|
||||
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
|
||||
previousButton.setOnClickListener { MusicPlayerRemote.back() }
|
||||
}
|
||||
|
||||
|
||||
private fun updatePrevNextColor() {
|
||||
nextButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
override fun setUpProgressSlider() {
|
||||
progressSlider!!.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
MusicPlayerRemote.seekTo(progress)
|
||||
onUpdateProgressViews(MusicPlayerRemote.songProgressMillis, MusicPlayerRemote.songDurationMillis)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun onRepeatModeChanged() {
|
||||
updateRepeatState()
|
||||
}
|
||||
|
||||
override fun onShuffleModeChanged() {
|
||||
updateShuffleState()
|
||||
}
|
||||
|
||||
private fun setUpShuffleButton() {
|
||||
shuffleButton.setOnClickListener { v -> MusicPlayerRemote.toggleShuffleMode() }
|
||||
}
|
||||
|
||||
override fun updateShuffleState() {
|
||||
when (MusicPlayerRemote.shuffleMode) {
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpRepeatButton() {
|
||||
repeatButton.setOnClickListener { MusicPlayerRemote.cycleRepeatMode() }
|
||||
}
|
||||
|
||||
override fun updateRepeatState() {
|
||||
when (MusicPlayerRemote.repeatMode) {
|
||||
MusicService.REPEAT_MODE_NONE -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
MusicService.REPEAT_MODE_ALL -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
MusicService.REPEAT_MODE_THIS -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp)
|
||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.player.full
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment
|
||||
import kotlinx.android.synthetic.main.fragment_full.*
|
||||
|
||||
class FullPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
|
||||
override fun toolbarGet(): Toolbar {
|
||||
return playerToolbar
|
||||
}
|
||||
|
||||
private var lastColor: Int = 0
|
||||
override val paletteColor: Int
|
||||
get() = lastColor
|
||||
private lateinit var fullPlaybackControlsFragment: FullPlaybackControlsFragment
|
||||
|
||||
private fun setUpPlayerToolbar() {
|
||||
playerToolbar.apply {
|
||||
inflateMenu(R.menu.menu_player)
|
||||
setNavigationIcon(R.drawable.ic_close_white_24dp)
|
||||
setNavigationOnClickListener { activity!!.onBackPressed() }
|
||||
setOnMenuItemClickListener(this@FullPlayerFragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_full, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpSubFragments()
|
||||
setUpPlayerToolbar()
|
||||
}
|
||||
|
||||
private fun setUpSubFragments() {
|
||||
fullPlaybackControlsFragment = childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as FullPlaybackControlsFragment
|
||||
|
||||
val playerAlbumCoverFragment = childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
|
||||
playerAlbumCoverFragment.setCallbacks(this)
|
||||
playerAlbumCoverFragment.removeSlideEffect()
|
||||
}
|
||||
|
||||
override fun onShow() {
|
||||
|
||||
}
|
||||
|
||||
override fun onHide() {
|
||||
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return Color.WHITE
|
||||
}
|
||||
|
||||
override fun onColorChanged(color: Int) {
|
||||
lastColor = color
|
||||
fullPlaybackControlsFragment.setDark(color)
|
||||
callbacks!!.onPaletteColorChanged()
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
|
||||
}
|
||||
|
||||
override fun onFavoriteToggled() {
|
||||
toggleFavorite(MusicPlayerRemote.currentSong)
|
||||
}
|
||||
|
||||
override fun toggleFavorite(song: Song) {
|
||||
super.toggleFavorite(song)
|
||||
if (song.id == MusicPlayerRemote.currentSong.id) {
|
||||
updateIsFavorite()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,252 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.player.plain
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.ClipDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.AccelerateInterpolator
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
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.TintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
|
||||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
import kotlinx.android.synthetic.main.player_time.*
|
||||
import kotlinx.android.synthetic.main.volume_controls.*
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
|
||||
class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
||||
|
||||
override fun onPlayStateChanged() {
|
||||
updatePlayPauseDrawableState()
|
||||
}
|
||||
|
||||
override fun onRepeatModeChanged() {
|
||||
updateRepeatState()
|
||||
}
|
||||
|
||||
override fun onShuffleModeChanged() {
|
||||
updateShuffleState()
|
||||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
updatePlayPauseDrawableState()
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
return inflater.inflate(R.layout.fragment_plain_controls_fragment, container, false)
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
progressViewUpdateHelper!!.start()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
progressViewUpdateHelper!!.stop()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
} else {
|
||||
MusicPlayerRemote.resumePlaying()
|
||||
}
|
||||
showBonceAnimation()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpPlayPauseFab() {
|
||||
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
|
||||
}
|
||||
|
||||
private fun setUpMusicControllers() {
|
||||
setUpPlayPauseFab()
|
||||
setUpPrevNext()
|
||||
setUpRepeatButton()
|
||||
setUpShuffleButton()
|
||||
setUpProgressSlider()
|
||||
}
|
||||
|
||||
private fun setUpPrevNext() {
|
||||
updatePrevNextColor()
|
||||
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
|
||||
previousButton.setOnClickListener { MusicPlayerRemote.back() }
|
||||
}
|
||||
|
||||
private fun updatePrevNextColor() {
|
||||
nextButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
val colorBg = ATHUtil.resolveColor(activity, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
setProgressBarColor(progressSlider, color)
|
||||
}
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
}
|
||||
|
||||
private fun setProgressBarColor(progressBar: SeekBar?, newColor: Int) {
|
||||
val ld = progressBar!!.progressDrawable as LayerDrawable
|
||||
val clipDrawable = ld.findDrawableByLayerId(android.R.id.progress) as ClipDrawable
|
||||
clipDrawable.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
private fun setUpShuffleButton() {
|
||||
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
|
||||
}
|
||||
|
||||
override fun updateShuffleState() {
|
||||
when (MusicPlayerRemote.shuffleMode) {
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpRepeatButton() {
|
||||
repeatButton.setOnClickListener { MusicPlayerRemote.cycleRepeatMode() }
|
||||
}
|
||||
|
||||
override fun updateRepeatState() {
|
||||
when (MusicPlayerRemote.repeatMode) {
|
||||
MusicService.REPEAT_MODE_NONE -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
MusicService.REPEAT_MODE_ALL -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
MusicService.REPEAT_MODE_THIS -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp)
|
||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override fun show() {
|
||||
playPauseButton!!.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
}
|
||||
|
||||
public override fun hide() {
|
||||
if (playPauseButton != null) {
|
||||
playPauseButton!!.apply {
|
||||
scaleX = 0f
|
||||
scaleY = 0f
|
||||
rotation = 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setUpProgressSlider() {
|
||||
progressSlider.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
MusicPlayerRemote.seekTo(progress)
|
||||
onUpdateProgressViews(MusicPlayerRemote.songProgressMillis,
|
||||
MusicPlayerRemote.songDurationMillis)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun showBonceAnimation() {
|
||||
playPauseButton.apply {
|
||||
clearAnimation()
|
||||
scaleX = 0.9f
|
||||
scaleY = 0.9f
|
||||
visibility = View.VISIBLE
|
||||
pivotX = (width / 2).toFloat()
|
||||
pivotY = (height / 2).toFloat()
|
||||
|
||||
animate().setDuration(200)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.scaleX(1.1f)
|
||||
.scaleY(1.1f)
|
||||
.withEndAction {
|
||||
animate().setDuration(200)
|
||||
.setInterpolator(AccelerateInterpolator())
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.alpha(1f).start()
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePlayPauseDrawableState() {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
|
||||
} else {
|
||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||
progressSlider.max = total
|
||||
|
||||
val animator = ObjectAnimator.ofInt(progressSlider, "progress", progress)
|
||||
animator.duration = 1500
|
||||
animator.interpolator = LinearInterpolator()
|
||||
animator.start()
|
||||
|
||||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.player.plain
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment
|
||||
import kotlinx.android.synthetic.main.fragment_plain_player.*
|
||||
|
||||
class PlainPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
|
||||
override fun toolbarGet(): Toolbar {
|
||||
return playerToolbar
|
||||
}
|
||||
|
||||
private lateinit var plainPlaybackControlsFragment: PlainPlaybackControlsFragment
|
||||
private var lastColor: Int = 0
|
||||
override val paletteColor: Int
|
||||
get() = lastColor
|
||||
|
||||
|
||||
override fun onPlayingMetaChanged() {
|
||||
super.onPlayingMetaChanged()
|
||||
updateSong()
|
||||
}
|
||||
|
||||
private fun updateSong() {
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
playerTitle.text = song.title
|
||||
playerText.text = song.artistName
|
||||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
super.onServiceConnected()
|
||||
updateSong()
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_plain_player, container, false)
|
||||
}
|
||||
|
||||
private fun setUpPlayerToolbar() {
|
||||
playerToolbar.apply {
|
||||
inflateMenu(R.menu.menu_player)
|
||||
setNavigationOnClickListener { activity!!.onBackPressed() }
|
||||
setOnMenuItemClickListener(this@PlainPlayerFragment)
|
||||
ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpSubFragments()
|
||||
setUpPlayerToolbar()
|
||||
}
|
||||
|
||||
private fun setUpSubFragments() {
|
||||
plainPlaybackControlsFragment = childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as PlainPlaybackControlsFragment
|
||||
val playerAlbumCoverFragment = childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
|
||||
playerAlbumCoverFragment.setCallbacks(this)
|
||||
}
|
||||
|
||||
override fun onShow() {
|
||||
plainPlaybackControlsFragment.show()
|
||||
}
|
||||
|
||||
override fun onHide() {
|
||||
plainPlaybackControlsFragment.hide()
|
||||
onBackPressed()
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||
}
|
||||
|
||||
override fun onColorChanged(color: Int) {
|
||||
plainPlaybackControlsFragment.setDark(color)
|
||||
lastColor = color
|
||||
callbacks!!.onPaletteColorChanged()
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar!!, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
|
||||
}
|
||||
|
||||
override fun onFavoriteToggled() {
|
||||
toggleFavorite(MusicPlayerRemote.currentSong)
|
||||
}
|
||||
|
||||
override fun toggleFavorite(song: Song) {
|
||||
super.toggleFavorite(song)
|
||||
if (song.id == MusicPlayerRemote.currentSong.id) {
|
||||
updateIsFavorite()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,219 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.player.simple
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
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.TintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||
import code.name.monkey.retromusic.service.MusicService
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.android.synthetic.main.fragment_simple_controls_fragment.*
|
||||
import kotlinx.android.synthetic.main.media_button.*
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
|
||||
class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
private var lastPlaybackControlsColor: Int = 0
|
||||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
|
||||
|
||||
|
||||
override fun onPlayStateChanged() {
|
||||
updatePlayPauseDrawableState()
|
||||
}
|
||||
|
||||
override fun onRepeatModeChanged() {
|
||||
updateRepeatState()
|
||||
}
|
||||
|
||||
override fun onShuffleModeChanged() {
|
||||
updateShuffleState()
|
||||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
updatePlayPauseDrawableState()
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updateSong()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
||||
}
|
||||
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_simple_controls_fragment, container, false)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
progressViewUpdateHelper!!.start()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
progressViewUpdateHelper!!.stop()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpMusicControllers()
|
||||
|
||||
playPauseButton.setOnClickListener {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
MusicPlayerRemote.pauseSong()
|
||||
} else {
|
||||
MusicPlayerRemote.resumePlaying()
|
||||
}
|
||||
showBonceAnimation(playPauseButton)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpMusicControllers() {
|
||||
setUpPlayPauseFab()
|
||||
setUpPrevNext()
|
||||
setUpRepeatButton()
|
||||
setUpShuffleButton()
|
||||
setUpProgressSlider()
|
||||
}
|
||||
|
||||
private fun setUpPrevNext() {
|
||||
updatePrevNextColor()
|
||||
nextButton.setOnClickListener { MusicPlayerRemote.playNextSong() }
|
||||
previousButton.setOnClickListener { MusicPlayerRemote.back() }
|
||||
}
|
||||
|
||||
private fun updatePrevNextColor() {
|
||||
nextButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
private fun setUpShuffleButton() {
|
||||
shuffleButton.setOnClickListener { MusicPlayerRemote.toggleShuffleMode() }
|
||||
}
|
||||
|
||||
override fun updateShuffleState() {
|
||||
when (MusicPlayerRemote.shuffleMode) {
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpRepeatButton() {
|
||||
repeatButton.setOnClickListener { MusicPlayerRemote.cycleRepeatMode() }
|
||||
}
|
||||
|
||||
override fun updateRepeatState() {
|
||||
when (MusicPlayerRemote.repeatMode) {
|
||||
MusicService.REPEAT_MODE_NONE -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
MusicService.REPEAT_MODE_ALL -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp)
|
||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
MusicService.REPEAT_MODE_THIS -> {
|
||||
repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp)
|
||||
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSong() {
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
title.text = song.title
|
||||
text.text = song.artistName
|
||||
}
|
||||
|
||||
override fun onPlayingMetaChanged() {
|
||||
super.onPlayingMetaChanged()
|
||||
updateSong()
|
||||
|
||||
}
|
||||
|
||||
public override fun show() {
|
||||
playPauseButton!!.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
}
|
||||
|
||||
public override fun hide() {
|
||||
if (playPauseButton != null) {
|
||||
playPauseButton!!.apply {
|
||||
scaleX = 0f
|
||||
scaleY = 0f
|
||||
rotation = 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setUpProgressSlider() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||
songCurrentProgress!!.text = String.format("%s / %s", MusicUtil.getReadableDurationString(progress.toLong()),
|
||||
MusicUtil.getReadableDurationString(total.toLong()))
|
||||
}
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
val colorBg = ATHUtil.resolveColor(activity, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper
|
||||
.getSecondaryTextColor(activity, true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper
|
||||
.getSecondaryDisabledTextColor(activity, true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper
|
||||
.getPrimaryTextColor(activity, false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper
|
||||
.getPrimaryDisabledTextColor(activity, false)
|
||||
}
|
||||
|
||||
if (PreferenceUtil.getInstance().adaptiveColor) {
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)), false)
|
||||
TintHelper.setTintAuto(playPauseButton, color, true)
|
||||
text.setTextColor(color)
|
||||
} else {
|
||||
text.setTextColor(ThemeStore.accentColor(context!!))
|
||||
}
|
||||
|
||||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
}
|
||||
|
||||
private fun setUpPlayPauseFab() {
|
||||
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
|
||||
}
|
||||
|
||||
private fun updatePlayPauseDrawableState() {
|
||||
if (MusicPlayerRemote.isPlaying) {
|
||||
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
|
||||
} else {
|
||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.player.simple
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment
|
||||
import code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment
|
||||
import kotlinx.android.synthetic.main.fragment_simple_player.*
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
|
||||
class SimplePlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
|
||||
override fun toolbarGet(): Toolbar {
|
||||
return playerToolbar
|
||||
}
|
||||
|
||||
private var lastColor: Int = 0
|
||||
override val paletteColor: Int
|
||||
get() = lastColor
|
||||
|
||||
private lateinit var simplePlaybackControlsFragment: SimplePlaybackControlsFragment
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
|
||||
return inflater.inflate(R.layout.fragment_simple_player, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpSubFragments()
|
||||
setUpPlayerToolbar()
|
||||
}
|
||||
|
||||
private fun setUpSubFragments() {
|
||||
val playerAlbumCoverFragment = childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
|
||||
playerAlbumCoverFragment.setCallbacks(this)
|
||||
simplePlaybackControlsFragment = childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as SimplePlaybackControlsFragment
|
||||
|
||||
}
|
||||
|
||||
override fun onShow() {
|
||||
simplePlaybackControlsFragment.show()
|
||||
}
|
||||
|
||||
override fun onHide() {
|
||||
simplePlaybackControlsFragment.hide()
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
return ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||
}
|
||||
|
||||
override fun onColorChanged(color: Int) {
|
||||
lastColor = color
|
||||
callbacks!!.onPaletteColorChanged()
|
||||
simplePlaybackControlsFragment.setDark(color)
|
||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
|
||||
|
||||
}
|
||||
|
||||
override fun onFavoriteToggled() {
|
||||
toggleFavorite(MusicPlayerRemote.currentSong)
|
||||
}
|
||||
|
||||
override fun toggleFavorite(song: Song) {
|
||||
super.toggleFavorite(song)
|
||||
if (song.id == MusicPlayerRemote.currentSong.id) {
|
||||
updateIsFavorite()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpPlayerToolbar() {
|
||||
playerToolbar.apply {
|
||||
inflateMenu(R.menu.menu_player)
|
||||
setNavigationOnClickListener { activity!!.onBackPressed() }
|
||||
setOnMenuItemClickListener(this@SimplePlayerFragment)
|
||||
ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,7 +37,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/player_album_cover_fragment"
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -50,7 +50,6 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
|
@ -60,9 +59,8 @@
|
|||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:textStyle="bold"
|
||||
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
|
||||
android:id="@+id/playerTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
|
@ -72,18 +70,17 @@
|
|||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:text="Title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/playerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="Text" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -93,7 +90,7 @@
|
|||
android:layout_weight="1">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlaybackControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -101,13 +98,12 @@
|
|||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/toolbar_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/player_toolbar"
|
||||
android:id="@+id/playerToolbar"
|
||||
style="@style/Toolbar"
|
||||
android:navigationIcon="@drawable/ic_close_white_24dp"
|
||||
app:navigationIcon="@drawable/ic_close_white_24dp" />
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/player_album_cover_fragment"
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -58,7 +58,7 @@
|
|||
android:paddingTop="8dp">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlaybackControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -66,13 +66,12 @@
|
|||
tools:layout="@layout/fragment_simple_controls_fragment" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/toolbar_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/player_toolbar"
|
||||
android:id="@+id/playerToolbar"
|
||||
style="@style/Toolbar"
|
||||
android:navigationIcon="@drawable/ic_close_white_24dp"
|
||||
app:navigationIcon="@drawable/ic_close_white_24dp" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
android:focusable="true">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/player_album_cover_fragment"
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -30,7 +30,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.full.FullPlaybackControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -43,7 +43,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/player_toolbar"
|
||||
android:id="@+id/playerToolbar"
|
||||
style="@style/Toolbar"
|
||||
android:navigationIcon="@drawable/ic_close_white_24dp" />
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
|
@ -22,6 +23,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.75"
|
||||
android:gravity="center"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
|
@ -29,7 +31,7 @@
|
|||
android:textColor="@color/md_white_1000" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/player_progress_slider"
|
||||
android:id="@+id/progressSlider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:maxHeight="3dp"
|
||||
|
@ -41,55 +43,22 @@
|
|||
android:thumb="@drawable/switch_thumb_material"
|
||||
tools:progress="20" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/player_song_current_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="22.00" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/player_song_total_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="22.00" />
|
||||
</LinearLayout>
|
||||
<include layout="@layout/player_time" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/player_media_controller_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layoutDirection="ltr"
|
||||
tools:ignore="ContentDescription,UnusedAttribute">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_prev_button"
|
||||
android:id="@+id/previousButton"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_toStartOf="@+id/player_play_pause_button"
|
||||
android:layout_toLeftOf="@+id/player_play_pause_button"
|
||||
android:layout_toStartOf="@+id/playPauseButton"
|
||||
android:layout_toLeftOf="@+id/playPauseButton"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
|
@ -97,13 +66,13 @@
|
|||
tools:ignore="MissingPrefix" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_next_button"
|
||||
android:id="@+id/nextButton"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@+id/player_play_pause_button"
|
||||
android:layout_toRightOf="@+id/player_play_pause_button"
|
||||
android:layout_toEndOf="@+id/playPauseButton"
|
||||
android:layout_toRightOf="@+id/playPauseButton"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
|
@ -111,7 +80,7 @@
|
|||
tools:ignore="MissingPrefix" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_repeat_button"
|
||||
android:id="@+id/repeatButton"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_alignParentStart="true"
|
||||
|
@ -124,7 +93,7 @@
|
|||
tools:ignore="MissingPrefix" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_shuffle_button"
|
||||
android:id="@+id/shuffleButton"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
@ -137,7 +106,7 @@
|
|||
tools:ignore="MissingPrefix" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_play_pause_button"
|
||||
android:id="@+id/playPauseButton"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_centerInParent="true"
|
||||
|
@ -150,16 +119,5 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/volume_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/volume_fragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.VolumeFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/fragment_volume" />
|
||||
</FrameLayout>
|
||||
<include layout="@layout/volume_controls" />
|
||||
</LinearLayout>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -8,7 +7,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/player_progress_slider"
|
||||
android:id="@+id/progressSlider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="3dp"
|
||||
|
@ -18,131 +17,9 @@
|
|||
android:splitTrack="false"
|
||||
tools:progress="20" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
<include layout="@layout/player_time" />
|
||||
|
||||
<include layout="@layout/media_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/player_song_current_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="22.00" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/player_song_total_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="22.00" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/player_media_controller_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
tools:ignore="ContentDescription,UnusedAttribute">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_prev_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_toStartOf="@+id/dummy_fab"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_skip_previous_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_next_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@+id/dummy_fab"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_skip_next_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_repeat_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_repeat_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_shuffle_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_shuffle_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/dummy_fab"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_play_pause_button"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/color_circle_gradient"
|
||||
android:elevation="6dp"
|
||||
android:padding="16dp"
|
||||
app:srcCompat="@drawable/ic_play_arrow_white_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/volume_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/volume_fragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.VolumeFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:layout="@layout/fragment_volume" />
|
||||
</FrameLayout>
|
||||
<include layout="@layout/volume_controls" />
|
||||
</LinearLayout>
|
|
@ -27,7 +27,6 @@
|
|||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
|
@ -35,9 +34,8 @@
|
|||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:textStyle="bold"
|
||||
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
|
||||
android:id="@+id/playerTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
|
@ -47,18 +45,17 @@
|
|||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:text="Title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/text"
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/playerText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="Text" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -67,7 +64,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/player_album_cover_fragment"
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -80,7 +77,7 @@
|
|||
android:layout_weight="1">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlaybackControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -88,13 +85,12 @@
|
|||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/toolbar_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/player_toolbar"
|
||||
android:id="@+id/playerToolbar"
|
||||
style="@style/Toolbar"
|
||||
android:navigationIcon="@drawable/ic_close_white_24dp"
|
||||
app:navigationIcon="@drawable/ic_close_white_24dp" />
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -8,11 +7,10 @@
|
|||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
|
@ -22,7 +20,6 @@
|
|||
|
||||
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
|
||||
android:id="@+id/title"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -31,6 +28,7 @@
|
|||
android:maxLines="1"
|
||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:text="Title" />
|
||||
|
||||
|
@ -48,7 +46,7 @@
|
|||
tools:text="Text" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/player_song_current_progress"
|
||||
android:id="@+id/songCurrentProgress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -62,96 +60,8 @@
|
|||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/player_media_controller_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
tools:ignore="ContentDescription,UnusedAttribute">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_prev_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_toStartOf="@+id/dummy_fab"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_skip_previous_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
<include layout="@layout/media_button" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_next_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toEndOf="@+id/dummy_fab"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_skip_next_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_repeat_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_repeat_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_shuffle_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="?attr/roundSelector"
|
||||
android:padding="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_shuffle_white_24dp"
|
||||
tools:ignore="MissingPrefix"
|
||||
tools:tint="@color/md_black_1000" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/dummy_fab"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/player_play_pause_button"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/color_circle_gradient"
|
||||
android:elevation="6dp"
|
||||
android:padding="16dp"
|
||||
app:srcCompat="@drawable/ic_play_arrow_white_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/volume_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/volume_fragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.VolumeFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/fragment_volume" />
|
||||
</FrameLayout>
|
||||
<include layout="@layout/volume_controls" />
|
||||
</LinearLayout>
|
|
@ -8,11 +8,6 @@
|
|||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/gradient_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include layout="@layout/shadow_statusbar_toolbar" />
|
||||
|
||||
<code.name.monkey.retromusic.views.FitSystemWindowsLayout
|
||||
|
@ -38,7 +33,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/player_album_cover_fragment"
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -51,7 +46,7 @@
|
|||
android:layout_weight="1">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/playback_controls_fragment"
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlaybackControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -59,13 +54,12 @@
|
|||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/toolbar_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/player_toolbar"
|
||||
android:id="@+id/playerToolbar"
|
||||
style="@style/Toolbar"
|
||||
android:navigationIcon="@drawable/ic_close_white_24dp"
|
||||
app:navigationIcon="@drawable/ic_close_white_24dp" />
|
||||
|
|
Loading…
Reference in a new issue