Update Capture Button visuals - #461
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.
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
|
Introduces an `isCameraRunning` flag to the `CameraState` to accurately reflect the underlying camera's status. This state is derived from the CameraX `CameraState` and is used to disable the capture button when the camera is not open or available. This commit also renames `torchEnabled` to `isTorchEnabled` for clarity and consistency, and ensures the `ZoomState` is being correctly updated in the `CameraState`. The capture button's UI has been improved to prevent flickering during brief transitional states (e.g. switching cameras). This is achieved by visually debouncing the disabled state. While the button's semantics and pointer input are disabled immediately, the visual change to a disabled appearance is delayed by one second. If the button becomes enabled again within this period, the distracting flicker is avoided. Color transitions are animated for a smoother user experience. Finally, the test suite has been made more robust by updating the tests to wait for the capture button to be both displayed and enabled before interaction.
This is the opposite of "Unavailable".
…button_disabled_state
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
5b07615 to
5a4ee7d
Compare
5a4ee7d to
0c9b62a
Compare
…re_button_appearance # Conflicts: # feature/preview/src/main/java/com/google/jetpackcamera/feature/preview/PreviewScreen.kt # gradle/libs.versions.toml # ui/components/capture/src/main/java/com/google/jetpackcamera/ui/components/capture/CaptureButtonComponents.kt # ui/components/capture/src/main/java/com/google/jetpackcamera/ui/components/capture/CaptureLayout.kt
0c9b62a to
b471f94
Compare
Introduces OverlapAwareStyleProvider and generic background style tracking, correctly resolving overlap based on the dynamic interior bounds of the CameraX Preview.
50e48eb to
ff792fd
Compare
…lve ActivityScenario manifest bindings
…i-test-manifest instead
10c6851 to
1cecafb
Compare
1cecafb to
b2369ba
Compare
This PR updates the appearance and behavior of the
CaptureButtoncomponent to better match design mocks and improve preview visibility.Key Changes
LocalShutterBackgroundStyle(WHITE_20andBLACK_60).Accessibility and Localization:
CaptureButtonfocusable and added appropriate roles and content descriptions.strings.xmlfor proper localization support.Refactoring and Testing:
CompositionLocalProvider(LocalInitialPressedState provides true), avoiding manual construction of complex UI states and ensuring accurate rendering in previews.CaptureButtonScreenshotTest.ktfor better maintainability.