Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9da96f5
initial wip for tooltip component
Kimblebee Jul 30, 2026
d293b34
polish component + slight animation
Kimblebee Jul 30, 2026
05ba546
add optional auto dismiss timer param
Kimblebee Jul 30, 2026
3c272dc
polish tooltip and clean up dependencies
Kimblebee Jul 30, 2026
d66f96a
migrate to compose native tooltip
Kimblebee Jul 30, 2026
ae08a58
tooltip adjsutments
Kimblebee Jul 30, 2026
554dfba
Merge remote-tracking branch 'origin/main' into kim/feature/tooltip
Kimblebee Oct 12, 2026
3f8f2a1
Merge remote-tracking branch 'origin/main' into kim/feature/tooltip
Kimblebee Oct 19, 2026
4d385a4
Refactor tooltip into JcaTooltipBox and TooltipIconButton with tests
Kimblebee Oct 20, 2026
228de28
Position tooltip in status bar topEndContent with overlap-aware styli…
Kimblebee Oct 21, 2026
3c047c3
Align tooltip button dimensions, padding, and size tokens with Figma …
Kimblebee Oct 21, 2026
2842176
Implement bespoke Compose Popup tooltip with dynamic caret tracking
Kimblebee Oct 27, 2026
844d7e5
Align tooltip button, dimensions, and typography with Figma and acces…
Kimblebee Oct 27, 2026
1030444
Map tooltip dimensions, shapes, and colors to Material 3 tokens
Kimblebee Oct 27, 2026
14f5941
Merge remote-tracking branch 'origin/main' into kim/feature/tooltip
Kimblebee Oct 27, 2026
3303a7c
Wrap top bar indicator items in Row container with IndicatorPill
Kimblebee Oct 28, 2026
cb1887c
Merge branch 'main' into kim/feature/tooltip
Kimblebee Oct 28, 2026
de0b7a7
Decouple tooltip triggers and auto-dismissal into JcaTooltipState
Kimblebee Oct 28, 2026
67db7f8
Set tooltip accessibility live region mode to Polite
Kimblebee Oct 28, 2026
527d64f
Refactor TooltipIconButton onto M3 TooltipBox and add PreviewLayout t…
Kimblebee Nov 6, 2026
11f1359
Merge branch 'main' into kim/feature/tooltip
Kimblebee Nov 6, 2026
11f8d71
Merge branch 'main' into kim/feature/tooltip
Kimblebee Nov 9, 2026
79892ef
Merge remote-tracking branch 'origin/main' into kim/feature/tooltip
Kimblebee Nov 10, 2026
d966cc2
Address PR review feedback for TooltipIconButton and JcaTooltipCaret
Kimblebee Nov 10, 2026
4559d9a
Apply styleguide polish to Tooltip components and tests
Kimblebee Nov 10, 2026
dc1e050
Merge branch 'main' into kim/feature/tooltip
Kimblebee Nov 10, 2026
104a52f
Merge remote-tracking branch 'origin/main' into kim/feature/tooltip
Kimblebee Nov 11, 2026
81930a5
Assert returned popup position in TooltipTest corner clearance test
Kimblebee Nov 11, 2026
b4dcbd3
Address tooltip review: take TooltipCaret in slot overload, drop Jca …
Kimblebee Nov 13, 2026
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
23 changes: 23 additions & 0 deletions ui/components/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ android {
buildConfig = true
compose = true
}

testOptions {
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
}
}
}

dependencies {
Expand All @@ -67,6 +74,22 @@ dependencies {

// Compose - Material Design 3
implementation(libs.compose.material3)

// Compose - Testing
androidTestImplementation(composeBom)
androidTestImplementation(libs.compose.junit)
debugImplementation(libs.compose.test.manifest)
// noinspection TestManifestGradleConfiguration: required for release build unit tests
testImplementation(libs.compose.test.manifest)
testImplementation(libs.compose.junit)

// Testing
testImplementation(libs.junit)
testImplementation(libs.truth)
androidTestImplementation(libs.truth)
testImplementation(libs.robolectric)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}

// Allow references to generated code
Expand Down
1 change: 1 addition & 0 deletions ui/components/capture/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ dependencies {

implementation(project(":ui:uistate"))
implementation(project(":ui:uistate:capture"))
implementation(project(":ui:components"))
implementation(project(":ui:controller"))
implementation(project(":core:camera"))
implementation(project(":core:common"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ import androidx.compose.foundation.layout.systemBarsIgnoringVisibility
import androidx.compose.foundation.layout.systemGestures
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.BottomSheetScaffold
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SheetValue
Expand All @@ -70,14 +72,17 @@ import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.Placeable
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntRect
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.max
import androidx.compose.ui.unit.min
import androidx.compose.ui.unit.takeOrElse
import com.google.jetpackcamera.ui.components.TooltipIconButton
import com.google.jetpackcamera.ui.components.capture.layout.CameraLayoutDefaults
import com.google.jetpackcamera.ui.components.capture.layout.CameraLayoutSolver
import com.google.jetpackcamera.ui.components.capture.layout.CameraRowIds
Expand Down Expand Up @@ -159,8 +164,9 @@ internal val ViewfinderTopLine = HorizontalAlignmentLine { a, b -> minOf(a, b) }
* Positions the [viewfinder], individual control slots ([captureButton], [imageWell],
* [flipCameraButton], [zoomLevelDisplay], [elapsedTimeDisplay], [quickSettingsButton],
* [indicatorRow], [captureModeToggle], [captureModeCarousel]), [quickSettingsOverlay],
* [topStartContent], [viewfinderTopEndContent], [topBarTrailingContent], [overlay],
* [screenFlashOverlay], [snackBar], and [errorDialog] without depending on [CaptureUiState].
* [topStartContent], [viewfinderTopEndContent], [topBarLeadingContent], [topBarTrailingContent],
* [overlay], [screenFlashOverlay], [snackBar], and [errorDialog] without depending on
* [CaptureUiState].
*
* @param modifier the [Modifier] for this component.
* @param state the mode-agnostic [CaptureScaffoldState] controlling Quick Settings visibility and
Expand Down Expand Up @@ -198,6 +204,8 @@ internal val ViewfinderTopLine = HorizontalAlignmentLine { a, b -> minOf(a, b) }
* below [topStartContent], this content moves down with the top edge of the viewfinder while
* [topStartContent] stays in place. Like [topStartContent], this content receives a
* [PreviewOverlaySlotScope].
* @param topBarLeadingContent optional composable content placed at the start of the top
* status/indicator bar directly adjacent to [indicatorRow].
* @param topBarTrailingContent optional composable content aligned to the end of the top
* status/indicator bar.
* @param onRequiresImmersiveChange invoked with `true` when the window is too short for the
Expand Down Expand Up @@ -229,6 +237,7 @@ fun CaptureScaffoldLayout(
snackBar: @Composable (Modifier, snackbarHostState: SnackbarHostState) -> Unit = { _, _ -> },
topStartContent: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit = {},
viewfinderTopEndContent: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit = {},
topBarLeadingContent: (@Composable PreviewOverlaySlotScope.(Modifier) -> Unit)? = null,
topBarTrailingContent: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit = {},
onRequiresImmersiveChange: (Boolean) -> Unit = {},
errorDialog: @Composable (Modifier) -> Unit = {}
Expand Down Expand Up @@ -310,6 +319,7 @@ fun CaptureScaffoldLayout(
viewfinderTopEndContent = viewfinderTopEndContent,
onRequiresImmersiveChange = onRequiresImmersiveChange,
indicatorRow = indicatorRow,
topBarLeadingContent = topBarLeadingContent,
topBarTrailingContent = topBarTrailingContent,
elapsedTimeDisplay = elapsedTimeDisplay,
zoomControls = zoomLevelDisplay,
Expand Down Expand Up @@ -356,9 +366,10 @@ fun CaptureScaffoldLayout(
.padding(horizontal = LOWER_SECTION_HORIZONTAL_PADDING),
contentAlignment = Alignment.CenterStart
) {
OverlapAwareStyleProvider {
indicatorRow(Modifier)
}
TopBarLeadingAndIndicatorsRow(
topBarLeadingContent = topBarLeadingContent,
indicatorRow = indicatorRow
)
OverlapAwareStyleProvider(Modifier.align(Alignment.CenterEnd)) {
topBarTrailingContent(Modifier)
}
Expand Down Expand Up @@ -434,6 +445,45 @@ fun CaptureScaffoldLayout(
}
}

/**
* Lays out the optional [topBarLeadingContent] directly adjacent to [indicatorRow] inside the top
* status/indicator bar, flowing the leading content past any overlapping corner display cutout.
*
* @param topBarLeadingContent optional leading slot content scoped to [PreviewOverlaySlotScope].
* @param indicatorRow top status indicator row content scoped to [PreviewOverlaySlotScope].
* @param modifier [Modifier] applied to the outer row.
* @param cutoutRectsOverride synthetic cutout rectangles in local coordinates for deterministic
* unit testing; when empty, the host window's display cutout is used.
*/
@Composable
internal fun TopBarLeadingAndIndicatorsRow(
topBarLeadingContent: (@Composable PreviewOverlaySlotScope.(Modifier) -> Unit)?,
indicatorRow: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit,
modifier: Modifier = Modifier,
cutoutRectsOverride: List<IntRect> = emptyList()
) {
Row(
modifier = modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
if (topBarLeadingContent != null) {
OverlapAwareStyleProvider {
val slotScope = this
CutoutAwareRow(
modifier = Modifier.wrapContentWidth(align = Alignment.Start),
horizontalSpacing = 0.dp,
cutoutRectsOverride = cutoutRectsOverride.ifEmpty { null }
) {
slotScope.topBarLeadingContent(Modifier)
}
}
}
OverlapAwareStyleProvider {
indicatorRow(Modifier)
}
}
}

private enum class CaptureSlotId {
Viewfinder,
TopStartContent,
Expand All @@ -456,6 +506,7 @@ private fun AdaptivePortraitCaptureLayout(
viewfinderTopEndContent: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit,
onRequiresImmersiveChange: (Boolean) -> Unit,
indicatorRow: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit,
topBarLeadingContent: (@Composable PreviewOverlaySlotScope.(Modifier) -> Unit)?,
topBarTrailingContent: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit,
elapsedTimeDisplay: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit,
zoomControls: @Composable PreviewOverlaySlotScope.(Modifier) -> Unit,
Expand Down Expand Up @@ -545,9 +596,10 @@ private fun AdaptivePortraitCaptureLayout(
.padding(horizontal = LOWER_SECTION_HORIZONTAL_PADDING),
contentAlignment = Alignment.CenterStart
) {
OverlapAwareStyleProvider {
indicatorRow(Modifier)
}
TopBarLeadingAndIndicatorsRow(
topBarLeadingContent = topBarLeadingContent,
indicatorRow = indicatorRow
)
OverlapAwareStyleProvider(Modifier.align(Alignment.CenterEnd)) {
topBarTrailingContent(Modifier)
}
Expand Down Expand Up @@ -1019,3 +1071,95 @@ private fun CaptureLayoutPreview() {
}
)
}

@OptIn(ExperimentalMaterial3Api::class)
@PreviewPortraitDevices
@Composable
private fun CaptureLayoutWithTooltipPreview() {
CaptureScaffoldLayout(
modifier = Modifier.background(Color.Black),
viewfinder = { modifier ->
Box(
modifier = modifier
.fillMaxWidth()
.aspectRatio(3f / 4f)
.background(Color.DarkGray)
)
},
captureButton = { modifier ->
Box(
modifier = modifier
.size(80.dp)
.background(Color.White)
)
},
flipCameraButton = { modifier ->
Box(
modifier = modifier
.size(48.dp)
.background(Color.Cyan)
)
},
imageWell = { modifier ->
Box(
modifier = modifier
.size(48.dp)
.background(Color.Cyan)
)
},
zoomLevelDisplay = { modifier ->
Box(
modifier = modifier
.height(48.dp)
.fillMaxWidth()
.background(Color.Magenta)
)
},
elapsedTimeDisplay = { modifier ->
Box(
modifier = modifier
.height(24.dp)
.fillMaxWidth(0.5f)
.background(Color.Red)
)
},
quickSettingsButton = { modifier ->
Box(
modifier = modifier
.size(48.dp)
.background(Color.Yellow)
)
},
topBarLeadingContent = { modifier ->
TooltipIconButton(
modifier = modifier,
icon = {
Icon(
painter = painterResource(R.drawable.ic_info_filled),
contentDescription = null
)
},
tooltipText = "Camera information",
isOutlined = true
)
},
indicatorRow = { modifier ->
IndicatorPill(modifier = modifier.fillMaxWidth()) {
IndicatorPillIcon(visible = true) {
Icon(
painter = painterResource(R.drawable.ic_flash_on_filled),
contentDescription = null
)
}
}
},
captureModeToggle = { modifier ->
Box(
modifier = modifier
.height(48.dp)
.fillMaxWidth(0.5f)
.background(Color.Blue)
)
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,8 @@ private fun rememberZoomStateManager(
* Opinionated camera capture scaffold exposing individual control and chrome slots ([topBar],
* [captureButton], [flipCameraButton], [zoomControls], [captureModeToggle], [captureModeCarousel],
* [quickSettingsButton], [elapsedTimeDisplay], opt-in [imageWell], [quickSettings], [errorDialog],
* [topStartContent], [viewfinderTopEndContent], [topBarTrailingContent], and [overlay]).
* [topStartContent], [viewfinderTopEndContent], [topBarLeadingContent], [topBarTrailingContent],
* and [overlay]).
*
* Host screens remain in control of their own screen policy (permissions, camera session start/stop
* via [CameraSessionEffect], capture event navigation, and benchmarking), and pass a deferred
Expand Down Expand Up @@ -766,6 +767,8 @@ private fun rememberZoomStateManager(
* below the top bar.
* @param viewfinderTopEndContent optional composable slot anchored to the top-end corner of the
* viewfinder.
* @param topBarLeadingContent optional composable slot placed at the start of the top bar directly
* adjacent to [topBar].
* @param topBarTrailingContent optional composable slot aligned to the end of the top bar.
* @param overlay optional overlay composable slot drawn above the viewfinder and controls.
*/
Expand Down Expand Up @@ -889,6 +892,7 @@ fun CaptureScaffold(
},
topStartContent: (@Composable CaptureSlotScope.(Modifier) -> Unit)? = null,
viewfinderTopEndContent: (@Composable CaptureSlotScope.(Modifier) -> Unit)? = null,
topBarLeadingContent: (@Composable CaptureSlotScope.(Modifier) -> Unit)? = null,
topBarTrailingContent: (@Composable CaptureSlotScope.(Modifier) -> Unit)? = null,
overlay: (@Composable CaptureSlotScope.(Modifier) -> Unit)? = null
) {
Expand Down Expand Up @@ -1290,6 +1294,21 @@ fun CaptureScaffold(
slotScope.viewfinderTopEndContent(slotModifier)
}
},
topBarLeadingContent = topBarLeadingContent?.let { leadingContent ->
{ slotModifier ->
val slotScope = rememberCaptureSlotScope(
overlayScope = this,
isRecordingState = isVideoRecordingActive,
scaffoldState = state,
onToggleQuickSettings = onToggleQuickSettings,
onDismissQuickSettings = onDismissQuickSettings,
onIncrementZoom = onIncrementZoom,
onAnimateZoomTo = onAnimateZoomTo,
onSetAbsoluteZoom = onSetAbsoluteZoom
)
slotScope.leadingContent(slotModifier)
}
},
topBarTrailingContent = { slotModifier ->
if (topBarTrailingContent != null) {
val slotScope = rememberCaptureSlotScope(
Expand Down
Loading
Loading