Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
applicationId = "dev.typetype.android"
minSdk = 23
targetSdk = 37
versionCode = 10711
versionName = "1.7.0-beta.12"
versionCode = 10712
versionName = "1.7.0-beta.13"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
resValue("string", "app_name", "TypeType")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.activity.ComponentActivity
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.unit.dp
Expand All @@ -15,6 +16,7 @@ import androidx.media3.common.Tracks
import androidx.media3.common.VideoSize
import androidx.test.ext.junit.runners.AndroidJUnit4
import java.lang.reflect.Proxy
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
Expand All @@ -29,7 +31,11 @@ class PlayerControlsLayoutTest {
fun portraitControlsDoNotOverlapInsideShortVideoViewport() {
val player = controlsLayoutPlayer()
composeRule.setContent {
Box(Modifier.size(width = 360.dp, height = 202.dp)) {
Box(
Modifier
.size(width = 360.dp, height = 202.dp)
.testTag(PLAYER_CONTROLS_VIEWPORT_TAG),
) {
PlayerControls(
player = player,
title = "Portrait controls",
Expand All @@ -50,9 +56,14 @@ class PlayerControlsLayoutTest {
val bottom = composeRule.onNodeWithTag(PLAYER_BOTTOM_CONTROLS_TAG, useUnmergedTree = true)
.fetchSemanticsNode()
.boundsInRoot
val viewport = composeRule.onNodeWithTag(
PLAYER_CONTROLS_VIEWPORT_TAG,
useUnmergedTree = true,
).fetchSemanticsNode().boundsInRoot

assertTrue("Top controls overlap center controls", top.bottom <= center.top)
assertTrue("Center controls overlap bottom controls", center.bottom <= bottom.top)
assertEquals("Portrait controls stop at the viewport bottom", viewport.bottom, bottom.bottom, 1f)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBars
Expand Down Expand Up @@ -108,13 +107,6 @@ fun PlayerControls(
.align(Alignment.BottomCenter)
.fillMaxWidth()
.testTag(PLAYER_BOTTOM_CONTROLS_TAG)
.then(
if (isFullscreen) {
Modifier
} else {
Modifier.windowInsetsPadding(WindowInsets.navigationBars)
},
)
.padding(
start = if (isFullscreen) 12.dp else 4.dp,
end = if (isFullscreen) 8.dp else 4.dp,
Expand Down Expand Up @@ -185,7 +177,11 @@ private fun BottomBar(
},
)
.padding(start = if (isFullscreen) 8.dp else 2.dp, end = 2.dp),
verticalAlignment = Alignment.CenterVertically,
verticalAlignment = if (isFullscreen) {
Alignment.CenterVertically
} else {
Alignment.Bottom
},
) {
PlayerTimeBar(
player = player,
Expand Down Expand Up @@ -221,4 +217,5 @@ private fun BottomBar(
internal const val PLAYER_TOP_CONTROLS_TAG = "player_top_controls"
internal const val PLAYER_CENTER_CONTROLS_TAG = "player_center_controls"
internal const val PLAYER_BOTTOM_CONTROLS_TAG = "player_bottom_controls"
internal const val PLAYER_CONTROLS_VIEWPORT_TAG = "player_controls_viewport"
private val COMPACT_CONTROLS_HEIGHT = 180.dp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import androidx.compose.animation.fadeOut
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
Expand Down Expand Up @@ -301,9 +298,7 @@ internal fun PlayerSurfaceBox(
if (isFullscreen) {
Modifier.padding(start = 12.dp, end = 8.dp, bottom = 6.dp)
} else {
Modifier
.windowInsetsPadding(WindowInsets.navigationBars)
.padding(start = 4.dp, end = 4.dp)
Modifier.padding(start = 4.dp, end = 4.dp)
},
),
)
Expand Down