Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: ui/android/java/src/org/chromium/ui/UiUtils.java

Issue 229903003: Fix Android keyboard showing detection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/UiUtils.java
diff --git a/ui/android/java/src/org/chromium/ui/UiUtils.java b/ui/android/java/src/org/chromium/ui/UiUtils.java
index c9c7c0c80dd3fbd1dfcd6dd413d18a12041d6e95..6e6bf54784331764638baff1a54c14ab81cb2bd4 100644
--- a/ui/android/java/src/org/chromium/ui/UiUtils.java
+++ b/ui/android/java/src/org/chromium/ui/UiUtils.java
@@ -59,10 +59,10 @@ public class UiUtils {
if (rootView == null) return false;
Rect appRect = new Rect();
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;
- 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;
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698