@@ -17,6 +17,7 @@ import androidx.compose.material.Icon
1717import androidx.compose.material.IconButton
1818import androidx.compose.material.MaterialTheme
1919import androidx.compose.material.Slider
20+ import androidx.compose.material.Surface
2021import androidx.compose.material.Text
2122import androidx.compose.material.icons.Icons
2223import androidx.compose.material.icons.filled.Favorite
@@ -43,6 +44,7 @@ import androidx.compose.ui.Modifier
4344import androidx.compose.ui.platform.LocalConfiguration
4445import androidx.compose.ui.res.stringResource
4546import androidx.compose.ui.text.style.TextOverflow
47+ import androidx.compose.ui.tooling.preview.Devices
4648import androidx.compose.ui.tooling.preview.Preview
4749import androidx.compose.ui.unit.Dp
4850import androidx.compose.ui.unit.dp
@@ -103,23 +105,25 @@ fun PlayerScreenLandscape(
103105 perform : (action: PlayerAction ) -> Unit ,
104106 share : (track: PlayingTrack ) -> Unit ,
105107 openDrawer : () -> Unit
106- ) = Column (modifier = Modifier .fillMaxSize()) {
107- PlayerScreenAppBar (openDrawer, perform, trackRating, playerStatus, share, playingTrack)
108- Row (modifier = Modifier .fillMaxWidth()) {
109- Column (modifier = Modifier .fillMaxWidth(0.6f )) {
110- Spacer (modifier = Modifier .weight(2f ))
111- TrackInfo (playingTrack)
112- Spacer (modifier = Modifier .weight(1f ))
113- ProgressControl (playingPosition, perform)
114- Spacer (modifier = Modifier .weight(1f ))
115- PlayerActions (playerStatus, perform)
108+ ) = Surface () {
109+ Column (modifier = Modifier .fillMaxSize()) {
110+ PlayerScreenAppBar (openDrawer, perform, trackRating, playerStatus, share, playingTrack)
111+ Row (modifier = Modifier .fillMaxWidth()) {
112+ Column (modifier = Modifier .fillMaxWidth(0.6f )) {
113+ Spacer (modifier = Modifier .weight(2f ))
114+ TrackInfo (playingTrack)
115+ Spacer (modifier = Modifier .weight(1f ))
116+ ProgressControl (playingPosition, perform)
117+ Spacer (modifier = Modifier .weight(1f ))
118+ PlayerActions (playerStatus, perform)
119+ }
120+ TrackCover (
121+ modifier = Modifier
122+ .padding(16 .dp)
123+ .fillMaxSize(),
124+ coverUrl = playingTrack.coverUrl,
125+ )
116126 }
117- TrackCover (
118- modifier = Modifier
119- .padding(16 .dp)
120- .fillMaxSize(),
121- coverUrl = playingTrack.coverUrl,
122- )
123127 }
124128}
125129
@@ -132,19 +136,21 @@ fun PlayerScreenPortrait(
132136 perform : (action: PlayerAction ) -> Unit ,
133137 share : (track: PlayingTrack ) -> Unit ,
134138 openDrawer : () -> Unit
135- ) = Column (modifier = Modifier .fillMaxSize()) {
136- PlayerScreenAppBar (openDrawer, perform, trackRating, playerStatus, share, playingTrack)
137- TrackCover (
138- modifier = Modifier
139- .padding(16 .dp)
140- .fillMaxSize(),
141- coverUrl = playingTrack.coverUrl,
142- )
143- ProgressControl (playingPosition, perform)
144- Spacer (modifier = Modifier .weight(2f ))
145- TrackInfo (playingTrack)
146- Spacer (modifier = Modifier .weight(1f ))
147- PlayerActions (playerStatus, perform)
139+ ) = Surface {
140+ Column (modifier = Modifier .fillMaxSize()) {
141+ PlayerScreenAppBar (openDrawer, perform, trackRating, playerStatus, share, playingTrack)
142+ TrackCover (
143+ modifier = Modifier
144+ .padding(16 .dp)
145+ .fillMaxSize(),
146+ coverUrl = playingTrack.coverUrl,
147+ )
148+ ProgressControl (playingPosition, perform)
149+ Spacer (modifier = Modifier .weight(2f ))
150+ TrackInfo (playingTrack)
151+ Spacer (modifier = Modifier .weight(1f ))
152+ PlayerActions (playerStatus, perform)
153+ }
148154}
149155
150156@Composable
@@ -385,7 +391,9 @@ private fun TrackInfo(
385391 overflow = TextOverflow .Ellipsis
386392 )
387393 }
388- Column (modifier = Modifier .wrapContentWidth().padding(start = 8 .dp)) {
394+ Column (modifier = Modifier
395+ .wrapContentWidth()
396+ .padding(start = 8 .dp)) {
389397 VolumeControl ()
390398 }
391399}
@@ -407,9 +415,9 @@ private fun VolumeControl() {
407415 )
408416}
409417
410- @Preview(showBackground = true )
418+ @Preview(device = Devices . PIXEL_4 )
411419@Composable
412- fun PlayerScreenPreview () {
420+ fun PlayerScreenPortaitPreview () {
413421 RemoteTheme {
414422 PlayerScreenPortrait (
415423 playingTrack = PlayingTrack (
@@ -434,3 +442,31 @@ fun PlayerScreenPreview() {
434442 )
435443 }
436444}
445+
446+ @Preview(device = Devices .PIXEL_4 )
447+ @Composable
448+ fun PlayerScreenLandscapePreview () {
449+ RemoteTheme {
450+ PlayerScreenLandscape (
451+ playingTrack = PlayingTrack (
452+ artist = " Caravan Palace" ,
453+ album = " Panic" ,
454+ title = " Rock It for Me" ,
455+ year = " 2008"
456+ ),
457+ playingPosition = PlayingPosition (63000 , 174000 ),
458+ playerStatus = PlayerStatusModel (
459+ mute = true ,
460+ state = PlayerState .Paused ,
461+ repeat = Repeat .One ,
462+ scrobbling = false ,
463+ shuffle = ShuffleMode .AutoDJ ,
464+ volume = 10
465+ ),
466+ trackRating = TrackRating (lfmRating = LfmRating .Loved , rating = 4.5f ),
467+ perform = {},
468+ share = {},
469+ openDrawer = {}
470+ )
471+ }
472+ }
0 commit comments