diff --git a/feature/home/src/main/java/com/android/developers/androidify/home/HomeScreen.kt b/feature/home/src/main/java/com/android/developers/androidify/home/HomeScreen.kt index 5e6fc429..c2764c03 100644 --- a/feature/home/src/main/java/com/android/developers/androidify/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/android/developers/androidify/home/HomeScreen.kt @@ -75,6 +75,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.rememberVectorPainter +import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.onLayoutRectChanged import androidx.compose.ui.layout.onVisibilityChanged import androidx.compose.ui.platform.LocalContext @@ -456,11 +457,19 @@ private fun DancingBot( dancingBotLink: String?, modifier: Modifier, ) { - AsyncImage( - model = dancingBotLink, - modifier = modifier, - contentDescription = null, - ) + if (LocalInspectionMode.current) { + Image( + painter = painterResource(id = R.drawable.dancing_droid_gif_placeholder), + contentDescription = null, + modifier = modifier + ) + } else { + AsyncImage( + model = dancingBotLink, + modifier = modifier, + contentDescription = null, + ) + } } @Composable @@ -520,23 +529,31 @@ private fun VideoPlayer( videoLink: String?, modifier: Modifier = Modifier, ) { - if (LocalInspectionMode.current) return // Layoutlib does not support ExoPlayer - - val context = LocalContext.current - var player by remember { mutableStateOf(null) } - LifecycleStartEffect(videoLink) { - if (videoLink != null) { - player = ExoPlayer.Builder(context).build().apply { - setMediaItem(MediaItem.fromUri(videoLink)) - repeatMode = Player.REPEAT_MODE_ONE - prepare() + if (LocalInspectionMode.current) { + Image( + painter = painterResource(id = R.drawable.promo_video_placeholder), + contentDescription = null, + contentScale = ContentScale.Crop, + modifier = modifier, + ) + return + } else { + val context = LocalContext.current + var player by remember { mutableStateOf(null) } + LifecycleStartEffect(videoLink) { + if (videoLink != null) { + player = ExoPlayer.Builder(context).build().apply { + setMediaItem(MediaItem.fromUri(videoLink)) + repeatMode = Player.REPEAT_MODE_ONE + prepare() + } + } + onStopOrDispose { + player?.release() + player = null } } - onStopOrDispose { - player?.release() - player = null - } - } + var videoFullyOnScreen by remember { mutableStateOf(false) } val isWindowOccluded = LocalOcclusion.current @@ -582,3 +599,4 @@ private fun VideoPlayer( } } } +} diff --git a/feature/home/src/main/res/drawable-nodpi/dancing_droid_gif_placeholder.png b/feature/home/src/main/res/drawable-nodpi/dancing_droid_gif_placeholder.png new file mode 100644 index 00000000..8e5f7f9a Binary files /dev/null and b/feature/home/src/main/res/drawable-nodpi/dancing_droid_gif_placeholder.png differ diff --git a/feature/home/src/main/res/drawable-nodpi/promo_video_placeholder.png b/feature/home/src/main/res/drawable-nodpi/promo_video_placeholder.png new file mode 100644 index 00000000..a3a504eb Binary files /dev/null and b/feature/home/src/main/res/drawable-nodpi/promo_video_placeholder.png differ