-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Moved player composables to the
mediaplayer
folder
Signed-off-by: Gabriel Fontán <[email protected]>
- Loading branch information
Showing
11 changed files
with
66 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...components/others/MediaplayerConstants.kt → ...layer/mediaplayer/MediaplayerConstants.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ava/com/bobbyesp/metadator/presentation/pages/mediaplayer/mediaplayer/MediaplayerSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.bobbyesp.metadator.presentation.pages.mediaplayer.mediaplayer | ||
|
||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.Modifier | ||
import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
import com.bobbyesp.mediaplayer.service.ConnectionState | ||
import com.bobbyesp.metadator.presentation.pages.mediaplayer.MediaplayerViewModel | ||
import com.bobbyesp.metadator.presentation.pages.mediaplayer.mediaplayer.views.MediaplayerCollapsedContent | ||
import com.bobbyesp.metadator.presentation.pages.mediaplayer.mediaplayer.views.MediaplayerExpandedContent | ||
import com.bobbyesp.ui.components.bottomsheet.draggable.DraggableBottomSheet | ||
import com.bobbyesp.ui.components.bottomsheet.draggable.DraggableBottomSheetState | ||
import kotlinx.coroutines.launch | ||
|
||
@Composable | ||
fun MediaplayerSheet( | ||
modifier: Modifier = Modifier, state: DraggableBottomSheetState, viewModel: MediaplayerViewModel | ||
) { | ||
val playingSong = | ||
viewModel.playingSong.collectAsStateWithLifecycle().value?.mediaMetadata ?: return | ||
val connectionState = | ||
viewModel.connectionHandler.connectionState.collectAsStateWithLifecycle().value | ||
|
||
LaunchedEffect(connectionState, Unit) { | ||
if (connectionState is ConnectionState.Connected && state.isDismissed) { | ||
launch { | ||
state.collapseSoft() | ||
} | ||
} | ||
} | ||
|
||
DraggableBottomSheet(modifier = modifier, state = state, collapsedContent = { | ||
MediaplayerCollapsedContent( | ||
viewModel = viewModel, nowPlaying = playingSong | ||
) | ||
}, backgroundColor = MaterialTheme.colorScheme.surfaceContainerHigh, onDismiss = { | ||
viewModel.dismissPlayer() | ||
}) { | ||
MediaplayerExpandedContent( | ||
viewModel = viewModel, | ||
sheetState = state, | ||
) | ||
} | ||
} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...thers/mediaplayer/MediaplayerSheetView.kt → ...layer/mediaplayer/MediaplayerSheetView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nents/others/mediaplayer/PlayerOptions.kt → .../mediaplayer/mediaplayer/PlayerOptions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/others/mediaplayer/views/PlayerQueue.kt → ...iaplayer/mediaplayer/views/PlayerQueue.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters