Commit 038ddeca authored by Mehran Mahmoudi's avatar Mehran Mahmoudi Committed by Commit Bot

[TTS] Fix bug with IPH bubble position in Multiwindow mode

This CL fixes an issue that caused the In-Prodcut Help UI for Contextual
Search to appear at the bottom of the screen, over the Contextual Search
panel in multiwindow mode.

Bug: 794732
Change-Id: Ie9e83fe51621cd477502c851899dca7d68c333b0
Reviewed-on: https://chromium-review.googlesource.com/830809Reviewed-by: default avatarDonn Denman <donnd@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524487}
parent a361f9f6
......@@ -611,14 +611,15 @@ public class ContextualSearchPanel extends OverlayPanel {
* the screen, in pixels.
*/
public Rect getPanelRect() {
Rect visibleDisplayFrame = new Rect();
mActivity.getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleDisplayFrame);
int[] contentLocationInWindow = new int[2];
mActivity.findViewById(android.R.id.content).getLocationInWindow(contentLocationInWindow);
int leftPadding = contentLocationInWindow[0];
int topPadding = contentLocationInWindow[1];
// getOffsetX() and getOffsetY() return the position of the panel relative to the activity,
// therefore visibleDisplayFrame.left and visibleDisplayFrame.top are added to get the
// position in the screen.
int left = (int) (getOffsetX() / mPxToDp) + visibleDisplayFrame.left;
int top = (int) ((getOffsetY()) / mPxToDp) + visibleDisplayFrame.top;
// therefore leftPadding and topPadding are added to get the position in the screen.
int left = (int) (getOffsetX() / mPxToDp) + leftPadding;
int top = (int) (getOffsetY() / mPxToDp) + topPadding;
int bottom = top + (int) (getBarHeight() / mPxToDp);
int right = left + (int) (getWidth() / mPxToDp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment