@@ -26,12 +26,12 @@ import androidx.compose.foundation.layout.padding
2626import androidx.compose.foundation.layout.size
2727import androidx.compose.foundation.lazy.LazyColumn
2828import androidx.compose.foundation.lazy.itemsIndexed
29+ import androidx.compose.foundation.shape.RoundedCornerShape
2930import androidx.compose.material3.Button
3031import androidx.compose.material3.Card
3132import androidx.compose.material3.CardDefaults
3233import androidx.compose.material3.CircularProgressIndicator
3334import androidx.compose.material3.ExperimentalMaterial3Api
34- import androidx.compose.material3.HorizontalDivider
3535import androidx.compose.material3.Icon
3636import androidx.compose.material3.MaterialTheme
3737import androidx.compose.material3.OutlinedTextField
@@ -43,15 +43,21 @@ import androidx.compose.runtime.remember
4343import androidx.compose.runtime.setValue
4444import androidx.compose.ui.Alignment
4545import androidx.compose.ui.Modifier
46+ import androidx.compose.ui.draw.clip
4647import androidx.compose.ui.graphics.StrokeCap
4748import androidx.compose.ui.res.painterResource
4849import androidx.compose.ui.res.stringResource
4950import androidx.compose.ui.text.font.FontWeight
5051import androidx.compose.ui.text.style.TextOverflow
52+ import androidx.compose.ui.tooling.preview.Preview
5153import androidx.compose.ui.unit.dp
5254import com.shub39.rush.R
55+ import com.shub39.rush.domain.dataclasses.Theme
56+ import com.shub39.rush.domain.enums.AppTheme
5357import com.shub39.rush.domain.interfaces.CorrectionSearchResult
5458import com.shub39.rush.presentation.components.RushDialog
59+ import com.shub39.rush.presentation.components.RushTheme
60+ import com.shub39.rush.presentation.lyrics.LrcCorrect
5561import com.shub39.rush.presentation.lyrics.LyricsPageAction
5662import com.shub39.rush.presentation.lyrics.LyricsPageState
5763import com.shub39.rush.presentation.lyrics.LyricsState
@@ -74,7 +80,6 @@ fun LrcCorrectDialog(
7480 ) {
7581 Column (
7682 modifier = Modifier .fillMaxWidth().padding(top = 32 .dp),
77- horizontalAlignment = Alignment .CenterHorizontally ,
7883 verticalArrangement = Arrangement .spacedBy(8 .dp),
7984 ) {
8085 Text (
@@ -127,75 +132,121 @@ fun LrcCorrectDialog(
127132 }
128133 }
129134
130- Column {
131- HorizontalDivider ()
132- LazyColumn (
133- verticalArrangement = Arrangement .spacedBy(4 .dp),
134- contentPadding = PaddingValues (16 .dp),
135- ) {
136- itemsIndexed(state.lrcCorrect.searchResults) { _, result ->
137- Card (
138- onClick = {
139- (state.lyricsState as ? LyricsState .Loaded )?.song?.id?.let {
140- action(LyricsPageAction .OnUpdateSongLyrics (it, result))
141- }
142- action(LyricsPageAction .OnLyricsCorrect (false ))
143- },
144- colors = CardDefaults .elevatedCardColors(),
145- shape = MaterialTheme .shapes.extraLarge,
146- ) {
147- Column (modifier = Modifier .fillMaxWidth().padding(16 .dp)) {
148- Row (
149- verticalAlignment = Alignment .CenterVertically ,
150- horizontalArrangement = Arrangement .spacedBy(4 .dp),
151- ) {
152- Icon (
153- painter =
154- painterResource(
155- if (
156- result
157- is
158- CorrectionSearchResult .PlainLyricsSearchResult
159- ) {
160- R .drawable.quote
161- } else R .drawable.sync
162- ),
163- modifier = Modifier .size(20 .dp),
164- contentDescription = null ,
165- )
166-
167- Text (
168- text =
169- stringResource(
170- when (result) {
171- is CorrectionSearchResult .LineSyncedLyricsSearchResult ->
172- R .string.line_synced_lyrics
173- is CorrectionSearchResult .PlainLyricsSearchResult ->
174- R .string.plain_lyrics
175- is CorrectionSearchResult .SyllableSyncedLyricsSearchResult ->
176- R .string.syllable_synced_lyrics
177- }
178- ),
179- style = MaterialTheme .typography.labelLarge,
180- )
181- }
182-
183- Text (
184- text = result.title,
185- maxLines = 1 ,
186- overflow = TextOverflow .Ellipsis ,
135+ LazyColumn (
136+ verticalArrangement = Arrangement .spacedBy(2 .dp),
137+ contentPadding = PaddingValues (top = 16 .dp, bottom = 60 .dp),
138+ modifier =
139+ Modifier .padding(horizontal = 16 .dp)
140+ .clip(RoundedCornerShape (topStart = 16 .dp, topEnd = 16 .dp)),
141+ ) {
142+ itemsIndexed(state.lrcCorrect.searchResults) { _, result ->
143+ Card (
144+ onClick = {
145+ (state.lyricsState as ? LyricsState .Loaded )?.song?.id?.let {
146+ action(LyricsPageAction .OnUpdateSongLyrics (it, result))
147+ }
148+ action(LyricsPageAction .OnLyricsCorrect (false ))
149+ },
150+ colors =
151+ CardDefaults .cardColors(
152+ containerColor = MaterialTheme .colorScheme.surfaceContainerHigh
153+ ),
154+ shape = MaterialTheme .shapes.large,
155+ ) {
156+ Column (modifier = Modifier .fillMaxWidth().padding(16 .dp)) {
157+ Row (
158+ verticalAlignment = Alignment .CenterVertically ,
159+ horizontalArrangement = Arrangement .spacedBy(4 .dp),
160+ ) {
161+ Icon (
162+ painter =
163+ painterResource(
164+ if (
165+ result
166+ is
167+ CorrectionSearchResult .PlainLyricsSearchResult
168+ ) {
169+ R .drawable.quote
170+ } else R .drawable.sync
171+ ),
172+ modifier = Modifier .size(14 .dp),
173+ contentDescription = null ,
187174 )
175+
188176 Text (
189- text = result.artist,
190- style = MaterialTheme .typography.bodySmall,
191- maxLines = 1 ,
192- overflow = TextOverflow .Ellipsis ,
177+ text =
178+ stringResource(
179+ when (result) {
180+ is CorrectionSearchResult .LineSyncedLyricsSearchResult ->
181+ R .string.line_synced_lyrics
182+
183+ is CorrectionSearchResult .PlainLyricsSearchResult ->
184+ R .string.plain_lyrics
185+
186+ is CorrectionSearchResult .SyllableSyncedLyricsSearchResult ->
187+ R .string.syllable_synced_lyrics
188+ }
189+ ),
190+ style = MaterialTheme .typography.labelSmall,
193191 )
194192 }
193+
194+ Text (
195+ text = result.title,
196+ maxLines = 1 ,
197+ overflow = TextOverflow .Ellipsis ,
198+ )
199+ Text (
200+ text = result.artist,
201+ style = MaterialTheme .typography.bodySmall,
202+ maxLines = 1 ,
203+ overflow = TextOverflow .Ellipsis ,
204+ )
195205 }
196206 }
197207 }
198208 }
199209 }
200210 }
201211}
212+
213+ @Preview
214+ @Composable
215+ private fun Preview () {
216+ RushTheme (theme = Theme (appTheme = AppTheme .DARK )) {
217+ LrcCorrectDialog (
218+ track = " Track Name" ,
219+ artist = " Artist Name" ,
220+ action = {},
221+ state =
222+ LyricsPageState (
223+ lrcCorrect =
224+ LrcCorrect (
225+ searchResults =
226+ (0 .. 3 ).map {
227+ CorrectionSearchResult .PlainLyricsSearchResult (
228+ plainLyrics = " TODO()" ,
229+ title = " Song One" ,
230+ artist = " GABsdjhgva" ,
231+ )
232+ } +
233+ (0 .. 3 ).map {
234+ CorrectionSearchResult .LineSyncedLyricsSearchResult (
235+ lineSyncedLyrics = " TODO" ,
236+ plainLyrics = " TODO" ,
237+ title = " Synced Song" ,
238+ artist = " Sync Joe" ,
239+ )
240+ } +
241+ (0 .. 3 ).map {
242+ CorrectionSearchResult .SyllableSyncedLyricsSearchResult (
243+ syllableSyncedLyrics = " TODO()" ,
244+ title = " Syllable Search" ,
245+ artist = " ligma" ,
246+ )
247+ }
248+ )
249+ ),
250+ )
251+ }
252+ }
0 commit comments