Fix an issue where the selected bubble might move offscreen for IME

Check if the selected bubble is within the area where the expanded
view is and if it's not, cap the amount the bubbles translate so
that it remains in view.

Fixes a small issue where the padding should be added rather than
subtracted (due to changes from ag/17354481)

Bug: 227812332
Test: manual - increase IME height, have max bubbles on tablet, select
               the top-most bubble and bring up the IME
             => verify that the selected bubble remains on screen and
                the pointer is connected to the expanded view
Change-Id: I251875f13c439564c7db60ded080b8c62aa76cf6
1 file changed