-
Notifications
You must be signed in to change notification settings - Fork 7.4k
feat: ML Kit Quickstart Kotlin #639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...gle/firebase/samples/apps/mlkit/kotlin/cloudtextrecognition/CloudTextRecognitionProcessor.kt
Show resolved
Hide resolved
|
@rosariopfernandes thanks for jumping on this! Since the build is red here I went and reviewed the auth PR by @the-dagger first. It may be useful for you to participate in that review as well (as an observer and a reviewer), I am sure the decisions we make over there will impact the work you're doing. |
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/CameraSource.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/CameraSource.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/CameraSource.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/CameraSource.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/CameraSource.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/CameraSource.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/FrameMetadata.kt
Outdated
Show resolved
Hide resolved
| if (preview == null) { | ||
| Log.d(TAG, "Preview is null") | ||
| } | ||
| graphicOverlay = findViewById<View>(R.id.fireFaceOverlay) as GraphicOverlay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: should we use synthetic binding instead of findViewById?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the activity xml file uses the java.GraphicOverlay class, synthetic binding automatically casts it to the GraphicOverlay class from the java package.
An alternative to findViewById would be to create a second xml file for that activity and use the kotlin.GraphicOverlay class. But that would make this app different from the others.
Your thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh that's an interesting edge case! I'd say in this case we can leave the dependency on java then, thanks for pointing that out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samtstern This actually leads to runtime errors, since java.GraphicOverlay can't be cast to kotlin.GraphicOverlay.
I suggest we keep these classes written in java, but move them to a common package at the root of the quickstart so that they can be used in both the java and kotlin packages. The only classes written in kotlin would be the ones that actually make use of the ML Kit SDK.
I believe @the-dagger 's lint check would allow this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samtstern I need your thoughts on my comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosariopfernandes apologies for not responding, moving to a .common package sounds like the right idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will do so.
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/StillImageActivity.kt
Outdated
Show resolved
Hide resolved
...rc/main/java/com/google/firebase/samples/apps/mlkit/kotlin/barcodescanning/BarcodeGraphic.kt
Show resolved
Hide resolved
… into mlkit-kotlin
… into mlkit-kotlin
|
@samtstern Thanks for your review here. Since there are a lot of files to be changed here (to remove all the |
|
@rosariopfernandes ok sounds good to me, let's put this one on hold. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, minor styling comments.
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/LivePreviewActivity.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/ChooserActivity.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/ChooserActivity.kt
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/LivePreviewActivity.kt
Outdated
Show resolved
Hide resolved
mlkit/app/src/main/java/com/google/firebase/samples/apps/mlkit/kotlin/LivePreviewActivity.kt
Outdated
Show resolved
Hide resolved
| barcodes: List<FirebaseVisionBarcode>, | ||
| frameMetadata: FrameMetadata, | ||
| graphicOverlay: GraphicOverlay) { | ||
| graphicOverlay.clear() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : indentation here
...va/com/google/firebase/samples/apps/mlkit/kotlin/barcodescanning/BarcodeScanningProcessor.kt
Show resolved
Hide resolved
...n/java/com/google/firebase/samples/apps/mlkit/kotlin/cloudimagelabeling/CloudLabelGraphic.kt
Show resolved
Hide resolved
...m/google/firebase/samples/apps/mlkit/kotlin/cloudlandmarkrecognition/CloudLandmarkGraphic.kt
Outdated
Show resolved
Hide resolved
...main/java/com/google/firebase/samples/apps/mlkit/kotlin/custommodel/CustomImageClassifier.kt
Show resolved
Hide resolved
|
@the-dagger Thanks a lot for reviewing this. @samtstern I believe this one is ready to go. |
fixed #635
By the time I realized this wasn't one of the simplest quickstarts it was too late. It should probably be one of the last translations. My apologies