Lauren Bricker
CSE 340 Spring 23
onDraw()
)onLayout()
or XML
)invalidate()
onDraw()
)onLayout()
or XML
)An event is a representation of user input
What do we need to know about each UI event?
What: Event Type (mouse moved, key down, etc)
Where: Event Target (the input component)
When: Timestamp (when did event occur)
Value: Mouse coordinates; which key; etc.
Context: Modifiers (Ctrl, Shift, Alt, etc); Number of clicks; etc.
Discuss each with examples
Which of the following does NOT generate an event?
A. Pressing the ALT key
B. Pressing the K key
C. Pressing your finger on the phone screen
D. Moving a mouse across the screen (on a computer)
Which of the following does NOT generate an event?
A. Pressing the ALT key
B. Pressing the K key
C. Pressing your finger on the phone screen
D. Moving a mouse across the screen (on a computer)
ALT does not generate an event (it is a modifier) Everything else does
onDraw()
)onLayout()
or XML
)An interactor hierarchy and the corresponding interface are shown to the left. If the user clicks on the image at (4,4) what will be the order of views in the filtered pick list? Assume that the drawing canvas does not accept touch input.
Nothing else is positionally associated
An interactor hierarchy and the corresponding interface are shown to the left. If the user clicks on the image at (4,4) what will be the order of views in the filtered pick list? Assume that the drawing canvas does not accept touch input.
Nothing else is positionally associated
true
vs false
)For the same image, what interactor will get the event first in Bubble?
For the same image, what interactor will get the event first in Bubble?
LineA, Black
For the same image, what interactor will get the event first in Bubble?
LineA, Black
Because it is the last thing (under the locator event) drawn (reflected in its position in the interactor hierarchy)
In which of the following situations is focus dispatch used during event handling, and in which is positional dispatch used?
onDraw()
)onLayout()
or XML
)Button
Scrollbar
Then from the PPS you can generate the code for this interactor.
Determine the Events (triggers)
Determine the States
Determine the Queries (essential geometry, context)
Determine the Actions
What constitutes an “event” varies
What is missing? Query fields
Note : This does not include the states if the mouse moves off the button while still the user still has the mouse button pressed.
onDraw()
)onLayout()
or XML
)View
View
) then delivers events that arrive at that View to those listenersView
is interacted with by the userView
can have listen for different types of interactionsThe toolkit has pre-defined interfaces so apps or components can respond to events such as clicks or touches.
// User tapped a viewpublic static interface View.OnClickListener { ... }// User long pressed on a Viewpublic static interface View.OnLongClickListener { ... }// State of view has changed// (e.g. user clicked outside a EditText input box)public static interface View.OnFocusChangeListener { ... }// user typed somethingpublic static interface View.OnKeyListener { ... }
Some callbacks are
onCreate
, onResume
, ...)And ...
Goal: separation of the view from the underlying model (data)
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
s | Start & Stop the presentation timer |
t | Reset the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |