Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_LOCKED

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

Introduction

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

Prototype

int SCREEN_ORIENTATION_LOCKED

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

Click Source Link

Document

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

Usage

From source file:cl.gisred.android.InspActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (savedInstanceState.containsKey("Uri")) {
        mImageUri = Uri.parse(savedInstanceState.getString("Uri"));
    }//from   w w w. ja va2 s . c  om
    if (savedInstanceState.containsKey("req")) {
        int req = (int) savedInstanceState.get("req");
        if (req == ActivityInfo.SCREEN_ORIENTATION_LOCKED)
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
    }
}

From source file:cl.gisred.android.InspActivity.java

private void tomarFoto(String name) {
    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    File photo = null;//from  w  w w  .  j a  v a 2  s  . c  o m
    try {
        // place where to store camera taken picture
        photo = PhotoUtils.createFile(name, "jpg", InspActivity.this);
        photo.delete();
    } catch (Exception e) {
        Log.v(getClass().getSimpleName(), "Can't create file to take picture!");
    }
    mImageUri = Uri.fromFile(photo);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri);
    intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LOCKED);
    startActivityForResult(intent, ACTIVITY_SELECT_FROM_CAMERA);
}

From source file:com.android.leanlauncher.LauncherTransitionable.java

public void lockScreenOrientation(int orientation) {
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        setRequestedOrientation(orientation);
    } else {//from   ww w. j  a  v  a 2s . c  o m
        //noinspection ResourceType
        setRequestedOrientation(orientation | ActivityInfo.SCREEN_ORIENTATION_LOCKED);
    }
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

public void lockScreenOrientation() {
    if (mRotationEnabled) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
            setRequestedOrientation(/*from w  w w  .  j  a  v  a 2  s . c  o  m*/
                    mapConfigurationOriActivityInfoOri(getResources().getConfiguration().orientation));
        } else {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
        }
    }
}

From source file:com.android.launcher3.Launcher.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public void lockScreenOrientation() {
    if (mRotationEnabled) {
        if (Utilities.ATLEAST_JB_MR2) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
        } else {//from   ww  w .j a v  a 2 s.c  om
            setRequestedOrientation(
                    mapConfigurationOriActivityInfoOri(getResources().getConfiguration().orientation));
        }
    }
}