Example usage for android.content.res Configuration ORIENTATION_SQUARE

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

Introduction

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

Prototype

int ORIENTATION_SQUARE

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

Click Source Link

Usage

From source file:com.zephyrteam.costituzione.DetailedActivity.java

public void heuristicSetTytle(Configuration config) {
    if (mIsTablet) {
        setTitle(R.string.app_name);// ww  w.  j a v  a  2s  .  c o m
    } else {
        int orientation = config.orientation;
        switch (orientation) {
        case Configuration.ORIENTATION_LANDSCAPE:
        case Configuration.ORIENTATION_SQUARE:
            setTitle(R.string.app_name);
            break;
        case Configuration.ORIENTATION_PORTRAIT:
            setTitle(null);
            break;
        default:
            setTitle(R.string.app_name);
            break;
        }
    }
}

From source file:com.gnufabio.costituzione.DetailedActivity.java

@SuppressWarnings("deprecation")
public void heuristicSetTytle(Configuration config) {
    if (mIsTablet) {
        setTitle(R.string.app_name);/*from w ww  .  j a  v a2  s. com*/
    } else {
        int orientation = config.orientation;
        switch (orientation) {
        case Configuration.ORIENTATION_LANDSCAPE:
        case Configuration.ORIENTATION_SQUARE:
            setTitle(R.string.app_name);
            break;
        case Configuration.ORIENTATION_PORTRAIT:
            setTitle(null);
            break;
        default:
            setTitle(R.string.app_name);
            break;
        }
    }
}

From source file:com.tdispatch.passenger.core.TDApplication.java

@SuppressWarnings("deprecation")
protected void initEnvInfo() {

    DisplayMetrics dm = getResources().getDisplayMetrics();

    String orientation = "???";
    switch (getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        orientation = "Landscape";
        break;/*from w  w w  .  j av a2 s. co  m*/
    case Configuration.ORIENTATION_PORTRAIT:
        orientation = "Portrait";
        break;
    case Configuration.ORIENTATION_SQUARE:
        orientation = "Square";
        break;
    case Configuration.ORIENTATION_UNDEFINED:
        orientation = "Undef";
        break;
    default:
        orientation = "Unknown";
        break;
    }

    try {
        mEnvInfoJson.put("type", isTablet() ? "tablet" : "phone");
        mEnvInfoJson.put("build_manufacturer", Build.MANUFACTURER);
        mEnvInfoJson.put("build_model", Build.MODEL);
        mEnvInfoJson.put("build_board", Build.BOARD);
        mEnvInfoJson.put("build_device", Build.DEVICE);
        mEnvInfoJson.put("build_product", Build.PRODUCT);
        mEnvInfoJson.put("api", Build.VERSION.SDK_INT + " (" + Build.VERSION.RELEASE + ")");
        mEnvInfoJson.put("screen",
                dm.widthPixels + "x" + dm.heightPixels + " (" + dm.densityDpi + "DPI) " + orientation);

        mEnvInfoJson.put("locale", Locale.getDefault());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:count.ly.messaging.CrashDetails.java

/**
 * Returns the current device orientation.
 *///from w w w  .j av  a 2  s .  c om
static String getOrientation(Context context) {
    int orientation = context.getResources().getConfiguration().orientation;
    switch (orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        return "Landscape";
    case Configuration.ORIENTATION_PORTRAIT:
        return "Portrait";
    case Configuration.ORIENTATION_SQUARE:
        return "Square";
    case Configuration.ORIENTATION_UNDEFINED:
        return "Unknown";
    default:
        return null;
    }
}

From source file:com.codename1.impl.android.AndroidImplementation.java

public boolean isPortrait() {
    int orientation = getContext().getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_UNDEFINED || orientation == Configuration.ORIENTATION_SQUARE) {
        return super.isPortrait();
    }/*from   ww w .jav  a  2s . c o  m*/
    return orientation == Configuration.ORIENTATION_PORTRAIT;
}