List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE
int SCREEN_ORIENTATION_LANDSCAPE
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE.
Click Source Link
landscape
in the android.R.attr#screenOrientation attribute. From source file:cordova.plugins.screenorientation.CDVOrientation.java
private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) { String action = args.optString(0); String orientation = args.optString(1); Log.d(TAG, "Requested ScreenOrientation: " + orientation); Activity activity = cordova.getActivity(); if (orientation.equals(ANY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(LANDSCAPE_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(PORTRAIT_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); }//ww w. j a v a 2s . co m callbackContext.success(); return true; }
From source file:com.inovex.zabbixmobile.activities.GraphFullscreenActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { ZaxPreferences prefs = ZaxPreferences.getInstance(getApplicationContext()); if (prefs.isDarkTheme()) setTheme(R.style.AppThemeDark);/*from w w w . ja va2s . c om*/ else setTheme(R.style.AppTheme); requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) return; bindService(); mItemId = getIntent().getLongExtra("itemid", -1); mGraphId = getIntent().getLongExtra("graphid", -1); if (mItemId == -1 && mGraphId == -1) { finish(); return; } mLayout = new LinearLayout(this); setContentView(mLayout); }
From source file:net.yoik.cordova.plugins.screenorientation.YoikScreenOrientation.java
private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) { String action = args.optString(0); if (action.equals("set")) { String orientation = args.optString(1); Log.d(TAG, "Requested ScreenOrientation: " + orientation); Activity activity = cordova.getActivity(); if (orientation.equals(UNLOCKED)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(LANDSCAPE_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(PORTRAIT_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); }//www. j av a 2 s . c o m callbackContext.success(); return true; } else { callbackContext.error("ScreenOrientation not recognised"); return false; } }
From source file:net.libaier.chinesestringuppuzzle.ScreenSlideActivity.java
private void fullScreenAndLandscape() { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
From source file:org.linphone.setup.SetupActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getBoolean(R.bool.isTablet) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }//w w w .ja v a2 s. c om setContentView(R.layout.setup); firstFragment = getResources().getBoolean(R.bool.setup_use_linphone_as_first_fragment) ? SetupFragmentsEnum.LINPHONE_LOGIN : SetupFragmentsEnum.WELCOME; if (findViewById(R.id.fragmentContainer) != null) { if (savedInstanceState == null) { display(firstFragment); } else { currentFragment = (SetupFragmentsEnum) savedInstanceState.getSerializable("CurrentFragment"); } } mPrefs = LinphonePreferences.instance(); initUI(); mListener = new LinphoneCoreListenerBase() { @Override public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) { if (accountCreated) { if (address != null && address.asString().equals(cfg.getIdentity())) { if (state == RegistrationState.RegistrationOk) { if (LinphoneManager.getLc().getDefaultProxyConfig() != null) { launchEchoCancellerCalibration(true); } } else if (state == RegistrationState.RegistrationFailed) { Toast.makeText(SetupActivity.this, getString(R.string.first_launch_bad_login_password), Toast.LENGTH_LONG).show(); } } } } }; instance = this; }
From source file:br.org.funcate.dynamicforms.FormActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // make sure the orientation can't be changed once this activity started int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else {// w w w. j a v a 2s . c o m setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } Bundle extras = getIntent().getExtras(); if (extras != null) { sectionName = extras.getString(LibraryConstants.PREFS_KEY_FORM_NAME); sectionObjectString = extras.getString(LibraryConstants.PREFS_KEY_FORM_JSON); latitude = extras.getDouble(LibraryConstants.LATITUDE); longitude = extras.getDouble(LibraryConstants.LONGITUDE); elevation = extras.getDouble(LibraryConstants.ELEVATION); noteId = extras.getLong(LibraryConstants.SELECTED_POINT_ID); } try { if (sectionObjectString == null) { sectionObject = TagsManager.getInstance(this).getSectionByName(sectionName); // copy the section object, which will be kept around along the activity sectionObjectString = sectionObject.toString(); } sectionObject = new JSONObject(sectionObjectString); formNames4Section = TagsManager.getFormNames4Section(sectionObject); } catch (Exception e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } setContentView(R.layout.form); }
From source file:org.xwalk.runtime.extension.api.screenorientation.ScreenOrientationExtension.java
@Override public void onMessage(int instanceId, String message) { String value = getValueString(message, JS_VALUE_TYPE); if (value.isEmpty()) return;/*from w w w . ja va 2s.c om*/ int orientation; try { orientation = Integer.valueOf(value); } catch (Exception e) { e.printStackTrace(); return; } int screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; switch (orientation) { case ANY: case UA_DEFAULTS: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; break; } case LANDSCAPE_PRIMARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; break; } case PORTRAIT_PRIMARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; break; } case LANDSCAPE_SECONDARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; break; } case PORTRAIT_SECONDARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; break; } case LANDSCAPE: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; break; } case PORTRAIT: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; break; } default: Log.e(TAG, "Invalid orientation value."); return; } mExtensionContext.getActivity().setRequestedOrientation(screen_orientation_value); }
From source file:org.hw.parlance.SetupActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getBoolean(R.bool.isTablet) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }//from w ww. j a va2 s . co m setContentView(R.layout.setup); mPrefs = LinphonePreferences.instance(); btn_setup = (ImageButton) findViewById(R.id.btn_setup); btn_setup.setOnClickListener(this); instance = this; }
From source file:cz.babi.android.remoteme.ui.ActivityDialogListOfRemoteControllers.java
/** * Set orientation./*www.j a v a2 s . com*/ */ private void setOrientation() { String currentOrientationLock = PreferenceManager.getDefaultSharedPreferences(this) .getString(getString(R.string.pref_name_orientation_lock), getString(R.string.pref_value_default)); if (currentOrientationLock.equals(getString(R.string.pref_value_portait))) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (currentOrientationLock.equals(getString(R.string.pref_value_landscape))) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } }
From source file:de.limexcomputer.cordova.plugin.rotationlock.RotationLock.java
/** * Executes the request.//from w w w . j a v a 2s.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; }