List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_REVERSE_PORTRAIT
int SCREEN_ORIENTATION_REVERSE_PORTRAIT
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_REVERSE_PORTRAIT.
Click Source Link
reversePortrait
in the android.R.attr#screenOrientation attribute. From source file:com.android.launcher2.Launcher.java
private int mapConfigurationOriActivityInfoOri(int configOri) { final Display d = getWindowManager().getDefaultDisplay(); int naturalOri = Configuration.ORIENTATION_LANDSCAPE; switch (d.getRotation()) { case Surface.ROTATION_0: case Surface.ROTATION_180: // We are currently in the same basic orientation as the natural orientation naturalOri = configOri;//w w w.j a va 2 s . c om break; case Surface.ROTATION_90: case Surface.ROTATION_270: // We are currently in the other basic orientation to the natural orientation naturalOri = (configOri == Configuration.ORIENTATION_LANDSCAPE) ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; break; } int[] oriMap = { ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE }; // Since the map starts at portrait, we need to offset if this device's natural orientation // is landscape. int indexOffset = 0; if (naturalOri == Configuration.ORIENTATION_LANDSCAPE) { indexOffset = 1; } return oriMap[(d.getRotation() + indexOffset) % 4]; }