Example usage for android.content.res Configuration SCREENLAYOUT_SIZE_MASK

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

Introduction

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

Prototype

int SCREENLAYOUT_SIZE_MASK

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

Click Source Link

Document

Constant for #screenLayout : bits that encode the size.

Usage

From source file:com.near.chimerarevo.activities.PostContainerActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if ((newConfig.screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
            isLandscapeLarge = true;//from   w ww.ja  va 2s. com
        else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
            isLandscapeLarge = false;
    }
}

From source file:com.health.openscale.gui.OverviewFragment.java

@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
    super.setUserVisibleHint(isVisibleToUser);

    if (isVisibleToUser) {
        if ((getActivity().getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE
                && (getActivity().getResources().getConfiguration().screenLayout
                        & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE) {
            Activity a = getActivity();//from   ww  w. j  a v  a2 s .  c o  m
            if (a != null)
                a.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        }
    }
}

From source file:com.cypress.cysmart.HomePageActivity.java

/**
 * Method to detect whether the device is phone or tablet
 *//*from   w  w  w. j a v  a2 s .  co m*/
private static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

From source file:org.protocoderrunner.base.BaseActivity.java

public boolean isTablet() {
    boolean xlarge = ((this.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
    boolean large = ((this.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
    return (xlarge || large);
}

From source file:be.deadba.ampd.SettingsActivity.java

/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 *//* w  w w  .  jav  a2  s .c o  m*/
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

From source file:de.kartheininger.markerclustering.AbstractMapActivity.java

protected boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
    /* return getResources().getBoolean(R.bool.isTablet);*/
}

From source file:com.near.chimerarevo.activities.MainActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if ((newConfig.screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
            isLandscapeLarge = true;//from  www  .  j av a 2 s.  com
        else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
            isLandscapeLarge = false;
    }
    if (mDrawerLayout != null)
        mDrawerToggle.onConfigurationChanged(newConfig);
}

From source file:com.juick.android.JuickMessagesAdapter.java

private String getDefaultScale(Context context) {
    int screenSize = context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    if (screenSize == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        return "2.0";
    }/*from w  ww .java2 s.  c  o m*/
    if (screenSize == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        return "3.0";
    }
    return "1.0";
}

From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java

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

From source file:gr.scify.newsum.ui.ViewActivity.java

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

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    // Init custom category
    sCustomCategory = NewSumUiActivity.getAppContext(this).getResources().getString(R.string.custom_category);
    // Always select landscape orientation for big screens (?)
    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_NORMAL
            & (getResources().getConfiguration().screenLayout
                    & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_SMALL) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    }//  w  ww  .  ja  va 2  s  .c  om
    SharedPreferences usertheme = getSharedPreferences("theme", 0);
    int newTheme = usertheme.getInt("theme", 2);
    Utils.onActivityCreateSetTheme(this, newTheme);

}