|
|
@@ -52,6 +52,7 @@ public class BrowserInfo { |
|
|
|
} |
|
|
|
|
|
|
|
private VBrowserDetails browserDetails; |
|
|
|
private boolean touchDevice; |
|
|
|
|
|
|
|
private BrowserInfo() { |
|
|
|
browserDetails = new VBrowserDetails(getBrowserString()); |
|
|
@@ -63,8 +64,14 @@ public class BrowserInfo { |
|
|
|
browserDetails.setIEMode(documentMode); |
|
|
|
} |
|
|
|
} |
|
|
|
touchDevice = detectTouchDevice(); |
|
|
|
} |
|
|
|
|
|
|
|
private native boolean detectTouchDevice() |
|
|
|
/*-{ |
|
|
|
try { document.createEvent("TouchEvent");return true;} catch(e){return false;}; |
|
|
|
}-*/; |
|
|
|
|
|
|
|
private native int getIEDocumentMode() |
|
|
|
/*-{ |
|
|
|
var mode = $wnd.document.documentMode; |
|
|
@@ -337,4 +344,11 @@ public class BrowserInfo { |
|
|
|
|
|
|
|
}-*/; |
|
|
|
|
|
|
|
/** |
|
|
|
* @return true if the browser runs on a touch based device. |
|
|
|
*/ |
|
|
|
public boolean isTouchDevice() { |
|
|
|
return touchDevice; |
|
|
|
} |
|
|
|
|
|
|
|
} |