Colored lyrics text for Full and Gradient themes
This commit is contained in:
parent
0c6917c775
commit
c3309175a6
9 changed files with 37 additions and 105 deletions
|
@ -11,6 +11,7 @@ import androidx.preference.PreferenceManager
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.SHOW_LYRICS
|
||||
import code.name.monkey.retromusic.databinding.FragmentCoverLyricsBinding
|
||||
import code.name.monkey.retromusic.extensions.dipToPix
|
||||
import code.name.monkey.retromusic.fragments.NowPlayingScreen
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
|
||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||
|
@ -21,6 +22,7 @@ import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
|
|||
import code.name.monkey.retromusic.model.lyrics.Lyrics
|
||||
import code.name.monkey.retromusic.util.LyricUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jaudiotagger.audio.exceptions.CannotReadException
|
||||
|
@ -56,6 +58,17 @@ class CoverLyricsFragment : AbsMusicServiceFragment(R.layout.fragment_cover_lyri
|
|||
}
|
||||
}
|
||||
|
||||
fun setColors(color: MediaNotificationProcessor) {
|
||||
binding.run {
|
||||
playerLyrics.background = null
|
||||
playerLyricsLine1.setTextColor(color.primaryTextColor)
|
||||
playerLyricsLine1.setShadowLayer(dipToPix(10f), 0f, 0f, color.backgroundColor)
|
||||
playerLyricsLine2.setTextColor(color.primaryTextColor)
|
||||
playerLyricsLine2.setShadowLayer(dipToPix(10f), 0f, 0f, color.backgroundColor)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||
if (key == SHOW_LYRICS) {
|
||||
if (sharedPreferences?.getBoolean(key, false) == true) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import code.name.monkey.retromusic.extensions.show
|
|||
import code.name.monkey.retromusic.extensions.whichFragment
|
||||
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
||||
import code.name.monkey.retromusic.fragments.base.goToArtist
|
||||
import code.name.monkey.retromusic.fragments.player.CoverLyricsFragment
|
||||
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
|
||||
import code.name.monkey.retromusic.glide.GlideApp
|
||||
import code.name.monkey.retromusic.glide.RetroGlideExtension
|
||||
|
@ -98,6 +99,7 @@ class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full) {
|
|||
controlsFragment.setColor(color)
|
||||
libraryViewModel.updateColor(color.backgroundColor)
|
||||
ToolbarContentTintHelper.colorizeToolbar(binding.playerToolbar, Color.WHITE, activity)
|
||||
binding.coverLyrics.getFragment<CoverLyricsFragment>().setColors(color)
|
||||
}
|
||||
|
||||
override fun onFavoriteToggled() {
|
||||
|
|
|
@ -44,6 +44,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
|
|||
import code.name.monkey.retromusic.fragments.base.goToAlbum
|
||||
import code.name.monkey.retromusic.fragments.base.goToArtist
|
||||
import code.name.monkey.retromusic.fragments.other.VolumeFragment
|
||||
import code.name.monkey.retromusic.fragments.player.CoverLyricsFragment
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||
|
@ -270,6 +271,7 @@ class GradientPlayerFragment : AbsPlayerFragment(R.layout.fragment_gradient_play
|
|||
updateRepeatState()
|
||||
updateShuffleState()
|
||||
updatePrevNextColor()
|
||||
binding.coverLyrics.getFragment<CoverLyricsFragment>().setColors(color)
|
||||
}
|
||||
|
||||
override fun onFavoriteToggled() {
|
||||
|
@ -379,17 +381,22 @@ class GradientPlayerFragment : AbsPlayerFragment(R.layout.fragment_gradient_play
|
|||
|
||||
private fun setUpPlayPauseFab() {
|
||||
binding.playbackControlsFragment.playPauseButton.setOnClickListener(
|
||||
PlayPauseButtonOnClickHandler())
|
||||
PlayPauseButtonOnClickHandler()
|
||||
)
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun setUpPrevNext() {
|
||||
updatePrevNextColor()
|
||||
binding.playbackControlsFragment.nextButton.setOnTouchListener(MusicSeekSkipTouchListener(
|
||||
binding.playbackControlsFragment.nextButton.setOnTouchListener(
|
||||
MusicSeekSkipTouchListener(
|
||||
requireActivity(),
|
||||
true))
|
||||
true
|
||||
)
|
||||
)
|
||||
binding.playbackControlsFragment.previousButton.setOnTouchListener(
|
||||
MusicSeekSkipTouchListener(requireActivity(), false))
|
||||
MusicSeekSkipTouchListener(requireActivity(), false)
|
||||
)
|
||||
}
|
||||
|
||||
private fun updatePrevNextColor() {
|
||||
|
|
|
@ -323,7 +323,7 @@ class CoverLrcView @JvmOverloads constructor(
|
|||
if (!hasLrc()) {
|
||||
return@runOnUi
|
||||
}
|
||||
val line = findShowLine(time - 300L)
|
||||
val line = findShowLine(time + 300L)
|
||||
if (line != mCurrentLine) {
|
||||
mCurrentLine = line
|
||||
if (!isShowTimeline) {
|
||||
|
|
|
@ -22,7 +22,6 @@ import androidx.viewpager.widget.ViewPager
|
|||
*/
|
||||
|
||||
class ParallaxPagerTransformer(private val id: Int) : ViewPager.PageTransformer {
|
||||
private var border = 0
|
||||
private var speed = 0.2f
|
||||
|
||||
override fun transformPage(page: View, position: Float) {
|
||||
|
@ -32,22 +31,12 @@ class ParallaxPagerTransformer(private val id: Int) : ViewPager.PageTransformer
|
|||
if (position > -1 && position < 1) {
|
||||
val width = parallaxView.width.toFloat()
|
||||
parallaxView.translationX = -(position * width * speed)
|
||||
val sc = (width - border) / width
|
||||
if (position == 0f) {
|
||||
scaleX = 1f
|
||||
scaleY = 1f
|
||||
} else {
|
||||
scaleX = sc
|
||||
scaleY = sc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setBorder(px: Int) {
|
||||
border = px
|
||||
}
|
||||
|
||||
fun setSpeed(speed: Float) {
|
||||
this.speed = speed
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/colorBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@color/black_color" />
|
||||
|
||||
<View
|
||||
android:id="@+id/mask"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shadow_up_strong" />
|
||||
|
||||
<include layout="@layout/shadow_statusbar_toolbar" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/status_bar" />
|
||||
</FrameLayout>
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/playerToolbar"
|
||||
style="@style/Toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black"
|
||||
app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
app:titleMargin="0dp"
|
||||
app:titleMarginStart="0dp"
|
||||
app:titleTextAppearance="@style/TextAppearance.AppCompat.Subhead" />
|
||||
|
||||
<FrameLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="64dp"
|
||||
android:layout_marginEnd="64dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playerAlbumCoverFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/fragment_album_card_cover" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/playbackControlsFragment"
|
||||
android:name="code.name.monkey.retromusic.fragments.player.cardblur.CardBlurPlaybackControlsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="96dp"
|
||||
android:layout_marginEnd="96dp"
|
||||
tools:layout="@layout/fragment_card_blur_player_playback_controls" />
|
||||
|
||||
</FrameLayout>
|
|
@ -21,7 +21,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:shadowColor="@color/md_black_1000"
|
||||
android:shadowRadius="4"
|
||||
android:shadowRadius="10"
|
||||
android:textAppearance="@style/TextViewHeadline5"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
|
@ -34,7 +34,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:shadowColor="@color/md_black_1000"
|
||||
android:shadowRadius="4"
|
||||
android:shadowRadius="10"
|
||||
android:textAppearance="@style/TextViewHeadline5"
|
||||
android:textColor="@color/md_white_1000"
|
||||
tools:text="@tools:sample/full_names[5]" />
|
||||
|
|
|
@ -127,8 +127,9 @@
|
|||
android:name="code.name.monkey.retromusic.fragments.player.CoverLyricsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:elevation="20dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/playbackControlsFragment"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/playerToolbar" />
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
app:layout_constraintBottom_toBottomOf="@+id/playerAlbumCoverFragment"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status_bar" />
|
||||
android:layout_marginBottom="16dp"
|
||||
tools:layout="@layout/fragment_cover_lyrics" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue