Conversation
Extracts the two Kotlin blocks from the CameraX take-a-photo guide into
camerax/.../snippets/TakePhoto.kt.
Three lines differ from the page, and each changes the page:
- The page prints Builder(File(...)).build(), which is not valid Kotlin.
The snippet binds Builder(File("photo.jpg")).build(), a placeholder file
name, on the docs team's ruling.
- Both callbacks print // insert your code here. The snippet prints
// Insert your code here, to match the comment style in this repository.
The Java samples on the page are not extracted; this module is Kotlin only.
|
Here is the summary of changes. You are about to add 2 region tags.
This comment is generated by snippet-bot.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code snippets are for: Take a photo with CameraX
Two Kotlin blocks, into
camerax/src/main/java/com/example/camerax/snippets/TakePhoto.kt.android_camerax_take_photo_setupandroid_camerax_take_photo_save_to_fileThe line-count difference is line splits, not different code. A paste test confirms it: the page's block, pasted unchanged and run through
spotlessApply, gives exactly this file's form.List of modifications
File(...)becomesFile("photo.jpg"). The page printsBuilder(File(...)).build(), which is not valid Kotlin. An earlier draft of this extraction kept the page's line inside a block comment with a real value hidden beside it, so the rendered page stayed byte-identical. The docs team asked for a placeholder file name instead, accepting the visible page change, so the snippet binds the value once and the page changes to match.// insert your code here.becomes// Insert your code here, in both callbacks. The page prints the lowercase form with a full stop in its Kotlin and its Java block. Capitalized and without the stop matches the comment style in this repository.All three are page edits. They are listed again at the end.
What the formatter moved
Three changes, all from
spotlessApply:takePicture(wraps, and the two arguments stay together on the next line.onErrorbrace joins its declaration.}then), not}).To reproduce: paste the page's Kotlin block into
cameraxand run./gradlew :camerax:spotlessApply.Snippets not migrated
For the page edit
File(...)becomesFile("photo.jpg")in the Kotlin block.// insert your code here.becomes// Insert your code herein both callbacks, in the Kotlin block and in the Java block.onErrorbrace on its own line. No other block on the page does this.onErrorthenonImageSaved. The Java block below it uses the opposite order.No deprecated APIs. The prose names
ImageCapture,takePicture,OutputFileOptionsandOnImageSavedCallback, and those stay as published.