Fix the layout error in preview

This bug is caused by view configuration and layout rect occasionally
out of sync and bottom bar's incapability of correcting itself. To
be specific, configuration can be out of sync with layout rect (i.e.
configuration.orientation is landscape but onLayout() passes in portrait
coordinates), but when that happens, configuration will soon correct
itself through onConfigurationChanged(), then another layout pass will
happen to make sure everything is laid out correctly. In this case,
when configuration and layout coordinates are inconsistent, bottom bar
lays out itself using the wrong alignment, and then changed the preview
rect accordingly. When another layout pass happens to correct this
inconsistency, bottom bar then lays out itself based on the correct
alignment and a wrong preview rect previously adjusted, rendering
correct alignment but wrong size.

Bug: 13911202
Change-Id: I7cf6dbea582ce3888df11039de8f94687fe75784
2 files changed