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

private static int getNavBarHeight(Context context) {
    boolean hasMenuKey = Build.VERSION.SDK_INT >= 14 && ViewConfiguration.get(context).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
    boolean hasNavBar = !hasMenuKey && !hasBackKey;

    if (hasNavBar) {
        boolean isPortrait = context.getResources()
                .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;

        boolean isTablet = (context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;

        String key = isPortrait ? "navigation_bar_height"
                : (isTablet ? "navigation_bar_height_landscape" : null);

        return key == null ? 0 : getDimenSize(context, key);
    } else {//from   ww w . ja v  a 2  s. c  o m
        return 0;
    }
}

From source file:Main.java

/**
 * Determine if the device is a tablet (i.e. it has a large screen).
 * /*from  w w w . j  ava2s . co  m*/
 * @param context
 *            The calling context.
 */
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

From source file:net.mm2d.dmsexplorer.SettingsActivity.java

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

From source file:Main.java

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

From source file:com.near.chimerarevo.fragments.AboutContainerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.about_container_layout, container, false);

    boolean isLandscapeLarge = false;

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE)
            isLandscapeLarge = true;/*from   w w  w  .j  a va  2s . c o  m*/
    } else
        isLandscapeLarge = false;

    if (!isLandscapeLarge)
        v.setPadding(0, getResources().getDimensionPixelSize(R.dimen.actionbar_height), 0, 0);

    ViewPager pager = (ViewPager) v.findViewById(R.id.view_pager);
    pager.setAdapter(new AboutPagerAdapter());

    return v;
}

From source file:whipkey.stemesteem.components.EndingListFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {/*from   w w w. j a v  a2  s.  co m*/
        dialogClickListener = (DialogItemClickListener) activity;
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) < Configuration.SCREENLAYOUT_SIZE_LARGE) {
            i = activity.getIntent();
            b = i.getExtras();
        } // the above is skipped if we are on a large/xlarge device,
          // because we have no intent (one activity, not two).

    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + "needs to implement DialogClickListener");
    }
}

From source file:de.da_sense.moses.client.DetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // check orientation and screen size
    // only for devices with API Level 11 or higher
    if (isAtLeastHoneycomb()
            && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
            && getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE)) {
        Log.d("DetailActivity", "orientation = landscape");
        Log.d("DetailActivity", "layout at least size large");
        // If the screen is now in landscape mode, we can show the
        // dialog in-line with the list so we don't need this activity.
        finish();//w w w  . j a v a 2 s .  com
        return;
    }

    // get the Detail Fragment to check later if it is null or not
    DetailFragment details = null;

    Log.d("DetailActivity", "savedInstanceState == null || details == null");
    // during initial setup plug in the detail fragment
    details = new DetailFragment();
    details.setRetainInstance(true);
    details.setArguments(getIntent().getExtras());
    getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit();

    // get ActionBar and set AppIcon to direct to the "home screen"
    ActionBar ab = getActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
}

From source file:com.near.chimerarevo.fragments.WebFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.webview_layout, container, false);

    boolean isLandscapeLarge = false;

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE)
            isLandscapeLarge = true;//from ww  w  .ja va 2 s .c o m
    } else
        isLandscapeLarge = false;

    if (!isLandscapeLarge)
        v.setPadding(0, getResources().getDimensionPixelSize(R.dimen.actionbar_height), 0, 0);

    mWebView = (WebView) v.findViewById(R.id.webview);
    mProgressContainer = v.findViewById(R.id.progressContainer);
    mWebContainer = v.findViewById(R.id.webViewContainer);

    return v;
}

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  ww. j  a v  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();
}

From source file:ch.rts.cordova.is.tablet.IsTablet.java

private boolean isTabletDevice(Context applicationContext) {
    boolean device_large = ((applicationContext.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE);

    if (device_large) {
        DisplayMetrics metrics = new DisplayMetrics();
        Activity activity = this.cordova.getActivity();
        activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);

        if (metrics.densityDpi == DisplayMetrics.DENSITY_DEFAULT
                || metrics.densityDpi == DisplayMetrics.DENSITY_HIGH
                || metrics.densityDpi == DisplayMetrics.DENSITY_MEDIUM
                || metrics.densityDpi == DisplayMetrics.DENSITY_TV
                || metrics.densityDpi == DisplayMetrics.DENSITY_XHIGH) {
            Log.d(LOG_TAG, "Is Tablet Device");
            return true;
        }/*from ww  w  . jav  a  2s.  com*/
    }
    Log.d(LOG_TAG, "Is NOT Tablet Device");
    return false;
}