Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR_PORTRAIT

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

Introduction

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

Prototype

int SCREEN_ORIENTATION_SENSOR_PORTRAIT

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

Click Source Link

Document

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

Usage

From source file:com.jp.miaulavirtual.DisplayMessageActivity.java

@SuppressWarnings("deprecation")
public void setRestrictedOrientation() {
    /* We don't want change screen orientation */
    //---get the current display info---
    WindowManager wm = getWindowManager();
    Display d = wm.getDefaultDisplay();/* w  ww  . ja va  2  s .  c  o m*/
    if (d.getWidth() > d.getHeight()) {
        //---change to landscape mode---
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {
        //---change to portrait mode---
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }
}

From source file:com.youku.player.base.YoukuBasePlayerActivity.java

@Override
public void land2Port() { //?
    if (!PreferenceUtil.getPreferenceBoolean(this, "video_lock", false)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }/*from  www .java  2s  .co  m*/
    Logger.d("lelouch", "land2Port");
}