Added link to lyrics from Color theme
This commit is contained in:
parent
ce918acb45
commit
648f3c115a
1 changed files with 135 additions and 136 deletions
|
@ -4,16 +4,23 @@ import android.animation.ValueAnimator
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.*
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.palette.graphics.Palette
|
import androidx.palette.graphics.Palette
|
||||||
import code.name.monkey.appthemehelper.util.*
|
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.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.*
|
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
|
||||||
|
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||||
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
|
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.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.animation.GlideAnimation
|
import com.bumptech.glide.request.animation.GlideAnimation
|
||||||
|
@ -23,7 +30,7 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
|
|
||||||
private var lastColor: Int = 0
|
private var lastColor: Int = 0
|
||||||
private var backgroundColor: Int = 0
|
private var backgroundColor: Int = 0
|
||||||
private var playbackControlsFragment: ColorPlaybackControlsFragment? = null
|
private lateinit var playbackControlsFragment: ColorPlaybackControlsFragment
|
||||||
private var valueAnimator: ValueAnimator? = null
|
private var valueAnimator: ValueAnimator? = null
|
||||||
|
|
||||||
override fun playerToolbar(): Toolbar {
|
override fun playerToolbar(): Toolbar {
|
||||||
|
@ -42,11 +49,11 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShow() {
|
override fun onShow() {
|
||||||
playbackControlsFragment!!.show()
|
playbackControlsFragment.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onHide() {
|
override fun onHide() {
|
||||||
playbackControlsFragment!!.hide()
|
playbackControlsFragment.hide()
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +91,13 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
setUpSubFragments()
|
setUpSubFragments()
|
||||||
setUpPlayerToolbar()
|
setUpPlayerToolbar()
|
||||||
|
playerImage.setOnClickListener {
|
||||||
|
NavigationUtil.goToLyrics(requireActivity())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpSubFragments() {
|
private fun setUpSubFragments() {
|
||||||
playbackControlsFragment = childFragmentManager.findFragmentById(
|
playbackControlsFragment = childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as ColorPlaybackControlsFragment
|
||||||
R.id.playbackControlsFragment
|
|
||||||
) as ColorPlaybackControlsFragment?
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpPlayerToolbar() {
|
private fun setUpPlayerToolbar() {
|
||||||
|
@ -98,11 +105,7 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
inflateMenu(R.menu.menu_player)
|
inflateMenu(R.menu.menu_player)
|
||||||
setNavigationOnClickListener { requireActivity().onBackPressed() }
|
setNavigationOnClickListener { requireActivity().onBackPressed() }
|
||||||
setOnMenuItemClickListener(this@ColorFragment)
|
setOnMenuItemClickListener(this@ColorFragment)
|
||||||
ToolbarContentTintHelper.colorizeToolbar(
|
ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), requireActivity())
|
||||||
this, ATHUtil.resolveColor(
|
|
||||||
context, R.attr.iconColor
|
|
||||||
), activity
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +133,6 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
) {
|
) {
|
||||||
super.onResourceReady(resource, glideAnimation)
|
super.onResourceReady(resource, glideAnimation)
|
||||||
resource?.let {
|
resource?.let {
|
||||||
val background = resource.palette.getColor()
|
|
||||||
|
|
||||||
val palette = resource.palette
|
val palette = resource.palette
|
||||||
val swatch = RetroColorUtil.getSwatch(palette)
|
val swatch = RetroColorUtil.getSwatch(palette)
|
||||||
|
|
||||||
|
@ -157,10 +158,8 @@ class ColorFragment : AbsPlayerFragment() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setColors(
|
private fun setColors(backgroundColor: Int, textColor: Int) {
|
||||||
backgroundColor: Int, textColor: Int
|
playbackControlsFragment.setDark(textColor, backgroundColor)
|
||||||
) {
|
|
||||||
playbackControlsFragment?.setDark(textColor, backgroundColor)
|
|
||||||
colorGradientBackground?.setBackgroundColor(backgroundColor)
|
colorGradientBackground?.setBackgroundColor(backgroundColor)
|
||||||
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColor, activity)
|
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColor, activity)
|
||||||
lastColor = textColor
|
lastColor = textColor
|
||||||
|
|
Loading…
Reference in a new issue