Fix alignments
This commit is contained in:
parent
4d0107bd74
commit
0a49d98c24
16 changed files with 1082 additions and 1092 deletions
|
@ -4,24 +4,26 @@ import androidx.annotation.DrawableRes
|
|||
import androidx.annotation.StringRes
|
||||
import code.name.monkey.retromusic.R
|
||||
|
||||
enum class NowPlayingScreen constructor(
|
||||
@param:StringRes @field:StringRes
|
||||
val titleRes: Int,
|
||||
@param:DrawableRes @field:DrawableRes val drawableResId: Int,
|
||||
val id: Int
|
||||
) {
|
||||
|
||||
NORMAL(R.string.normal, R.drawable.np_normal, 0),
|
||||
FLAT(R.string.flat, R.drawable.np_flat, 1),
|
||||
FIT(R.string.fit, R.drawable.np_fit, 12),
|
||||
TINY(R.string.tiny, R.drawable.np_tiny, 7),
|
||||
PEAK(R.string.peak, R.drawable.np_peak, 14),
|
||||
|
||||
enum class NowPlayingScreen constructor(@param:StringRes @field:StringRes
|
||||
val titleRes: Int,
|
||||
@param:DrawableRes @field:DrawableRes val drawableResId: Int,
|
||||
val id: Int) {
|
||||
ADAPTIVE(R.string.adaptive, R.drawable.np_adaptive, 10),
|
||||
BLUR(R.string.blur, R.drawable.np_blur, 4),
|
||||
BLUR_CARD(R.string.blur_card, R.drawable.np_blur_card, 9),
|
||||
CARD(R.string.card, R.drawable.np_card, 6),
|
||||
COLOR(R.string.color, R.drawable.np_color, 5),
|
||||
FIT(R.string.fit, R.drawable.np_fit, 12),
|
||||
FLAT(R.string.flat, R.drawable.np_flat, 1),
|
||||
FULL(R.string.full, R.drawable.np_full, 2),
|
||||
MATERIAL(R.string.material, R.drawable.np_material, 11),
|
||||
NORMAL(R.string.normal, R.drawable.np_normal, 0),
|
||||
PLAIN(R.string.plain, R.drawable.np_plain, 3),
|
||||
TINY(R.string.tiny, R.drawable.np_tiny, 7),
|
||||
SIMPLE(R.string.simple, R.drawable.np_simple, 8),
|
||||
PEAK(R.string.peak, R.drawable.np_peak, 14)
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,11 @@ import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.so
|
|||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.songTotalTime
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.text
|
||||
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.title
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.nextButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.playPauseButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.previousButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.repeatButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.shuffleButton
|
||||
|
||||
class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
|
@ -91,7 +94,6 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
updateShuffleState()
|
||||
}
|
||||
|
||||
|
||||
fun setDark(textColor: Int, background: Int) {
|
||||
setDark(textColor)
|
||||
TintHelper.setTintAuto(playPauseButton, background, false)
|
||||
|
@ -123,15 +125,13 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
playPauseButton.setOnClickListener(PlayPauseButtonOnClickHandler())
|
||||
}
|
||||
|
||||
|
||||
private fun updatePlayPauseDrawableState() {
|
||||
when {
|
||||
MusicPlayerRemote.isPlaying -> playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
|
||||
else -> playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
|
||||
else -> playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun setUpMusicControllers() {
|
||||
setUpPlayPauseFab()
|
||||
setUpPrevNext()
|
||||
|
@ -157,7 +157,10 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
override fun updateShuffleState() {
|
||||
when (MusicPlayerRemote.shuffleMode) {
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
|
||||
lastPlaybackControlsColor,
|
||||
PorterDuff.Mode.SRC_IN
|
||||
)
|
||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
@ -183,14 +186,13 @@ class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public override fun show() {
|
||||
playPauseButton!!.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
}
|
||||
|
||||
public override fun hide() {
|
||||
|
|
|
@ -36,7 +36,6 @@ import kotlinx.android.synthetic.main.fragment_player_playback_controls.songTota
|
|||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.text
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.title
|
||||
|
||||
|
||||
class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
||||
private var lastPlaybackControlsColor: Int = 0
|
||||
|
@ -48,8 +47,10 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
|
||||
return inflater.inflate(R.layout.fragment_player_playback_controls, container, false)
|
||||
}
|
||||
|
@ -72,10 +73,12 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
val colorBg = ATHUtil.resolveColor(requireContext(), android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
||||
lastDisabledPlaybackControlsColor =
|
||||
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
|
||||
} else {
|
||||
lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
|
||||
lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||
lastDisabledPlaybackControlsColor =
|
||||
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
|
||||
}
|
||||
|
||||
val colorFinal = if (PreferenceUtil.getInstance(requireContext()).adaptiveColor) {
|
||||
|
@ -84,7 +87,11 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
ThemeStore.accentColor(requireContext())
|
||||
}.ripAlpha()
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(requireContext(), ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(
|
||||
playPauseButton,
|
||||
MaterialValueHelper.getPrimaryTextColor(requireContext(), ColorUtil.isColorLight(colorFinal)),
|
||||
false
|
||||
)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal, false)
|
||||
|
@ -173,7 +180,10 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
override fun updateShuffleState() {
|
||||
when (MusicPlayerRemote.shuffleMode) {
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
|
||||
lastPlaybackControlsColor,
|
||||
PorterDuff.Mode.SRC_IN
|
||||
)
|
||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
@ -201,11 +211,11 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
public override fun show() {
|
||||
playPauseButton!!.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
}
|
||||
|
||||
public override fun hide() {
|
||||
|
@ -223,8 +233,10 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
MusicPlayerRemote.seekTo(progress)
|
||||
onUpdateProgressViews(MusicPlayerRemote.songProgressMillis,
|
||||
MusicPlayerRemote.songDurationMillis)
|
||||
onUpdateProgressViews(
|
||||
MusicPlayerRemote.songProgressMillis,
|
||||
MusicPlayerRemote.songDurationMillis
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -241,5 +253,4 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,10 +26,14 @@ import code.name.monkey.retromusic.service.MusicService
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.*
|
||||
import kotlinx.android.synthetic.main.media_button.playPauseButton
|
||||
import kotlinx.android.synthetic.main.media_button.repeatButton
|
||||
import kotlinx.android.synthetic.main.media_button.shuffleButton
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.nextButton
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.playPauseButton
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.previousButton
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.progressSlider
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.repeatButton
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.shuffleButton
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.songCurrentProgress
|
||||
import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.songTotalTime
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
|
@ -41,7 +45,6 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
private var lastDisabledPlaybackControlsColor: Int = 0
|
||||
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
|
||||
|
||||
|
||||
override fun onPlayStateChanged() {
|
||||
updatePlayPauseDrawableState()
|
||||
}
|
||||
|
@ -70,7 +73,6 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
return inflater.inflate(R.layout.fragment_plain_controls_fragment, container, false)
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
progressViewUpdateHelper.start()
|
||||
|
@ -118,7 +120,6 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
previousButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
|
||||
override fun setDark(color: Int) {
|
||||
val colorBg = ATHUtil.resolveColor(context!!, android.R.attr.colorBackground)
|
||||
if (ColorUtil.isColorLight(colorBg)) {
|
||||
|
@ -136,7 +137,11 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
}
|
||||
volumeFragment?.setTintable(colorFinal)
|
||||
|
||||
TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false)
|
||||
TintHelper.setTintAuto(
|
||||
playPauseButton,
|
||||
MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)),
|
||||
false
|
||||
)
|
||||
TintHelper.setTintAuto(playPauseButton, colorFinal, true)
|
||||
|
||||
ViewUtil.setProgressDrawable(progressSlider, colorFinal.ripAlpha(), true)
|
||||
|
@ -152,7 +157,10 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
override fun updateShuffleState() {
|
||||
when (MusicPlayerRemote.shuffleMode) {
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
MusicService.SHUFFLE_MODE_SHUFFLE -> shuffleButton.setColorFilter(
|
||||
lastPlaybackControlsColor,
|
||||
PorterDuff.Mode.SRC_IN
|
||||
)
|
||||
else -> shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
@ -180,11 +188,11 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
|
||||
public override fun show() {
|
||||
playPauseButton!!.animate()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.rotation(360f)
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.start()
|
||||
}
|
||||
|
||||
public override fun hide() {
|
||||
|
@ -202,8 +210,10 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
MusicPlayerRemote.seekTo(progress)
|
||||
onUpdateProgressViews(MusicPlayerRemote.songProgressMillis,
|
||||
MusicPlayerRemote.songDurationMillis)
|
||||
onUpdateProgressViews(
|
||||
MusicPlayerRemote.songProgressMillis,
|
||||
MusicPlayerRemote.songDurationMillis
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -219,16 +229,16 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
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()
|
||||
.setInterpolator(DecelerateInterpolator())
|
||||
.scaleX(1.1f)
|
||||
.scaleY(1.1f)
|
||||
.withEndAction {
|
||||
animate().setDuration(200)
|
||||
.setInterpolator(AccelerateInterpolator())
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.alpha(1f).start()
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,5 +261,4 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
|
||||
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue