List of usage examples for android.content.res Configuration SCREENLAYOUT_SIZE_MASK
int SCREENLAYOUT_SIZE_MASK
To view the source code for android.content.res Configuration SCREENLAYOUT_SIZE_MASK.
Click Source Link
From source file:com.dish.browser.activity.BrowserActivity.java
private boolean isTablet() { return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; }
From source file:android.support.v7.app.AppCompatDelegateImplV7.java
private void openPanel(final PanelFeatureState st, KeyEvent event) { // Already open, return if (st.isOpen || isDestroyed()) { return;//w ww . ja v a 2 s .com } // Don't open an options panel for honeycomb apps on xlarge devices. // (The app should be using an action bar for menu items.) if (st.featureId == FEATURE_OPTIONS_PANEL) { Context context = mContext; Configuration config = context.getResources().getConfiguration(); boolean isXLarge = (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; boolean isHoneycombApp = context .getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.HONEYCOMB; if (isXLarge && isHoneycombApp) { return; } } Window.Callback cb = getWindowCallback(); if ((cb != null) && (!cb.onMenuOpened(st.featureId, st.menu))) { // Callback doesn't want the menu to open, reset any state closePanel(st, true); return; } final WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); if (wm == null) { return; } // Prepare panel (should have been done before, but just in case) if (!preparePanel(st, event)) { return; } int width = WRAP_CONTENT; if (st.decorView == null || st.refreshDecorView) { if (st.decorView == null) { // Initialize the panel decor, this will populate st.decorView if (!initializePanelDecor(st) || (st.decorView == null)) return; } else if (st.refreshDecorView && (st.decorView.getChildCount() > 0)) { // Decor needs refreshing, so remove its views st.decorView.removeAllViews(); } // This will populate st.shownPanelView if (!initializePanelContent(st) || !st.hasPanelItems()) { return; } ViewGroup.LayoutParams lp = st.shownPanelView.getLayoutParams(); if (lp == null) { lp = new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); } int backgroundResId = st.background; st.decorView.setBackgroundResource(backgroundResId); ViewParent shownPanelParent = st.shownPanelView.getParent(); if (shownPanelParent != null && shownPanelParent instanceof ViewGroup) { ((ViewGroup) shownPanelParent).removeView(st.shownPanelView); } st.decorView.addView(st.shownPanelView, lp); /* * Give focus to the view, if it or one of its children does not * already have it. */ if (!st.shownPanelView.hasFocus()) { st.shownPanelView.requestFocus(); } } else if (st.createdPanelView != null) { // If we already had a panel view, carry width=MATCH_PARENT through // as we did above when it was created. ViewGroup.LayoutParams lp = st.createdPanelView.getLayoutParams(); if (lp != null && lp.width == ViewGroup.LayoutParams.MATCH_PARENT) { width = MATCH_PARENT; } } st.isHandled = false; WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, WRAP_CONTENT, st.x, st.y, WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, PixelFormat.TRANSLUCENT); lp.gravity = st.gravity; lp.windowAnimations = st.windowAnimations; wm.addView(st.decorView, lp); st.isOpen = true; }
From source file:com.androidaq.AndroiDAQMain.java
@Override public void openOptionsMenu() { Configuration config = getResources().getConfiguration(); if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) > Configuration.SCREENLAYOUT_SIZE_LARGE) { int originalScreenLayout = config.screenLayout; config.screenLayout = Configuration.SCREENLAYOUT_SIZE_LARGE; super.openOptionsMenu(); config.screenLayout = originalScreenLayout; } else {/*from w w w . ja v a2s. c o m*/ super.openOptionsMenu(); } }
From source file:com.sonymobile.android.media.testmediaplayer.MainActivity.java
public boolean navigationBarAtBottom() { return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE && getResources().getString(R.string.screen_type).equals("tablet"); }
From source file:at.alladin.rmbt.android.main.RMBTMainMenuFragment.java
/** * /*from w w w. j a v a 2 s .com*/ * @return */ public boolean onBackPressed() { int screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; if (infoOverlay.getVisibility() == View.VISIBLE && screenSize < Configuration.SCREENLAYOUT_SIZE_LARGE) { infoOverlay.setVisibility(View.GONE); return true; } return false; }
From source file:org.mozilla.gecko.GeckoAppShell.java
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; }/*from w w w.j av a 2 s .com*/ } return false; }
From source file:org.smilec.smile.student.CourseList.java
void setWebviewFontSize(WebView view) { WebSettings webSettings = view.getSettings(); //Determine screen size xlarge 720x960 dp units if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) { // 480x640 dp units //Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show(); webSettings.setTextSize(WebSettings.TextSize.LARGER); } /*//from ww w . j a v a 2 s . co m else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) { // 320x470 dp units mobile phone Toast.makeText(this, "Normal sized screen" , Toast.LENGTH_LONG).show(); } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) { // 320x426 dp units Toast.makeText(this, "Small sized screen" , Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, "Screen size is neither large, normal or small" , Toast.LENGTH_LONG).show(); }*/ }
From source file:com.skytree.epubtest.BookViewActivity.java
public boolean isTablet() { return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; }
From source file:com.codename1.impl.android.AndroidImplementation.java
public boolean isTablet() { return (getContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; }