Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_USER

List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_USER

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_USER.

Prototype

int SCREEN_ORIENTATION_USER

To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_USER.

Click Source Link

Document

Constant corresponding to user in the android.R.attr#screenOrientation attribute.

Usage

From source file:org.zywx.wbpalmstar.engine.EBrowserActivity.java

private int getOrientationForRotation() {
    int ori = ActivityInfo.SCREEN_ORIENTATION_USER;
    int rotation = this.getWindowManager().getDefaultDisplay().getRotation();
    if (rotation == Surface.ROTATION_0) {
        ori = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else if (rotation == Surface.ROTATION_90) {
        ori = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (rotation == Surface.ROTATION_180) {
        ori = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    } else if (rotation == Surface.ROTATION_270) {
        ori = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    }/*from w w  w  .  ja v  a2 s  . c  om*/
    return ori;
}

From source file:org.zywx.wbpalmstar.engine.EBrowserActivity.java

public final int intoOrientation(int flag) {
    int or = ActivityInfo.SCREEN_ORIENTATION_USER;
    if (flag == 1) {// portrait
        or = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else if (flag == 2) {// landscape
        or = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (flag == 4) {// reverse portrait
        or = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    } else if (flag == 8) {// reverse landscape
        or = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    } else if (flag == 15) {// sensor
        or = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
    } else {/*from   w  w w  . jav a 2 s  . com*/
        ;
    }
    return or;
}

From source file:com.google.appinventor.components.runtime.Form.java

/**
 * The requested screen orientation. Commonly used values are
    unspecified (-1), landscape (0), portrait (1), sensor (4), and user (2).  " +
    "See the Android developer documentation for ActivityInfo.Screen_Orientation for the " +
    "complete list of possible settings.
 *
 * ScreenOrientation property getter method.
 *
 * @return  screen orientation/*from   w ww .j av a 2 s  .c o m*/
 */
@SimpleProperty(category = PropertyCategory.APPEARANCE, description = "The requested screen orientation, specified as a text value.  "
        + "Commonly used values are " + "landscape, portrait, sensor, user and unspecified.  "
        + "See the Android developer documentation for ActivityInfo.Screen_Orientation for the "
        + "complete list of possible settings.")
public String ScreenOrientation() {
    switch (getRequestedOrientation()) {
    case ActivityInfo.SCREEN_ORIENTATION_BEHIND:
        return "behind";
    case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
        return "landscape";
    case ActivityInfo.SCREEN_ORIENTATION_NOSENSOR:
        return "nosensor";
    case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
        return "portrait";
    case ActivityInfo.SCREEN_ORIENTATION_SENSOR:
        return "sensor";
    case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED:
        return "unspecified";
    case ActivityInfo.SCREEN_ORIENTATION_USER:
        return "user";
    case 10: // ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
        return "fullSensor";
    case 8: // ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
        return "reverseLandscape";
    case 9: // ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
        return "reversePortrait";
    case 6: // ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
        return "sensorLandscape";
    case 7: // ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
        return "sensorPortrait";
    }

    return "unspecified";
}

From source file:com.google.appinventor.components.runtime.Form.java

/**
 * ScreenOrientation property setter method: sets the screen orientation for
 * the form./*from   w  w w  .  j  a  v  a2s . c o  m*/
 *
 * @param screenOrientation  the screen orientation as a string
 */
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_SCREEN_ORIENTATION, defaultValue = "unspecified")
@SimpleProperty(category = PropertyCategory.APPEARANCE)
public void ScreenOrientation(String screenOrientation) {
    if (screenOrientation.equalsIgnoreCase("behind")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND);
    } else if (screenOrientation.equalsIgnoreCase("landscape")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (screenOrientation.equalsIgnoreCase("nosensor")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    } else if (screenOrientation.equalsIgnoreCase("portrait")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else if (screenOrientation.equalsIgnoreCase("sensor")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    } else if (screenOrientation.equalsIgnoreCase("unspecified")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else if (screenOrientation.equalsIgnoreCase("user")) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
    } else if (SdkLevel.getLevel() >= SdkLevel.LEVEL_GINGERBREAD) {
        if (screenOrientation.equalsIgnoreCase("fullSensor")) {
            setRequestedOrientation(10); // ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
        } else if (screenOrientation.equalsIgnoreCase("reverseLandscape")) {
            setRequestedOrientation(8); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
        } else if (screenOrientation.equalsIgnoreCase("reversePortrait")) {
            setRequestedOrientation(9); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
        } else if (screenOrientation.equalsIgnoreCase("sensorLandscape")) {
            setRequestedOrientation(6); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
        } else if (screenOrientation.equalsIgnoreCase("sensorPortrait")) {
            setRequestedOrientation(7); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
        } else {
            dispatchErrorOccurredEvent(this, "ScreenOrientation",
                    ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION, screenOrientation);
        }
    } else {
        dispatchErrorOccurredEvent(this, "ScreenOrientation", ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION,
                screenOrientation);
    }
}

From source file:com.cognizant.trumobi.PersonaLauncher.java

private void changeOrientation(int type, boolean persistence) {
    if (!persistence) {
        switch (type) {
        case PersonaAlmostNexusSettingsHelper.ORIENTATION_SENSOR:
            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
            break;
        case PersonaAlmostNexusSettingsHelper.ORIENTATION_PORTRAIT:
            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
            break;
        case PersonaAlmostNexusSettingsHelper.ORIENTATION_LANDSCAPE:
            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            break;
        default:// w  w w  . java 2  s .com
            break;
        }
    } else {
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
}