List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_BEHIND
int SCREEN_ORIENTATION_BEHIND
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_BEHIND.
Click Source Link
behind
in the android.R.attr#screenOrientation attribute. From source file:de.limexcomputer.cordova.plugin.rotationlock.RotationLock.java
/** * Executes the request.//from ww w . j ava2s . c o m * * This method is called from the WebView thread. * To do a non-trivial amount of work, use: * cordova.getThreadPool().execute(runnable); * * To run on the UI thread, use: * cordova.getActivity().runOnUiThread(runnable); * * @param action The action to execute. * @param args The exec() arguments in JSON form. * @param callback The callback context used when calling back into JavaScript. * @return Whether the action was valid. */ @Override public boolean execute(String action, JSONArray args, CallbackContext callback) throws JSONException { if (!action.equalsIgnoreCase("setOrientation")) { return false; } String orientation = args.optString(0); Activity activity = this.cordova.getActivity(); // refer to https://github.com/their/pg-plugin-screen-orientation/blob/master/src/ScreenOrientation.java if (orientation.equals(UNSPECIFIED)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(USER)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); } else if (orientation.equals(BEHIND)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND); } else if (orientation.equals(SENSOR)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else if (orientation.equals(NOSENSOR)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } else if (orientation.equals(SENSOR_LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(SENSOR_PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(REVERSE_LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(REVERSE_PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } else if (orientation.equals(FULL_SENSOR)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); } callback.success(orientation); return true; }
From source file:org.apache.cordova.screenorientation.ScreenOrientation.java
public int getOrientation(String orientation) { if (orientation.equals(UNSPECIFIED)) { return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(USER)) { return (ActivityInfo.SCREEN_ORIENTATION_USER); } else if (orientation.equals(BEHIND)) { return (ActivityInfo.SCREEN_ORIENTATION_BEHIND); } else if (orientation.equals(SENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else if (orientation.equals(NOSENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } else if (orientation.equals(SENSOR_LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(SENSOR_PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(REVERSE_LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(REVERSE_PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } else if (orientation.equals(FULL_SENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); }//from w ww . jav a 2 s. c om return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); }
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 w w . j a va 2 s . co 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./* w w w . j av a2 s.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); } }