[Now playing] Applied fading edges to LrcView
This commit is contained in:
parent
1c50903f5c
commit
f660c6147a
4 changed files with 43 additions and 21 deletions
|
@ -151,6 +151,8 @@ dependencies {
|
|||
|
||||
implementation 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:1.0.0'
|
||||
|
||||
implementation 'com.github.bosphere.android-fadingedgelayout:fadingedgelayout:1.0.0'
|
||||
|
||||
implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
|
||||
implementation 'com.github.Adonai:jaudiotagger:2.3.15'
|
||||
implementation 'com.anjlab.android.iab.v3:library:2.0.3'
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
title="Material Intro">Material Intro</a></b> by Jan Heinrich Reimer</p>
|
||||
<p><b><a href="https://github.com/r0adkll/Slidr"
|
||||
title="Slidr">Slidr</a></b> by Drew Heavner</p>
|
||||
<p><b><a href="https://github.com/bosphere/Android-FadingEdgeLayout"
|
||||
title="FadingEdgeLayout">FadingEdgeLayout</a></b> by bosphere</p>
|
||||
<p><b><a href="https://materialdesignicons.com" title="Icons"> Icons</a></b> by Austin Andrews</p>
|
||||
<p><b><a href="https://www.techjuice.pk" title="City wallpaper"> Material Design City Wallpaper</a></b>
|
||||
</p>
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
|||
import android.view.View
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
|
@ -43,6 +44,9 @@ import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
|
|||
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 kotlinx.coroutines.withContext
|
||||
|
||||
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_player_album_cover),
|
||||
ViewPager.OnPageChangeListener, MusicProgressViewUpdateHelper.Callback,
|
||||
|
@ -75,17 +79,24 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
|||
private fun updateLyrics() {
|
||||
binding.lyricsView.setLabel(context?.getString(R.string.no_lyrics_found))
|
||||
val song = MusicPlayerRemote.currentSong
|
||||
val lrcFile = LyricUtil.getSyncedLyricsFile(song)
|
||||
if (lrcFile != null) {
|
||||
binding.lyricsView.loadLrc(lrcFile)
|
||||
} else {
|
||||
val embeddedLyrics = LyricUtil.getEmbeddedSyncedLyrics(song.data)
|
||||
if (embeddedLyrics != null) {
|
||||
binding.lyricsView.loadLrc(embeddedLyrics)
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val lrcFile = LyricUtil.getSyncedLyricsFile(song)
|
||||
if (lrcFile != null) {
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.lyricsView.loadLrc(lrcFile)
|
||||
}
|
||||
} else {
|
||||
binding.lyricsView.reset()
|
||||
val embeddedLyrics = LyricUtil.getEmbeddedSyncedLyrics(song.data)
|
||||
withContext(Dispatchers.Main) {
|
||||
if (embeddedLyrics != null) {
|
||||
binding.lyricsView.loadLrc(embeddedLyrics)
|
||||
} else {
|
||||
binding.lyricsView.reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||
|
@ -272,7 +283,6 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
|||
|
||||
companion object {
|
||||
val TAG: String = PlayerAlbumCoverFragment::class.java.simpleName
|
||||
|
||||
}
|
||||
|
||||
private val lyricViewNpsList =
|
||||
|
|
|
@ -13,19 +13,27 @@
|
|||
|
||||
</androidx.viewpager.widget.ViewPager>
|
||||
|
||||
<code.name.monkey.retromusic.lyrics.CoverLrcView
|
||||
android:id="@+id/lyricsView"
|
||||
<com.bosphere.fadingedgelayout.FadingEdgeLayout
|
||||
android:id="@+id/fading_edge_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp"
|
||||
android:visibility="gone"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
||||
app:lrcLabel="@string/no_lyrics_found"
|
||||
app:lrcNormalTextSize="28sp"
|
||||
app:lrcPadding="24dp"
|
||||
app:lrcTextGravity="center"
|
||||
app:lrcTextSize="32sp"
|
||||
app:lrcTimelineColor="@color/transparent"
|
||||
tools:visibility="visible" />
|
||||
app:fel_edge="top|bottom"
|
||||
app:fel_size_bottom="80dp"
|
||||
app:fel_size_top="80dp">
|
||||
|
||||
<code.name.monkey.retromusic.lyrics.CoverLrcView
|
||||
android:id="@+id/lyricsView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp"
|
||||
android:visibility="gone"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
||||
app:lrcLabel="@string/no_lyrics_found"
|
||||
app:lrcNormalTextSize="28sp"
|
||||
app:lrcPadding="24dp"
|
||||
app:lrcTextGravity="center"
|
||||
app:lrcTextSize="32sp"
|
||||
app:lrcTimelineColor="@color/transparent"
|
||||
tools:visibility="visible" />
|
||||
</com.bosphere.fadingedgelayout.FadingEdgeLayout>
|
||||
</FrameLayout>
|
Loading…
Add table
Add a link
Reference in a new issue