Skip to content

Updated Input Sample - #1043

Merged
trambui09 merged 9 commits into
android:mainfrom
acianrice:main
Aug 28, 2026
Merged

Updated Input Sample#1043
trambui09 merged 9 commits into
android:mainfrom
acianrice:main

Conversation

@acianrice

Copy link
Copy Markdown
Contributor

(Hopefully have setup the CLA properly?)

Removed the previous input sample project and added a simpler snippet. Let me know if this suffices.

@acianrice
acianrice requested a review from a team as a code owner August 20, 2026 19:49
@snippet-bot

snippet-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 4 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

} finally {
projectedActivity.close()
}
} catch (e: Exception) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In coroutines, repeatOnLifecycle cancels its block by throwing a CancellationException when the lifecycle falls below the specified state (RESUMED). To enable coroutine cancellation, don't consume exceptions of type CancellationException (don't catch them, or rethrow them if caught) (https://developer.android.com/kotlin/coroutines/coroutines-best-practices#exceptions).

class MotionGestureInputSnippetActivity : ComponentActivity() {

override fun dispatchGenericMotionEvent(ev: MotionEvent): Boolean {
val actionName = when (ev.actionMasked) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could be helpful to clarify what these MotionEvents map to.
ACTION_DOWN : first contact with the glasses touchpad
ACTION_MOVE : contact moving across the glasses touchpad.
ACTION_UP : contact lifted from the glasses touchpad.

@trambui09 trambui09 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks much better! Left some comments. I also kickstarted the build process, but looks like the build failed...

Hoping the addition of the experimental API import and opt in fix the build issues? Having issues building anything locally today for some reason (even in other projects)
Hoping this finally works? I was able to successfully build it locally at least...
@trambui09
trambui09 enabled auto-merge (squash) August 28, 2026 16:59
@trambui09
trambui09 disabled auto-merge August 28, 2026 16:59
@trambui09
trambui09 self-requested a review August 28, 2026 16:59
@trambui09
trambui09 merged commit b026e52 into android:main Aug 28, 2026
10 checks passed
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.

3 participants