Skip to content
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

sample-gltf-viewer: introduce QR code feature. #3599

Closed
wants to merge 3 commits into from
Closed

Conversation

prideout
Copy link
Contributor

@prideout prideout commented Mar 1, 2021

This works in tandem with the new page at https://google.github.io/filament/qrcode/

Screen Shot 2021-03-01 at 9 46 36 AM

This feature did not require any changes to ModelViewer.kt or any of our libraries. It involves the following additions to the app MainActivity:

We would like to add more features in the future, including the ability
to drop additional models without rescanning and the ability to drop
zip files.

This feature was inspired by a Model Viewer editor feature, thanks @elalish

@elalish
Copy link

elalish commented Mar 1, 2021

Let me get this straight: you also created a project called ModelViewer? 🤦‍♂️

@prideout
Copy link
Contributor Author

prideout commented Mar 1, 2021

Let me get this straight: you also created a project called ModelViewer? 🤦‍♂️

Well it's just the name of a Kotlin class, it seemed like the most appropriate name at the time. :)

@@ -74,6 +111,126 @@ class MainActivity : Activity() {
modelViewer.view.bloomOptions = bloomOptions
}

private fun bindPreview(cameraProvider: ProcessCameraProvider) {
val preview : Preview = Preview.Builder().build().also {
Copy link
Member

Choose a reason for hiding this comment

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

I think you can leave off the : Preview here and : CameraSelector down below

val scanner = BarcodeScanning.getClient(options)
scanner.process(image)
.addOnSuccessListener { barcodes ->
for (barcode in barcodes) {
Copy link
Member

Choose a reason for hiding this comment

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

If multiple barcodes are detected, does it make sense to call downloadFromBarcode for each? Perhaps we just want to download the first one we find.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I will simplify this.

This commit did not require any changes to ModelViewer or any of our
libraries. It involved the following additions to the app MainActivity:

- Add a button to the app bar, which requires AppCompatActivity as per
  https://developer.android.com/training/appbar/setting-up

- Add a PreviewView widget from androidx.

- Add usage of BarcodeScanner in mlkit.

- Add a coroutine for downloading data via HttpURLConnection.

We would like to add more features in the future, including the ability
to drop additional models without rescanning and the ability to drop
zip files.
@prideout prideout closed this Mar 2, 2021
prideout added a commit that referenced this pull request Mar 2, 2021
This adds a button to the action bar and spins up a WebSockets server.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN.
prideout added a commit that referenced this pull request Mar 3, 2021
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
prideout added a commit that referenced this pull request Mar 3, 2021
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
prideout added a commit that referenced this pull request Mar 3, 2021
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
prideout added a commit that referenced this pull request Mar 3, 2021
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
prideout added a commit that referenced this pull request Mar 3, 2021
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
prideout added a commit that referenced this pull request Mar 3, 2021
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
AdrianAtGoogle pushed a commit to AdrianAtGoogle/filament that referenced this pull request Mar 22, 2021
This adds a WebSockets server to filament-utils-android.

Unlike my first attempt (google#3599), this does not use a piping server and
is therefore much faster to use over a LAN. It also has lower user
friction because there is no need to touch a button in the app or
scan a QR code.
@romainguy romainguy deleted the pr/qrcode2 branch May 19, 2021 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants