Skip to content

Add kdocs to ui/uistate/capture classes#465

Open
davidjiagoogle wants to merge 3 commits intomainfrom
david/captureUiStateDocs
Open

Add kdocs to ui/uistate/capture classes#465
davidjiagoogle wants to merge 3 commits intomainfrom
david/captureUiStateDocs

Conversation

@davidjiagoogle
Copy link
Collaborator

@davidjiagoogle davidjiagoogle commented Feb 4, 2026

As titled
SnackBarUiState is moved from ui/uistate/capture to ui/uistate. SnackBarUiStateAdapter is moved to ui/uistateadapter. This is so that postcapture doesn't have to depend on capture

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @davidjiagoogle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the documentation of the UI state definitions within the ui/uistate/capture module. By adding extensive KDoc comments, the intent, structure, and usage of various UI state classes are now clearly articulated, which will aid in future development and onboarding for this part of the codebase.

Highlights

  • KDoc Documentation Added: Comprehensive KDoc comments have been added to all classes, interfaces, data objects, and enums within the ui/uistate/capture package. This includes detailed descriptions for each UI state, its nested components, and their respective properties or parameters.
  • Improved Code Readability: The addition of KDocs significantly enhances the readability and maintainability of the UI state definitions, making it easier for developers to understand the purpose and usage of each UI state component.
  • Removed TODO Comments: An outdated // todo comment related to audio permission handling in AudioUiState.kt has been removed, replaced by a proper KDoc explanation.

🧠 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
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/AspectRatioUiState.kt
    • Added KDoc for AspectRatioUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/AudioUiState.kt
    • Added KDoc for AudioUiState sealed interface.
    • Added KDoc for amplitude property.
    • Added KDoc for Enabled sealed interface.
    • Added KDoc for On data class.
    • Added KDoc for Mute data object.
    • Added KDoc for Disabled data object.
    • Removed // todo comment.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/CaptureButtonUiState.kt
    • Added KDoc for CaptureButtonUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Enabled sealed interface.
    • Added KDoc for Idle data class and its parameter.
    • Added KDoc for Recording sealed interface.
    • Added KDoc for PressedRecording data object.
    • Added KDoc for LockedRecording data object.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/CaptureModeToggleUiState.kt
    • Added KDoc for CaptureModeToggleUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
    • Added KDoc for isCaptureModeSelectable extension function.
    • Added KDoc for findSelectableStateFor extension function.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/CaptureModeUiState.kt
    • Added KDoc for CaptureModeUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
    • Added KDoc for isCaptureModeSelectable extension function.
    • Added KDoc for findSelectableStateFor extension function.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/ConcurrentCameraUiState.kt
    • Added KDoc for ConcurrentCameraUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/DebugUiState.kt
    • Added KDoc for DebugUiState sealed interface.
    • Added KDoc for Disabled data object.
    • Added KDoc for Enabled sealed interface and its properties.
    • Added KDoc for Closed data class.
    • Added KDoc for Open data class and its properties.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/ElapsedTimeUiState.kt
    • Added KDoc for ElapsedTimeUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Enabled data class and its parameter.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/FlashModeUiState.kt
    • Added KDoc for FlashModeUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/FlipLensUiState.kt
    • Added KDoc for FlipLensUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/FocusMeteringUiState.kt
    • Added KDoc for FocusMeteringUiState sealed interface.
    • Added KDoc for Unspecified data object.
    • Added KDoc for Specified data class and its parameters.
    • Added KDoc for Status enum and its entries.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/HdrUiState.kt
    • Added KDoc for HdrUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/ImageWellUiState.kt
    • Added KDoc for ImageWellUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for LastCapture data class and its parameter.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/ScreenFlashUiState.kt
    • Added KDoc for ScreenFlashUiState data class and its parameters.
    • Removed an internal comment.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/SnackBarUiState.kt
    • Added KDoc for SnackBarUiState data class and its parameter.
    • Added KDoc for SnackbarData data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/StabilizationUiState.kt
    • Added KDoc for StabilizationUiState sealed interface.
    • Added KDoc for Disabled data object.
    • Added KDoc for Enabled sealed interface and its properties.
    • Added KDoc for Specific data class and its parameters.
    • Added KDoc for Auto data class and its parameter.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/StreamConfigUiState.kt
    • Added KDoc for StreamConfigUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/ZoomControlUiState.kt
    • Added KDoc for ZoomControlUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Disabled data object.
    • Added KDoc for Enabled data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/ZoomUiState.kt
    • Added KDoc for ZoomUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Enabled data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/compound/CaptureUiState.kt
    • Added KDoc for CaptureUiState sealed interface.
    • Added KDoc for NotReady data object.
    • Added KDoc for Ready data class and its properties.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/compound/PreviewDisplayUiState.kt
    • Added KDoc for PreviewDisplayUiState data class and its parameters.
  • ui/uistate/capture/src/main/java/com/google/jetpackcamera/ui/uistate/capture/compound/QuickSettingsUiState.kt
    • Added KDoc for QuickSettingsUiState sealed interface.
    • Added KDoc for Unavailable data object.
    • Added KDoc for Available data class and its parameters.
    • Added KDoc for FocusedQuickSetting enum.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds comprehensive KDoc documentation to numerous UI state classes, which is a great improvement for code clarity and maintainability. The added comments are clear and accurate. I've suggested a couple of minor enhancements to improve the robustness of the data classes by adding validation logic that aligns with the expectations set in the new documentation.

Comment on lines +35 to +41
/**
* The capture mode toggle is available for user interaction.
*
* @param selectedCaptureMode The currently active [CaptureMode].
* @param imageOnlyUiState The UI state for the "Image" option in the toggle.
* @param videoOnlyUiState The UI state for the "Video" option in the toggle.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The KDocs for imageOnlyUiState and videoOnlyUiState correctly describe their purpose. To make the Available state more robust, consider adding checks in the init block to verify that imageOnlyUiState.value is indeed CaptureMode.IMAGE_ONLY and videoOnlyUiState.value is CaptureMode.VIDEO_ONLY. This would prevent the creation of an invalid UI state.

Comment on lines +60 to +64
/**
* The stabilization mode is set to automatic.
*
* @param stabilizationMode The stabilization mode, which is expected to be [StabilizationMode.AUTO].
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This KDoc correctly states the expectation that stabilizationMode should be StabilizationMode.AUTO. To improve robustness and ensure this contract is met at runtime, consider adding an init block to enforce this, similar to how the Specific class validates its stabilizationMode. This would prevent invalid state creation.

* limitations under the License.
*/
package com.google.jetpackcamera.ui.uistateadapter.capture
package com.example.uistateadapter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the package is wrong here...

import com.google.jetpackcamera.ui.uistate.SnackbarData
import java.util.Queue

fun SnackBarUiState.Companion.from(snackBarQueue: Queue<SnackbarData>): SnackBarUiState {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also document this file?

@temcguir
Copy link
Collaborator

temcguir commented Feb 5, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily focuses on improving code documentation by adding KDocs to numerous UI state classes in the ui/uistate/capture module. Additionally, it refactors SnackBarUiState and its adapter out of the capture-specific modules into more general ui/uistate and ui/uistateadapter modules. This is a good architectural change that decouples the postcapture feature from the capture feature. The new KDocs are clear and will significantly improve maintainability. I've found one issue with the package name of the moved adapter file, which should be corrected for consistency.

* limitations under the License.
*/
package com.google.jetpackcamera.ui.uistateadapter.capture
package com.example.uistateadapter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The package name should align with the project's convention (com.google.jetpackcamera.*) and the file's location. It seems to have been set to a generic com.example package during the refactoring. Please update it to com.google.jetpackcamera.ui.uistateadapter. You will also need to move the file to the corresponding directory structure (.../com/google/jetpackcamera/ui/uistateadapter/) and update the import statements in PostCaptureViewModel.kt and PreviewViewModel.kt.

Suggested change
package com.example.uistateadapter
package com.google.jetpackcamera.ui.uistateadapter
References
  1. Code should adhere to official Kotlin style guides and Android best practices, which includes correct package naming conventions that align with the project's structure and domain. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants