Added option to show lyrics over Cover
This commit is contained in:
parent
3cd6714336
commit
956cce6989
7 changed files with 59 additions and 9 deletions
|
@ -154,3 +154,4 @@ const val LAST_USED_TAB = "last_used_tab"
|
||||||
const val WHITELIST_MUSIC = "whitelist_music"
|
const val WHITELIST_MUSIC = "whitelist_music"
|
||||||
const val MATERIAL_YOU = "material_you"
|
const val MATERIAL_YOU = "material_you"
|
||||||
const val SNOWFALL = "snowfall"
|
const val SNOWFALL = "snowfall"
|
||||||
|
const val LYRICS_TYPE = "lyrics_type"
|
||||||
|
|
|
@ -26,6 +26,7 @@ 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
|
||||||
|
import code.name.monkey.retromusic.LYRICS_TYPE
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.SHOW_LYRICS
|
import code.name.monkey.retromusic.SHOW_LYRICS
|
||||||
import code.name.monkey.retromusic.adapter.album.AlbumCoverPagerAdapter
|
import code.name.monkey.retromusic.adapter.album.AlbumCoverPagerAdapter
|
||||||
|
@ -43,6 +44,7 @@ import code.name.monkey.retromusic.model.lyrics.Lyrics
|
||||||
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
|
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
|
||||||
import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
|
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.LyricsType
|
||||||
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.Dispatchers
|
||||||
|
@ -201,6 +203,8 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
showLyrics(false)
|
showLyrics(false)
|
||||||
progressViewUpdateHelper?.stop()
|
progressViewUpdateHelper?.stop()
|
||||||
}
|
}
|
||||||
|
} else if (key == LYRICS_TYPE) {
|
||||||
|
maybeInitLyrics()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,13 +227,21 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showLyrics(visible: Boolean) {
|
private fun showLyrics(visible: Boolean) {
|
||||||
ObjectAnimator.ofFloat(lrcView, View.ALPHA, if (visible) 1F else 0F).apply {
|
binding.coverLyrics.isVisible = false
|
||||||
|
binding.lyricsView.isVisible = false
|
||||||
|
binding.viewPager.isVisible = true
|
||||||
|
val lyrics: View = if (PreferenceUtil.lyricsType == LyricsType.REPLACE_LYRICS) {
|
||||||
|
ObjectAnimator.ofFloat(viewPager, View.ALPHA, if (visible) 0F else 1F).start()
|
||||||
|
lrcView
|
||||||
|
} else {
|
||||||
|
binding.coverLyrics
|
||||||
|
}
|
||||||
|
ObjectAnimator.ofFloat(lyrics, View.ALPHA, if (visible) 1F else 0F).apply {
|
||||||
doOnEnd {
|
doOnEnd {
|
||||||
_binding?.lyricsView?.isVisible = visible
|
lyrics.isVisible = visible
|
||||||
}
|
}
|
||||||
start()
|
start()
|
||||||
}
|
}
|
||||||
ObjectAnimator.ofFloat(viewPager, View.ALPHA, if (visible) 0F else 1F).start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun maybeInitLyrics() {
|
private fun maybeInitLyrics() {
|
||||||
|
@ -237,7 +249,9 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
||||||
// Don't show lyrics container for below conditions
|
// Don't show lyrics container for below conditions
|
||||||
if (lyricViewNpsList.contains(nps) && PreferenceUtil.showLyrics) {
|
if (lyricViewNpsList.contains(nps) && PreferenceUtil.showLyrics) {
|
||||||
showLyrics(true)
|
showLyrics(true)
|
||||||
progressViewUpdateHelper?.start()
|
if (PreferenceUtil.lyricsType == LyricsType.REPLACE_LYRICS) {
|
||||||
|
progressViewUpdateHelper?.start()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showLyrics(false)
|
showLyrics(false)
|
||||||
progressViewUpdateHelper?.stop()
|
progressViewUpdateHelper?.stop()
|
||||||
|
|
|
@ -667,4 +667,14 @@ object PreferenceUtil {
|
||||||
|
|
||||||
val isSnowFalling
|
val isSnowFalling
|
||||||
get() = sharedPreferences.getBoolean(SNOWFALL, false)
|
get() = sharedPreferences.getBoolean(SNOWFALL, false)
|
||||||
|
|
||||||
|
val lyricsType: LyricsType
|
||||||
|
get() = if (sharedPreferences.getString(LYRICS_TYPE, "0") == "0") {
|
||||||
|
LyricsType.REPLACE_LYRICS
|
||||||
|
} else {
|
||||||
|
LyricsType.OVER_LYRICS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
enum class LyricsType {
|
||||||
|
REPLACE_LYRICS, OVER_LYRICS
|
||||||
|
}
|
|
@ -13,6 +13,13 @@
|
||||||
|
|
||||||
</androidx.viewpager.widget.ViewPager>
|
</androidx.viewpager.widget.ViewPager>
|
||||||
|
|
||||||
|
<androidx.fragment.app.FragmentContainerView
|
||||||
|
android:id="@+id/cover_lyrics"
|
||||||
|
android:name="code.name.monkey.retromusic.fragments.other.CoverLyricsFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
<com.bosphere.fadingedgelayout.FadingEdgeLayout
|
<com.bosphere.fadingedgelayout.FadingEdgeLayout
|
||||||
android:id="@+id/fading_edge_layout"
|
android:id="@+id/fading_edge_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<array name="pref_album_cover_transform_entities">
|
<array name="pref_album_cover_transform_entries">
|
||||||
<item>@string/normal</item>
|
<item>@string/normal</item>
|
||||||
<item>@string/cascading</item>
|
<item>@string/cascading</item>
|
||||||
<item>@string/depth</item>
|
<item>@string/depth</item>
|
||||||
|
@ -20,6 +20,16 @@
|
||||||
<item>6</item>
|
<item>6</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="pref_lyrics_type_values">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<array name="pref_lyrics_type_entries">
|
||||||
|
<item>@string/replace_cover</item>
|
||||||
|
<item>@string/over_cover</item>
|
||||||
|
</array>
|
||||||
|
|
||||||
<string-array name="pref_tab_text_mode_values">
|
<string-array name="pref_tab_text_mode_values">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<resources>
|
<resources>
|
||||||
<string name="about_album_label">About %s</string>
|
<string name="about_album_label">About %s</string>
|
||||||
<string name="about_settings_summary">Team, social links</string>
|
<string name="about_settings_summary">Team, social links</string>
|
||||||
|
@ -275,6 +274,7 @@
|
||||||
<string name="only_on_wifi">Only on Wi-Fi</string>
|
<string name="only_on_wifi">Only on Wi-Fi</string>
|
||||||
<string name="other_settings_summary">Advanced testing features</string>
|
<string name="other_settings_summary">Advanced testing features</string>
|
||||||
<string name="others">Other</string>
|
<string name="others">Other</string>
|
||||||
|
<string name="over_cover">Over Cover</string>
|
||||||
<string name="password">Password</string>
|
<string name="password">Password</string>
|
||||||
<string name="past_three_months">Past 3 months</string>
|
<string name="past_three_months">Past 3 months</string>
|
||||||
<string name="paste_lyrics_here">Paste Lyrics Here</string>
|
<string name="paste_lyrics_here">Paste Lyrics Here</string>
|
||||||
|
@ -372,6 +372,7 @@
|
||||||
<string name="pref_title_ignore_media_store_artwork">Ignore Media Store covers</string>
|
<string name="pref_title_ignore_media_store_artwork">Ignore Media Store covers</string>
|
||||||
<string name="pref_title_last_added_interval">Last added playlist interval</string>
|
<string name="pref_title_last_added_interval">Last added playlist interval</string>
|
||||||
<string name="pref_title_lock_screen">Fullscreen controls</string>
|
<string name="pref_title_lock_screen">Fullscreen controls</string>
|
||||||
|
<string name="pref_title_lyrics_type">Lyrics type</string>
|
||||||
<string name="pref_title_now_playing_screen_appearance">Now playing theme</string>
|
<string name="pref_title_now_playing_screen_appearance">Now playing theme</string>
|
||||||
<string name="pref_title_open_source_licences">Open source licences</string>
|
<string name="pref_title_open_source_licences">Open source licences</string>
|
||||||
<string name="pref_title_remember_tab">Remember Last Tab</string>
|
<string name="pref_title_remember_tab">Remember Last Tab</string>
|
||||||
|
@ -405,6 +406,7 @@
|
||||||
<![CDATA[Remove <b>%1$d</b> songs from the playlist?]]>
|
<![CDATA[Remove <b>%1$d</b> songs from the playlist?]]>
|
||||||
</string>
|
</string>
|
||||||
<string name="rename_playlist_title">Rename playlist</string>
|
<string name="rename_playlist_title">Rename playlist</string>
|
||||||
|
<string name="replace_cover">Replace Cover</string>
|
||||||
<string name="report_an_issue">Report an issue</string>
|
<string name="report_an_issue">Report an issue</string>
|
||||||
<string name="report_bug">Report bug</string>
|
<string name="report_bug">Report bug</string>
|
||||||
<string name="reset_action">Reset</string>
|
<string name="reset_action">Reset</string>
|
||||||
|
|
|
@ -21,6 +21,14 @@
|
||||||
android:layout="@layout/list_item_view_switch_no_title"
|
android:layout="@layout/list_item_view_switch_no_title"
|
||||||
android:title="Snow Fall Effect (Only on Normal theme)" />
|
android:title="Snow Fall Effect (Only on Normal theme)" />
|
||||||
|
|
||||||
|
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
||||||
|
android:defaultValue="0"
|
||||||
|
android:entries="@array/pref_lyrics_type_entries"
|
||||||
|
android:entryValues="@array/pref_lyrics_type_values"
|
||||||
|
android:key="lyrics_type"
|
||||||
|
android:layout="@layout/list_item_view"
|
||||||
|
android:title="@string/pref_title_lyrics_type" />
|
||||||
|
|
||||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
|
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
|
||||||
android:layout="@layout/preference_category_title"
|
android:layout="@layout/preference_category_title"
|
||||||
android:title="@string/pref_header_album">
|
android:title="@string/pref_header_album">
|
||||||
|
@ -33,7 +41,7 @@
|
||||||
|
|
||||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
android:entries="@array/pref_album_cover_transform_entities"
|
android:entries="@array/pref_album_cover_transform_entries"
|
||||||
android:entryValues="@array/pref_album_cover_transform_values"
|
android:entryValues="@array/pref_album_cover_transform_values"
|
||||||
android:key="album_cover_transform"
|
android:key="album_cover_transform"
|
||||||
android:layout="@layout/list_item_view"
|
android:layout="@layout/list_item_view"
|
||||||
|
@ -87,6 +95,4 @@
|
||||||
app:icon="@drawable/ic_blur_on"
|
app:icon="@drawable/ic_blur_on"
|
||||||
app:showSeekBarValue="true" />
|
app:showSeekBarValue="true" />
|
||||||
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||||
|
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
Loading…
Add table
Add a link
Reference in a new issue