Added lyrics shadow for better visibility of text

This commit is contained in:
Prathamesh More 2022-01-08 00:40:51 +05:30
parent 80f3926210
commit 5772fcd812
11 changed files with 34 additions and 22 deletions

View file

@ -21,7 +21,7 @@ class BackupViewModel : ViewModel() {
val backupsLiveData: LiveData<List<File>> = backupsMutableLiveData
fun loadBackups(context: Context) {
BackupHelper.getBackupRoot(context).listFiles { _, name ->
BackupHelper.getBackupRoot().listFiles { _, name ->
return@listFiles name.endsWith(BackupHelper.BACKUP_EXTENSION)
}?.toList()?.let {
backupsMutableLiveData.value = it

View file

@ -12,8 +12,10 @@ 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.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.base.goToLyrics
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
@ -45,6 +47,14 @@ class CoverLyricsFragment : AbsMusicServiceFragment(R.layout.fragment_cover_lyri
if (PreferenceUtil.showLyrics) {
progressViewUpdateHelper?.start()
}
// Remove background on Fit theme
val nps = PreferenceUtil.nowPlayingScreen
if (nps == NowPlayingScreen.Fit || nps == NowPlayingScreen.Full) {
binding.root.background = null
}
binding.playerLyricsLine2.setOnClickListener {
goToLyrics(requireActivity())
}
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {

View file

@ -28,7 +28,7 @@ object BackupHelper : KoinComponent {
suspend fun createBackup(context: Context, name: String) {
val backupFile =
File(getBackupRoot(context), name + APPEND_EXTENSION)
File(getBackupRoot(), name + APPEND_EXTENSION)
if (backupFile.parentFile?.exists() != true) {
backupFile.parentFile?.mkdirs()
}
@ -257,9 +257,9 @@ object BackupHelper : KoinComponent {
}
}
fun getBackupRoot(context: Context): File {
fun getBackupRoot(): File {
return File(
context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS),
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS),
"RetroMusic/Backups"
)
}

View file

@ -62,9 +62,9 @@
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:elevation="20dp"
android:layout_gravity="center"/>
android:layout_height="match_parent"
android:layout_gravity="center"
android:elevation="20dp" />
</FrameLayout>
<FrameLayout

View file

@ -78,9 +78,9 @@
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:elevation="20dp"
android:layout_gravity="center"/>
android:layout_height="match_parent"
android:layout_gravity="center"
tools:layout="@layout/fragment_cover_lyrics" />
</FrameLayout>
</LinearLayout>

View file

@ -23,7 +23,7 @@
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_height="match_parent"
android:layout_gravity="center"
android:elevation="20dp" />
<include layout="@layout/shadow_statusbar_toolbar" />

View file

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/playerLyrics"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0"
android:background="@drawable/lyrics_mask"
android:clipToPadding="false"
android:elevation="20dp"
android:padding="16dp"
android:visibility="gone"
tools:visibility="visible"
android:layout_gravity="center">
tools:alpha="1"
tools:visibility="visible">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_lyrics_line1"
@ -23,7 +24,8 @@
android:shadowRadius="4"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="@color/md_white_1000"
android:visibility="gone" />
android:visibility="gone"
tools:visibility="visible" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_lyrics_line2"
@ -34,5 +36,6 @@
android:shadowColor="@color/md_black_1000"
android:shadowRadius="4"
android:textAppearance="@style/TextViewHeadline5"
android:textColor="@color/md_white_1000" />
android:textColor="@color/md_white_1000"
tools:text="@tools:sample/full_names[5]" />
</FrameLayout>

View file

@ -7,7 +7,6 @@
android:clickable="true"
android:focusable="true">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/playerAlbumCoverFragment"
android:name="code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment"

View file

@ -31,7 +31,7 @@
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:ellipsize="marquee"
@ -47,7 +47,7 @@
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.75"
android:clickable="true"

View file

@ -64,7 +64,7 @@
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_height="0dp"
android:elevation="20dp"
app:layout_constraintBottom_toBottomOf="@+id/playerAlbumCoverFragment"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -17,7 +17,7 @@
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_height="match_parent"
android:layout_gravity="center_vertical" />
<com.bosphere.fadingedgelayout.FadingEdgeLayout