Browse Source

Move LyricsShimmer

vfsfitvnm 3 years ago
parent
commit
4a709d0baf

+ 13 - 2
app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/views/LyricsView.kt

@@ -9,6 +9,7 @@ import androidx.compose.foundation.verticalScroll
 import androidx.compose.runtime.*
 import androidx.compose.runtime.*
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.alpha
 import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
 import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
 import androidx.compose.ui.input.nestedscroll.nestedScroll
 import androidx.compose.ui.input.nestedscroll.nestedScroll
 import androidx.compose.ui.text.style.TextDecoration
 import androidx.compose.ui.text.style.TextDecoration
@@ -18,6 +19,7 @@ import it.vfsfitvnm.vimusic.R
 import it.vfsfitvnm.vimusic.ui.components.Message
 import it.vfsfitvnm.vimusic.ui.components.Message
 import it.vfsfitvnm.vimusic.ui.components.OutcomeItem
 import it.vfsfitvnm.vimusic.ui.components.OutcomeItem
 import it.vfsfitvnm.vimusic.ui.components.themed.TextFieldDialog
 import it.vfsfitvnm.vimusic.ui.components.themed.TextFieldDialog
+import it.vfsfitvnm.vimusic.ui.components.themed.TextPlaceholder
 import it.vfsfitvnm.vimusic.ui.styling.LocalTypography
 import it.vfsfitvnm.vimusic.ui.styling.LocalTypography
 import it.vfsfitvnm.vimusic.utils.center
 import it.vfsfitvnm.vimusic.utils.center
 import it.vfsfitvnm.vimusic.utils.secondary
 import it.vfsfitvnm.vimusic.utils.secondary
@@ -55,11 +57,20 @@ fun LyricsView(
         outcome = lyricsOutcome,
         outcome = lyricsOutcome,
         onInitialize = onInitialize,
         onInitialize = onInitialize,
         onLoading = {
         onLoading = {
-            LyricsShimmer(
+            Column(
+                verticalArrangement = Arrangement.Center,
+                horizontalAlignment = Alignment.CenterHorizontally,
                 modifier = Modifier
                 modifier = Modifier
                     .fillMaxSize()
                     .fillMaxSize()
                     .shimmer()
                     .shimmer()
-            )
+            ) {
+                repeat(16) { index ->
+                    TextPlaceholder(
+                        modifier = Modifier
+                            .alpha(1f - index * 0.05f)
+                    )
+                }
+            }
         }
         }
     ) { lyrics ->
     ) { lyrics ->
         Column(
         Column(

+ 0 - 18
app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/views/PlayerBottomSheet.kt

@@ -237,21 +237,3 @@ fun PlayerBottomSheet(
         }
         }
     }
     }
 }
 }
-
-@Composable
-fun LyricsShimmer(
-    modifier: Modifier = Modifier
-) {
-    Column(
-        verticalArrangement = Arrangement.Center,
-        horizontalAlignment = Alignment.CenterHorizontally,
-        modifier = modifier
-    ) {
-        repeat(16) { index ->
-            TextPlaceholder(
-                modifier = Modifier
-                    .alpha(1f - index * 0.05f)
-            )
-        }
-    }
-}