Bug 708772 - (bustage fix) Add IsTablet method to AndroidBridge (merge to /mobile/android) [r=dougt a=ehsan]

This commit is contained in:
Matt Brubeck 2011-12-14 13:53:38 -08:00
parent 399e29abef
commit 71c22a0dd4

View File

@ -1550,6 +1550,19 @@ public class GeckoAppShell
GeckoSmsManager.send(aNumber, aMessage);
}
public static boolean isTablet() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
Configuration config = GeckoApp.mAppContext.getResources().getConfiguration();
// xlarge is defined by android as screens larger than 960dp x 720dp
// and should include most devices ~7in and up.
// http://developer.android.com/guide/practices/screens_support.html
if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE) {
return true;
}
}
return false;
}
public static void emitGeckoAccessibilityEvent (int eventType, String role, String text, String description, boolean enabled, boolean checked, boolean password) {
AccessibilityManager accessibilityManager =
(AccessibilityManager) GeckoApp.mAppContext.getSystemService(Context.ACCESSIBILITY_SERVICE);