Add MediaPlayerSample composable and update MainActivity - #46
Add MediaPlayerSample composable and update MainActivity#46ClementBobin wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the :sample Android app to demonstrate a new KMediaPlayer prefab UI by adding a MediaPlayerSample composable, switching MainActivity to render it, and refining the sample module’s Android configuration (namespace/minSdk). It also introduces the new KMediaPlayer implementation and related data models in core’s androidMain source set.
Changes:
- Added
MediaPlayerSamplewith mock episodes/player state and simulated playback progress. - Updated
MainActivityto use edge-to-edge +KindlingThemeand show the new sample. - Updated the sample module’s
namespaceand setminSdk = 23; addedKMediaPlayerprefab implementation incore.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sample/src/main/kotlin/dev/kindling/sample/MediaPlayerSample.kt | New sample screen wiring KMediaPlayer with mock state and callbacks. |
| sample/src/main/kotlin/dev/kindling/sample/MainActivity.kt | Swaps the sample app entry point to the new media player demo and edge-to-edge setup. |
| sample/build.gradle.kts | Updates sample module namespace and minSdk configuration. |
| core/src/androidMain/kotlin/dev/kindling/core/components/prefab/KMediaPlayer.kt | Adds the new KMediaPlayer prefab UI and associated models/state. |
Suppressed comments (1)
core/src/androidMain/kotlin/dev/kindling/core/components/prefab/KMediaPlayer.kt:190
val scope = rememberCoroutineScope()is declared but never used. This is dead code and may trigger unused-variable lint rules.
var showFilterDialog by remember { mutableStateOf(false) }
val scope = rememberCoroutineScope()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| KindlingTheme(colorScheme = lightColorScheme()) { | ||
| MediaPlayerSample() | ||
| // Toaster must wrap (or sit alongside) the androidMain content | ||
| // so it can receive and display toasts from anywhere in the tree. | ||
| Surface(modifier = Modifier.fillMaxSize()) { | ||
| Box(modifier = Modifier.fillMaxSize()) { | ||
| KindlingCatalog() | ||
| Toaster() // ← renders toasts on top of everything | ||
| } | ||
| } | ||
| //Surface(modifier = Modifier.fillMaxSize()) { |
| import androidx.compose.material3.MaterialTheme | ||
| import androidx.compose.material3.Surface | ||
| import androidx.compose.material3.lightColorScheme | ||
| import androidx.compose.ui.Modifier | ||
| import dev.kindling.core.components.Toaster |
| * | ||
| * Simulates: | ||
| * - a 23m42s episode with a fake playback clock (advances when `isPlaying`) | ||
| * - 5 episodes in the list (mirrors the screenshots) |
| * onBack = { navController.popBackStack() }, | ||
| * onStateChange = { newState -> viewModel.update(newState) }, | ||
| * onSeek = { ms -> player.seekTo(ms) }, | ||
| * onSkip = { ms -> player.seekTo(player.currentPosition + ms * 1000L) }, |
| import kotlinx.coroutines.delay | ||
| import kotlinx.coroutines.launch |
This pull request updates the sample app to showcase a new media player component and improves the structure and configuration of the sample module. The most important changes include adding a new
MediaPlayerSamplecomposable, updating the main activity to use it, and refining the sample app's namespace and configuration.Sample app improvements:
MediaPlayerSamplecomposable inMediaPlayerSample.kt, which demonstrates the usage ofKMediaPlayerwith mock data for episodes, playback state, tracks, and quality options. It also simulates playback and provides handlers for player actions.MainActivity.ktto useenableEdgeToEdge, apply theKindlingTheme, and display the newMediaPlayerSampleinstead of the previous catalog/toaster structure.Project configuration:
namespacefor the sample module todev.kindling.sampleand setminSdkto 23 inbuild.gradle.ktsfor better clarity and compatibility.