DescriptionFixing image canvas resize problems when showing/hiding system UI.
The previous behavior for the image canvas was to allow the system to
resize the canvas based on the systemUI being displayed. The two
problems with this approach were that the canvas could receive mulitple
resize events as systemUI was hidden (resulting in a jerky resize of the
canvas) and that area beneath the system bars would not match the color
of the background (white vs. black) so that area would appear to flash.
On a fit and finish side, it was odd to have the canvas resize because
the ActionBar or navigation bar was displayed as these are transient UI
elements which are infrequently needed. I've also added an auto-hide
timer to hide the ActionBar after a period of inactivity.
To address these issues, I have updated the layout of the Desktop
activity such that the image canvas is effectively streched to fit the
screen and the /action/navigation/system UI is drawn over the top. This
removes the need for frequent resizing and results in a smoother
experience. The second change needed was to detect when the on screen
keyboard is present and shift the remote image canvas upwards to
accommodate the reduced screen size.
There is no straight-forward way to detect the OSK presence on Android
so my solution was to add a transparent UI element which is resized by
the system when systemUI is displayed and use an attached resize
listener to detect the new screen bounds. I then use this info to shift
the canvas appropriately. This mechanism will also allow us to display
adornments at the top of the on screen keyboard if necessary.
Note: This change is targeting KitKat and above as earlier API versions
do not support all of the flags needed to properly support this work.
BUG=548003
Committed: https://crrev.com/decde3542a6456595150345eb99e8afe705a3397
Cr-Commit-Position: refs/heads/master@{#357445}
Patch Set 1 #Patch Set 2 : Fixing some comment formatting. #
Total comments: 22
Patch Set 3 : Addressing feedback and removed previous formatting changes. #Patch Set 4 : Removing Hide action from ActionBar when autohide is enabled. #
Total comments: 7
Patch Set 5 : Addressing code review feedback #
Messages
Total messages: 12 (3 generated)
|