Java Code Examples for android.content.res.Configuration#SCREENLAYOUT_SIZE_MASK

The following examples show how to use android.content.res.Configuration#SCREENLAYOUT_SIZE_MASK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java    From chips-input-layout with MIT License 5 votes vote down vote up
static int getNavBarHeight(Context c) {
    int result = 0;
    boolean hasMenuKey = ViewConfiguration.get(c).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

    if (!hasMenuKey && !hasBackKey) {
        // The device has a navigation bar
        final Resources res = c.getResources();
        final Configuration config = res.getConfiguration();

        int orientation = config.orientation;
        int resourceId;

        // Check if the device is a tablet
        if ((config.screenLayout&Configuration.SCREENLAYOUT_SIZE_MASK)
                >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
            resourceId = res.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT
                    ? "navigation_bar_height" : "navigation_bar_height_landscape",
                    "dimen", "android");
        } else {
            resourceId = res.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT
                    ? "navigation_bar_height" : "navigation_bar_width",
                    "dimen", "android");
        }

        if (resourceId > 0) {
            return res.getDimensionPixelSize(resourceId);
        }
    }
    return result;
}
 
Example 2
Source File: MainActivity.java    From Ecommerce-Morningmist-Android with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
public boolean isTablet(Context context) {
	boolean xlarge = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
	boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
	MLog.log("IS TABLET = " + (xlarge || large));
	return (xlarge || large);
}
 
Example 3
Source File: StatusUpdateService.java    From deskcon-android with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
           & Configuration.SCREENLAYOUT_SIZE_MASK)
           >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 4
Source File: SettingsActivity.java    From homeDash with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 5
Source File: SettingsActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 6
Source File: SkinDeviceUtils.java    From Android-skin-support with MIT License 4 votes vote down vote up
private static boolean _isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >=
            Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 7
Source File: QMUIDeviceHelper.java    From dapp-wallet-demo with Apache License 2.0 4 votes vote down vote up
private static boolean _isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >=
            Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 8
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
static public boolean isLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 9
Source File: ViewHelper.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isTablet(@NonNull Resources resources) {
    return (resources.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 10
Source File: HighlightImageView.java    From QuranAndroid with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 11
Source File: SettingsActivity.java    From privacy-friendly-weather with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 12
Source File: SettingsActivity.java    From privacy-friendly-food-tracker with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 13
Source File: MainActivity.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
public static boolean isTablet(Context context) {
	return (context.getResources().getConfiguration().screenLayout
			& Configuration.SCREENLAYOUT_SIZE_MASK)
			>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 14
Source File: SettingsActivity.java    From cashuwallet with MIT License 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 15
Source File: SettingsActivity.java    From NetworkMapper with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 16
Source File: Utils.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 17
Source File: DeviceUtils.java    From CoordinatorLayoutExample with Apache License 2.0 4 votes vote down vote up
private static boolean _isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >=
            Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
Example 18
Source File: SettingsActivity.java    From MensaGuthaben with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
    & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
Example 19
Source File: AptoideUtils.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
private static int getScreenSizeInt(Resources resources) {
  return resources.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
}
 
Example 20
Source File: EditActivity.java    From Swiftnotes with Apache License 2.0 2 votes vote down vote up
/**
 * Check if current device has tablet screen size or not
 * @param context current application context
 * @return true if device is tablet, false otherwise
 */
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout &
            Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}