[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.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 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
|
||||||
implementation 'com.github.Adonai:jaudiotagger:2.3.15'
|
implementation 'com.github.Adonai:jaudiotagger:2.3.15'
|
||||||
implementation 'com.anjlab.android.iab.v3:library:2.0.3'
|
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>
|
title="Material Intro">Material Intro</a></b> by Jan Heinrich Reimer</p>
|
||||||
<p><b><a href="https://github.com/r0adkll/Slidr"
|
<p><b><a href="https://github.com/r0adkll/Slidr"
|
||||||
title="Slidr">Slidr</a></b> by Drew Heavner</p>
|
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://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><b><a href="https://www.techjuice.pk" title="City wallpaper"> Material Design City Wallpaper</a></b>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.view.isInvisible
|
import androidx.core.view.isInvisible
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.viewpager.widget.ViewPager
|
import androidx.viewpager.widget.ViewPager
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
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.LyricUtil
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
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),
|
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_player_album_cover),
|
||||||
ViewPager.OnPageChangeListener, MusicProgressViewUpdateHelper.Callback,
|
ViewPager.OnPageChangeListener, MusicProgressViewUpdateHelper.Callback,
|
||||||
|
@ -75,17 +79,24 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
private fun updateLyrics() {
|
private fun updateLyrics() {
|
||||||
binding.lyricsView.setLabel(context?.getString(R.string.no_lyrics_found))
|
binding.lyricsView.setLabel(context?.getString(R.string.no_lyrics_found))
|
||||||
val song = MusicPlayerRemote.currentSong
|
val song = MusicPlayerRemote.currentSong
|
||||||
val lrcFile = LyricUtil.getSyncedLyricsFile(song)
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
if (lrcFile != null) {
|
val lrcFile = LyricUtil.getSyncedLyricsFile(song)
|
||||||
binding.lyricsView.loadLrc(lrcFile)
|
if (lrcFile != null) {
|
||||||
} else {
|
withContext(Dispatchers.Main) {
|
||||||
val embeddedLyrics = LyricUtil.getEmbeddedSyncedLyrics(song.data)
|
binding.lyricsView.loadLrc(lrcFile)
|
||||||
if (embeddedLyrics != null) {
|
}
|
||||||
binding.lyricsView.loadLrc(embeddedLyrics)
|
|
||||||
} else {
|
} 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) {
|
override fun onUpdateProgressViews(progress: Int, total: Int) {
|
||||||
|
@ -272,7 +283,6 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val TAG: String = PlayerAlbumCoverFragment::class.java.simpleName
|
val TAG: String = PlayerAlbumCoverFragment::class.java.simpleName
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val lyricViewNpsList =
|
private val lyricViewNpsList =
|
||||||
|
|
|
@ -13,19 +13,27 @@
|
||||||
|
|
||||||
</androidx.viewpager.widget.ViewPager>
|
</androidx.viewpager.widget.ViewPager>
|
||||||
|
|
||||||
<code.name.monkey.retromusic.lyrics.CoverLrcView
|
<com.bosphere.fadingedgelayout.FadingEdgeLayout
|
||||||
android:id="@+id/lyricsView"
|
android:id="@+id/fading_edge_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="16dp"
|
app:fel_edge="top|bottom"
|
||||||
android:visibility="gone"
|
app:fel_size_bottom="80dp"
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
app:fel_size_top="80dp">
|
||||||
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" />
|
|
||||||
|
|
||||||
|
<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>
|
</FrameLayout>
|
Loading…
Add table
Add a link
Reference in a new issue