List of usage examples for android.content.res Configuration SCREENLAYOUT_SIZE_XLARGE
int SCREENLAYOUT_SIZE_XLARGE
To view the source code for android.content.res Configuration SCREENLAYOUT_SIZE_XLARGE.
Click Source Link
From source file:Main.java
public static boolean isXLargeDevice(Activity ctx) { int lt = (ctx.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK); return lt == Configuration.SCREENLAYOUT_SIZE_XLARGE; }
From source file:Main.java
/** * Determining the current screen's size related to Large, XLarge or not. * // w ww. j ava2s . c o 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
/** * Determines whether or not the device has an extra large screen. * * @param context The Android context./*from w ww . j av a2 s . com*/ * @return boolean value indicating if the screen size is extra large. */ public static boolean isExtraLargeScreen(Context context) { int screenSizeMask = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; if (screenSizeMask == Configuration.SCREENLAYOUT_SIZE_XLARGE) { return true; } else { return false; } }
From source file:Main.java
/** * Checks if current device is tablet.//from ww w.j av a2s . c o 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
/** * 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". *///ww w . j a v a 2 s . c o 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" *///from w w w . ja v a 2 s . com 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; } }
From source file:Main.java
/** * Determining the current screen's size is xlarge or not.. * //from w ww. j av a 2 s. c o m * @param context * The Application Context. * @return Boolean Type. */ public static boolean isXLarge(Context context) { return ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE); }
From source file:com.noshufou.android.su.AppDetailsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Configuration config = getResources().getConfiguration(); if (config.orientation == Configuration.ORIENTATION_LANDSCAPE && (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) { finish();/*from w w w .j a va 2 s . c om*/ return; } setContentView(R.layout.activity_app_details); if (savedInstanceState == null) { Fragment fragment = Fragment.instantiate(this, AppDetailsFragment.class.getName(), getIntent().getExtras()); getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit(); } }
From source file:com.iangclifton.auid.appendixc.sections.VariousDemosFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.various_demos, container, false); final StringBuilder sb = new StringBuilder(); // Create a String for the device physical size switch (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) { case Configuration.SCREENLAYOUT_SIZE_XLARGE: // Extra large (most 10" tablets) sb.append(getString(R.string.configuration_xlarge)); break;// w ww . j a v a 2s. c o m case Configuration.SCREENLAYOUT_SIZE_LARGE: // Large (most 7" tablets) sb.append(getString(R.string.configuration_large)); break; case Configuration.SCREENLAYOUT_SIZE_NORMAL: // Normal (most phones) sb.append(getString(R.string.configuration_normal)); break; case Configuration.SCREENLAYOUT_SIZE_SMALL: // Small (very uncommon) sb.append(getString(R.string.configuration_small)); break; default: sb.append(getString(R.string.configuration_unknown)); break; } sb.append('\n'); // Create a String for the display density switch (getResources().getDisplayMetrics().densityDpi) { case DisplayMetrics.DENSITY_XXHIGH: // Display is around 480 pixels per inch sb.append(getString(R.string.density_xxhdpi)); break; case DisplayMetrics.DENSITY_XHIGH: // Display is around 320 pixels per inch sb.append(getString(R.string.density_xhdpi)); break; case DisplayMetrics.DENSITY_HIGH: // Display is around 240 pixels per inch sb.append(getString(R.string.density_hdpi)); break; case DisplayMetrics.DENSITY_MEDIUM: // Display is around 160 pixels per inch sb.append(getString(R.string.density_mdpi)); break; case DisplayMetrics.DENSITY_LOW: // Display is around 120 pixels per inch sb.append(getString(R.string.density_ldpi)); break; case DisplayMetrics.DENSITY_TV: // Display is a 720p TV screen // Sometimes also used for 1280x720 7" tablets // Rarely should you ever specifically target this density sb.append(getString(R.string.density_tv)); break; default: sb.append(getString(R.string.density_unknown)); break; } sb.append('\n'); // Create a String for the thread we're on // Obviously this method is always called on the main thread but this technique can be used anywhere. if (Utils.isUiThread()) { // UI Thread sb.append(getString(R.string.main_thread_true)); } else { // Other Thread sb.append(getString(R.string.main_thread_false)); } sb.append(" (Thread name: ").append(Thread.currentThread().getName()).append(')'); // Set text final TextView tv = (TextView) rootView.findViewById(R.id.main_text); tv.setText(sb); return rootView; }
From source file:org.exoplatform.accountswitcher.AccountSwitcherActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean isDialog = false; // Detect the size of the screen and set a theme "Dialog" to display the // activity as a dialog // if the screen is LARGE or XLARGE // TODO find how to set the black background translucent int screenLayout = getResources().getConfiguration().screenLayout; screenLayout &= Configuration.SCREENLAYOUT_SIZE_MASK; if (screenLayout == Configuration.SCREENLAYOUT_SIZE_LARGE || screenLayout == Configuration.SCREENLAYOUT_SIZE_XLARGE) { setTheme(R.style.Theme_eXo_Dialog); isDialog = true;//from w w w .jav a 2 s . co m } Log.i(TAG, "Start account switcher in mode: " + (isDialog ? "dialog" : "activity")); setContentView(R.layout.account_switcher_activity); getSupportFragmentManager().beginTransaction().add(R.id.share_extension_fragment, new AccountSwitcherFragment(), AccountSwitcherFragment.FRAGMENT_TAG).commit(); }