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:net.movelab.cmlibrary.MapMyData.java

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

    final int screenSize = getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    if (screenSize != Configuration.SCREENLAYOUT_SIZE_LARGE
            && screenSize != Configuration.SCREENLAYOUT_SIZE_XLARGE)
        requestWindowFeature(Window.FEATURE_NO_TITLE);

    // TODO add all of the alerts from countdown activity regarding sensors
    // off, sm off etc.

    Context context = getApplicationContext();
    PropertyHolder.init(context);/*  www  .j  ava  2 s .  c  om*/
    PowerSensor.init(context);

    if (Util.trafficCop(this))
        finish();

    if (!PropertyHolder.getInitialStartDateSet()) {
        Calendar now = Calendar.getInstance();
        now.setTimeInMillis(System.currentTimeMillis());
        PropertyHolder.setMapStartDate(now);
        PropertyHolder.setInitialStartDateSet(true);
    }

    minDist = Util.getMinDist();
    // Log.e("FixGet", "minDist=" + minDist);

    setContentView(R.layout.map_layout);
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    // pauseToggle = !PropertyHolder.isServiceOn();

    mPoints = new ArrayList<MapPoint>();

    myMapController = mapView.getController();
    myMapController.setZoom(15);

    progressbar = (ProgressBar) findViewById(R.id.mapProgressbar);
    progressbar.setProgress(0);

    progressbarText = (TextView) findViewById(R.id.progressBarLabel);

    progressNotificationArea = (LinearLayout) findViewById(R.id.mapProgressNotificationArea);

    receiverNotificationArea = (LinearLayout) findViewById(R.id.mapReceiverNotificationArea);

    mReceiversOffWarning = (TextView) findViewById(R.id.mapReceiversOffWarning);

    dateArea = (RelativeLayout) findViewById(R.id.dateArea);

    dateRangeText = (TextView) findViewById(R.id.dateSelectionText);

    dateRangeText.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent e) {

            if (e.getAction() == MotionEvent.ACTION_DOWN) {

                dateRangeText.setBackgroundResource(R.drawable.red_border_pressed);
            }
            if (e.getAction() == MotionEvent.ACTION_UP) {

                dateRangeText.setBackgroundResource(R.drawable.red_border);
            }

            return false;
        }

    });

    dateRangeText.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            Intent i = new Intent(MapMyData.this, Settings.class);
            i.putExtra(DATES_BUTTON_MESSAGE, true);
            startActivity(i);

        }

    });

    getIntro = PropertyHolder.getIntro();
    isPro = PropertyHolder.getProVersion();

    AppRater.app_launched(this);

    privacyZones = new ArrayList<GeoPoint>();

}

From source file:whipkey.stemesteem.main.StemEsteem.java

public void stemListItemClick(int weekNo, int stemNo, String stem) {
    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
        EndingListFragment f = (EndingListFragment) getSupportFragmentManager().findFragmentByTag("endingList");
        Bundle b = new Bundle();
        b.putInt("weekNo", weekNo);
        b.putInt("stemNo", stemNo);
        b.putString("stem", stem);
        f.setB(b);//ww w  .  jav  a 2 s.  c  o  m
        f.fillData();

    } else {
        Intent showEndings = new Intent(getApplicationContext(), EndingListActivity.class);
        showEndings.putExtra("weekNo", weekNo);
        showEndings.putExtra("stemNo", stemNo);
        showEndings.putExtra("stem", stem);
        startActivity(showEndings);
    }
}

From source file:com.mruddy.devdataviewer.DevDataListFragment.java

/**
 * @return//from   w w  w  .  ja va  2 s  .c  om
 */
@SuppressLint("NewApi")
private List<String> getDevDataList() {
    final List<String> result = new LinkedList<String>();
    final Display display = this.getActivity().getWindowManager().getDefaultDisplay();
    final DisplayMetrics appAreaDisplayMetrics = new DisplayMetrics();
    display.getMetrics(appAreaDisplayMetrics);
    result.add("API Level: " + Build.VERSION.SDK_INT);
    result.add("Android Release: " + Build.VERSION.RELEASE);
    if (Build.VERSION.SDK_INT >= 17) {
        final DisplayMetrics fullDisplayMetrics = new DisplayMetrics();
        display.getRealMetrics(fullDisplayMetrics);
        result.add("Full Width (px): " + fullDisplayMetrics.widthPixels);
        result.add("Full Height (px): " + fullDisplayMetrics.heightPixels);
        result.add("Full Width (dp): " + ((int) (fullDisplayMetrics.widthPixels / fullDisplayMetrics.density)));
        result.add(
                "Full Height (dp): " + ((int) (fullDisplayMetrics.heightPixels / fullDisplayMetrics.density)));
    }
    result.add("App Area Width (px): " + appAreaDisplayMetrics.widthPixels);
    result.add("App Area Height (px): " + appAreaDisplayMetrics.heightPixels);
    result.add("App Area Width (dp): "
            + ((int) (appAreaDisplayMetrics.widthPixels / appAreaDisplayMetrics.density)));
    result.add("App Area Height (dp): "
            + ((int) (appAreaDisplayMetrics.heightPixels / appAreaDisplayMetrics.density)));
    result.add("dp Scaling Factor: " + appAreaDisplayMetrics.density);
    final String densityBucket = DevDataListFragment.DENSITY_BUCKETS.get(appAreaDisplayMetrics.densityDpi);
    result.add("Density Bucket: " + (null != densityBucket ? densityBucket : "other") + " ("
            + appAreaDisplayMetrics.densityDpi + ")");
    result.add("Actual xdpi: " + appAreaDisplayMetrics.xdpi);
    result.add("Actual ydpi: " + appAreaDisplayMetrics.ydpi);
    if (Build.VERSION.SDK_INT >= 8) {
        final String rotation = DevDataListFragment.ROTATION.get(display.getRotation());
        result.add("Rotation: " + (null != rotation ? rotation : "other (" + display.getRotation() + ")"));
    }
    final String orientation = DevDataListFragment.ORIENTATION
            .get(this.getResources().getConfiguration().orientation);
    result.add("Orientation: " + (null != orientation ? orientation
            : "other (" + this.getResources().getConfiguration().orientation + ")"));
    final int screenSizeKey = this.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    final String screenSizeBucket = DevDataListFragment.SCREEN_SIZE_BUCKETS.get(screenSizeKey);
    result.add(
            "Size Bucket: " + (null != screenSizeBucket ? screenSizeBucket : "other (" + screenSizeKey + ")"));
    return result;
}

From source file:net.olejon.mdapp.MyTools.java

public boolean isTablet() {
    int size = mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;

    return ((size) == Configuration.SCREENLAYOUT_SIZE_LARGE
            || (size) == Configuration.SCREENLAYOUT_SIZE_XLARGE);
}

From source file:piuk.blockchain.android.ui.WalletActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    ErrorReporter.getInstance().check(this);

    setContentView(R.layout.wallet_content);

    final ActionBarFragment actionBar = getActionBar();

    actionBar.setPrimaryTitle(R.string.app_name);

    actionBar.getPrimaryTitleView().setOnClickListener(new OnClickListener() {
        public void onClick(final View v) {
            WelcomeFragment.show(getSupportFragmentManager());
        }/*  w  ww  . j  a  v  a 2 s .c  o m*/
    });

    actionBar.addButton(R.drawable.ic_action_send).setOnClickListener(new OnClickListener() {
        public void onClick(final View v) {
            startActivity(new Intent(WalletActivity.this, SendCoinsActivity.class));
        }
    });

    actionBar.addButton(R.drawable.ic_action_receive).setOnClickListener(new OnClickListener() {
        public void onClick(final View v) {
            startActivity(new Intent(WalletActivity.this, RequestCoinsActivity.class));
        }
    });

    infoButton = actionBar.addButton(R.drawable.ic_action_info);

    infoButton.setOnClickListener(new OnClickListener() {
        public void onClick(final View v) {
            WalletApplication application = (WalletApplication) getApplication();

            Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("https://blockchain.info/wallet/iphone-view?guid="
                            + application.getRemoteWallet().getGUID() + "&sharedKey="
                            + application.getRemoteWallet().getSharedKey()));

            startActivity(browserIntent);
        }
    });

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
        actionBar.addButton(R.drawable.ic_action_address_book).setOnClickListener(new OnClickListener() {
            public void onClick(final View v) {
                WalletAddressesActivity.start(WalletActivity.this, true);
            }
        });
    }

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) < Configuration.SCREENLAYOUT_SIZE_LARGE) {
        final FragmentManager fm = getSupportFragmentManager();
        final FragmentTransaction ft = fm.beginTransaction();
        ft.hide(fm.findFragmentById(R.id.exchange_rates_fragment));
        ft.commit();
    }

    checkVersionAndTimeskewAlert();

    checkDialogs();
}

From source file:tr.com.turkcellteknoloji.turkcellupdater.Utilities.java

@SuppressLint("NewApi")
static boolean isTablet(Context context) {
    if (android.os.Build.VERSION.SDK_INT > 12) {
        return context.getResources().getConfiguration().smallestScreenWidthDp > 600;
    } else if (android.os.Build.VERSION.SDK_INT > 10) {
        int size = context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK;
        return (size == Configuration.SCREENLAYOUT_SIZE_LARGE)
                || (size == Configuration.SCREENLAYOUT_SIZE_XLARGE);
    } else {//from w  ww. j a v a2  s.com
        return false;
    }
}

From source file:timer.com.maydaysdk.MayDayMessageChatFragment.java

private int getScreenResolution() {
    int screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
    int height;//from   w w  w .j a  v  a  2s.c om
    switch (screenSize) {
    case Configuration.SCREENLAYOUT_SIZE_LARGE:
        height = MayDayConstant.SIZE_LARGE;
        break;
    case Configuration.SCREENLAYOUT_SIZE_NORMAL:
        height = MayDayConstant.SIZE_NORMAL;
        break;
    case Configuration.SCREENLAYOUT_SIZE_SMALL:
        height = MayDayConstant.SIZE_SMALL;
        break;
    case Configuration.SCREENLAYOUT_SIZE_XLARGE:
        height = MayDayConstant.SIZE_XLARGE;
        break;
    default:
        height = MayDayConstant.SIZE_SMALL;
    }
    return height;
}

From source file:gov.cdc.epiinfo.RecordList.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 {// ww w .ja va 2 s  .c  om
        super.openOptionsMenu();
    }
}

From source file:org.jitsi.android.gui.util.AndroidUtils.java

/**
 * Returns <tt>true</tt> if we are currently running on tablet device.
 * @return <tt>true</tt> if we are currently running on tablet device.
 *///from w  ww .  ja  v a2s  .c  o  m
public static boolean isTablet() {
    Context context = JitsiApplication.getGlobalContext();

    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
            && (context.getResources().getConfiguration().screenLayout
                    & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

From source file:net.peterkuterna.android.apps.devoxxsched.util.UIUtils.java

public static boolean isHoneycombTablet(Context context) {
    // Can use static final constants like HONEYCOMB, declared in later
    // versions/* w w  w .j  a v  a  2  s  . co  m*/
    // of the OS since they are inlined at compile time. This is guaranteed
    // behavior.
    return isHoneycomb() && (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
}