Updated Input Sample - #1043
Conversation
|
Here is the summary of changes. You are about to add 4 region tags.
This comment is generated by snippet-bot.
|
| } finally { | ||
| projectedActivity.close() | ||
| } | ||
| } catch (e: Exception) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Looks much better! Left some comments. I also kickstarted the build process, but looks like the build failed...
(Hopefully have setup the CLA properly?)
Removed the previous input sample project and added a simpler snippet. Let me know if this suffices.