Commit 007cdc1f authored by dtrainor@chromium.org's avatar dtrainor@chromium.org

Fix Android keyboard showing detection

Use the root view's height vs. the visible display frame instead of the screen
height.  This is because the window might not be the full size of the screen.

BUG=251343

Review URL: https://codereview.chromium.org/229903003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262913 0039d316-1c4b-4281-b951-d872f2087c98
parent 9dbe72c8
...@@ -59,10 +59,10 @@ public class UiUtils { ...@@ -59,10 +59,10 @@ public class UiUtils {
if (rootView == null) return false; if (rootView == null) return false;
Rect appRect = new Rect(); Rect appRect = new Rect();
rootView.getWindowVisibleDisplayFrame(appRect); rootView.getWindowVisibleDisplayFrame(appRect);
final float screenHeight = context.getResources().getDisplayMetrics().heightPixels;
final float bottomMargin = Math.abs(appRect.bottom - screenHeight);
final float density = context.getResources().getDisplayMetrics().density; final float density = context.getResources().getDisplayMetrics().density;
return bottomMargin > KEYBOARD_DETECT_BOTTOM_THRESHOLD_DP * density; final float bottomMarginDp = Math.abs(rootView.getHeight() - appRect.height()) / density;
return bottomMarginDp > KEYBOARD_DETECT_BOTTOM_THRESHOLD_DP;
} }
/** /**
......
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