Skip to content

Commit

Permalink
Chrome For Android bug workaround.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisjzh committed Apr 16, 2012
1 parent 4c95a66 commit c138b79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/com/gwtmobile/ui/client/page/Page.java
Expand Up @@ -216,7 +216,10 @@ private static void setPageResolution() {
Document.get().getDocumentElement().setClassName("WVGA"); Document.get().getDocumentElement().setClassName("WVGA");
} else if (ratio == 0.75) { } else if (ratio == 0.75) {
Document.get().getDocumentElement().setClassName("QVGA"); Document.get().getDocumentElement().setClassName("QVGA");
} else { } else if (ratio == 1 && Utils.isMobileChrome()) { //Chrome for Android bug?
Document.get().getDocumentElement().setClassName("WXGA");
}
else {
Document.get().getDocumentElement().setClassName("HVGA"); Document.get().getDocumentElement().setClassName("HVGA");
} }
} }
Expand Down
5 changes: 5 additions & 0 deletions src/com/gwtmobile/ui/client/utils/Utils.java
Expand Up @@ -104,6 +104,11 @@ public static boolean isAndroid() {
return Window.Navigator.getUserAgent().contains("Android"); return Window.Navigator.getUserAgent().contains("Android");
} }


public static boolean isMobileChrome() {
return isAndroid() &&
Window.Navigator.getUserAgent().contains("CrMo");
}

public static boolean isIOS() { public static boolean isIOS() {
String ua = Window.Navigator.getUserAgent(); String ua = Window.Navigator.getUserAgent();
return ua.contains("iPhone") || return ua.contains("iPhone") ||
Expand Down

0 comments on commit c138b79

Please sign in to comment.