Create InputDevice ViewBehavior
ViewBehavior will be a static inner class for InputDevice, providing View-related behaviors pertaining to an InputDevice. We have added an API in InputDevice to return its ViewBehavior. This will be helpful if different InputDevice properties affect the way an input- generated MotionEvent should be handled by a View. For example, we have implemented a "shouldSmoothScroll" API in this change. This API is to tell Views processing motions generated by the InputDevice to prefer animating scrolls caused by such motions, to deliver a better quality scrolling UX than compared to a regular scroll that jumps by X pixels in a single frame. Note that, a single ViewBehavior instance contains all behaviors for a single InputDevice. This is unlike the other inner static class of InputDevice: MotionRange. This decision of making a single ViewBehavior contain all behaviors is made because not all View behaviors may depend on source+axis (e.g. there could be a behavior that is globally applicable to the whole InputDevice). Bug: 246946631 Test: unit tests, manual Change-Id: I65cf7d6556e26d199c9021f53bdae183f21d3c6d
Loading
Please register or sign in to comment