Conversation
Summary of ChangesHello @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 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
| /** | ||
| * 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. | ||
| */ |
There was a problem hiding this comment.
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.
| /** | ||
| * The stabilization mode is set to automatic. | ||
| * | ||
| * @param stabilizationMode The stabilization mode, which is expected to be [StabilizationMode.AUTO]. | ||
| */ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Can you also document this file?
|
/gemini review |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
| package com.example.uistateadapter | |
| package com.google.jetpackcamera.ui.uistateadapter |
References
- 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)
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