Update Capture Button visuals#461
Update Capture Button visuals#461temcguir wants to merge 10 commits intotemcguir/capture_button_disabled_statefrom
Conversation
f12a849 to
d9398ce
Compare
|
/gemini summary |
There was a problem hiding this comment.
Code Review
This pull request does a great job of updating the CaptureButton component's appearance and behavior. The changes align well with the design mocks, and the fixes for VIDEO_ONLY mode and volume button capture are significant improvements. The refactoring of the animation logic using updateTransition and the introduction of InteractionSource are excellent choices that follow Compose best practices. The simplification of the preview composables is also a welcome change that improves maintainability.
I've left a couple of comments: one to address a logic regression that could cause onRelease to be called twice, and another with a suggestion to simplify a boolean check for better readability. Overall, this is a high-quality contribution.
...ture/src/main/java/com/google/jetpackcamera/ui/components/capture/CaptureButtonComponents.kt
Show resolved
Hide resolved
Summary of ChangesThis pull request refines the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
|
b15fb8a to
1f5bccd
Compare
This also adds an additional interactionSource to the capture button so we can emulate touch events in our compose previews.
Also ensures the disabled state for the capture button has the correct animations for the nucleus.
Also animates to/from the pressed state
d9398ce to
647522b
Compare
Kimblebee
left a comment
There was a problem hiding this comment.
some duplicate comments regarding readibility, otherwise I think the PR looks great
| @Preview | ||
| @Composable | ||
| private fun CaptureButtonUnavailablePreview() { | ||
| CaptureButton( | ||
| onImageCapture = {}, | ||
| onStartRecording = {}, | ||
| onStopRecording = {}, | ||
| onLockVideoRecording = {}, | ||
| onIncrementZoom = {}, | ||
| PreviewCaptureButton( | ||
| captureButtonUiState = CaptureButtonUiState.Unavailable | ||
| ) | ||
| } |
There was a problem hiding this comment.
nit: this @Preview function should be moved below PreviewCaptureButton
| transitionSpec = { | ||
| when { | ||
| NucleusState.Disabled isTransitioningTo NucleusState.Idle -> tween( | ||
| durationMillis = 300 |
There was a problem hiding this comment.
these durationMillis values could be constants?
| if (targetState) { | ||
| snap() | ||
| } else { | ||
| tween(durationMillis = 200) |
There was a problem hiding this comment.
another constant durationMillis?
| }, | ||
| animationSpec = tween(durationMillis = if (isVisuallyDisabled) 1000 else 300), | ||
| animationSpec = if (isVisuallyDisabled) { | ||
| tween(durationMillis = 1000) |
There was a problem hiding this comment.
more magic numbers to be moved to constants?
| } | ||
| ) { state -> | ||
| when (state) { | ||
| NucleusState.Disabled -> LocalContentColor.current.copy(alpha = 0.38f) |
There was a problem hiding this comment.
repeated alpha value .38f to be moved to a constant?
| Box( | ||
| modifier = Modifier | ||
| .size(captureButtonSize.dp) | ||
| .background(Color.Black.copy(alpha = 0.5f), CircleShape) |
There was a problem hiding this comment.
should this unique alpha value be a constant?
This PR updates the appearance and behavior of the
CaptureButtoncomponent to better match design mocks and improve preview visibility.Key Changes
Behavioral Fixes:
VIDEO_ONLYmode: The nucleus is now white when idle and turns red only when pressed or recording (previously it was always red).IMAGE_ONLYmode.Refactoring:
CaptureButtonimplementation.