Example usage for android.content.res Configuration SCREENLAYOUT_SIZE_LARGE

List of usage examples for android.content.res Configuration SCREENLAYOUT_SIZE_LARGE

Introduction

In this page you can find the example usage for android.content.res Configuration SCREENLAYOUT_SIZE_LARGE.

Prototype

int SCREENLAYOUT_SIZE_LARGE

To view the source code for android.content.res Configuration SCREENLAYOUT_SIZE_LARGE.

Click Source Link

Document

Constant for #screenLayout : a #SCREENLAYOUT_SIZE_MASK value indicating the screen is at least approximately 480x640 dp units, corresponds to the large resource qualifier.

Usage

From source file:Main.java

public static boolean isTablet(Context context) {
    int screenLayout = context.getResources().getConfiguration().screenLayout;
    return (screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

From source file:Main.java

public static boolean isTablet(Context context) {
    int s = context.getApplicationContext().getResources().getConfiguration().screenLayout;
    s &= Configuration.SCREENLAYOUT_SIZE_MASK;
    return s >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

From source file:Main.java

public static boolean isPhone(Activity context) {
    return ((context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) < Configuration.SCREENLAYOUT_SIZE_LARGE)
            || getPhysicalSize(context) < 6;
}

From source file:Main.java

public static boolean isTablet(Context context) {
    Configuration configuration = context.getResources().getConfiguration();
    return (configuration.screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

From source file:Main.java

public static boolean isTablet(Context context) {
    int screenLayoutMask = context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    return (screenLayoutMask == 4)// Configuration.SCREENLAYOUT_SIZE_XLARGE = 4
            || (screenLayoutMask == Configuration.SCREENLAYOUT_SIZE_LARGE);
}

From source file:Main.java

/**
 * returns true if screen is Xlarge so restricts orientation based on that
 * @param context//  w w w. j  ava2s . co m
 * @return
 */
public static boolean isScreenXLarge(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= (Configuration.SCREENLAYOUT_SIZE_LARGE);
}

From source file:Main.java

/**
 * Checks if current device is tablet.//from ww w . jav a2  s .co m
 * 
 * @param content
 * @return boolean
 */
@SuppressLint("InlinedApi")
public static boolean isTablet(Context content) {
    boolean large = ((content.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
    boolean xlarge = ((content.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE);
    return (large || xlarge);
}

From source file:Main.java

/**
 * Determining the current screen's size related to Large, XLarge or not.
 * //from   w w w . j av a2 s . co  m
 * @param context
 *            The Application Context.
 * @return boolean Type
 */
public static boolean isLargeOrXLarge(Context context) {
    int mask = (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK);
    return (mask == Configuration.SCREENLAYOUT_SIZE_XLARGE) || (mask == Configuration.SCREENLAYOUT_SIZE_LARGE);
}

From source file:Main.java

/**
 * Constant for screenLayout: bits that encode the size.
 * @param sl_size_mask "screenLayout & SCREENLAYOUT_SIZE_MASK"
 * @return Device type by screen size, "Handset" or "Tablet".
 *///from   w w w.ja va2 s  . co  m
public static String getDeviceTypeStr(int sl_size_mask) {
    switch (sl_size_mask) {
    case Configuration.SCREENLAYOUT_SIZE_SMALL://1
    case Configuration.SCREENLAYOUT_SIZE_NORMAL://2
        return "Handset";
    case Configuration.SCREENLAYOUT_SIZE_LARGE://3
    case Configuration.SCREENLAYOUT_SIZE_XLARGE://4
        return "Tablet";
    default:
        return UNKNOWN;
    }
}

From source file:Main.java

/**
 * Constant for screenLayout: bits that encode the size.
 * @param sl_size_mask "screenLayout & SCREENLAYOUT_SIZE_MASK"
 */// www.  j a  va  2  s .c o m
public static String getSLSizeMaskStr(int sl_size_mask) {
    switch (sl_size_mask) {
    case Configuration.SCREENLAYOUT_SIZE_UNDEFINED://0
        return "SCREENLAYOUT_SIZE_UNDEFINED";
    case Configuration.SCREENLAYOUT_SIZE_SMALL://1
        return "SCREENLAYOUT_SIZE_SMALL";
    case Configuration.SCREENLAYOUT_SIZE_NORMAL://2
        return "SCREENLAYOUT_SIZE_NORMAL";
    case Configuration.SCREENLAYOUT_SIZE_LARGE://3
        return "SCREENLAYOUT_SIZE_LARGE";
    case Configuration.SCREENLAYOUT_SIZE_XLARGE://4
        return "SCREENLAYOUT_SIZE_XLARGE";
    default:
        return UNKNOWN;
    }
}