List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR
int SCREEN_ORIENTATION_SENSOR
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR.
Click Source Link
sensor
in the android.R.attr#screenOrientation attribute. From source file:org.videolan.vlc.gui.video.VideoPlayerActivity.java
/** * Remove screen lock/*from ww w . j av a2 s. c o m*/ */ private void unlockScreen() { if (mScreenOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); showInfo(R.string.unlocked, 1000); mLock.setBackgroundResource(R.drawable.screen_lock_off); mTime.setEnabled(true); mSeekbar.setEnabled(true); mLength.setEnabled(true); mShowing = false; showOverlay(); }
From source file:info.alni.comete.android.Comete.java
private void getPrefs() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); throttleArr = sharedPreferences.getString("throttleKey", getString(R.string.prop_throttle)).split("$d"); mixtureArr = sharedPreferences.getString("mixtureKey", getString(R.string.prop_mixture)).split("$d"); propellerArr = sharedPreferences.getString("propellerKey", getString(R.string.prop_propeller)).split("$d"); magnetosArr = sharedPreferences.getString("magnetosKey", getString(R.string.prop_magnetos)).split("$d"); starterArr = sharedPreferences.getString("starterKey", getString(R.string.prop_starter)).split("$d"); startSwitchsArr = sharedPreferences.getString("starterSwitchKey", getString(R.string.prop_starter_switch)) .split("$d"); setReverserArr(sharedPreferences.getString("reverserKey", getString(R.string.prop_reverser)).split("$d")); flapPropKey = sharedPreferences.getString("flapKey", getString(R.string.prop_flap)); rudderPropKey = sharedPreferences.getString("rudderKey", getString(R.string.prop_rudder)); aileronPropKey = sharedPreferences.getString("aileronKey", getString(R.string.prop_aileron)); elevatorPropKey = sharedPreferences.getString("elevatorKey", getString(R.string.prop_elevator)); setBrakeLeftPropKey(sharedPreferences.getString("brakeLeftKey", getString(R.string.prop_brakeLeft))); setBrakeRightPropKey(sharedPreferences.getString("brakeRightKey", getString(R.string.prop_brakeRight))); starter2PropKey = sharedPreferences.getString("starter2Key", getString(R.string.prop_starter2)); nav1FreqPropKey = sharedPreferences.getString("nav1FreqKey", getString(R.string.prop_nav1Freq)); setNav1RadPropKey(sharedPreferences.getString("nav1RadKey", getString(R.string.prop_nav1Rad))); nav2FreqPropKey = sharedPreferences.getString("nav2FreqKey", getString(R.string.prop_nav2Freq)); setNav2RadPropKey(sharedPreferences.getString("nav2RadKey", getString(R.string.prop_nav2Rad))); adf1FreqPropKey = sharedPreferences.getString("adf1FreqKey", getString(R.string.prop_adf1Freq)); com1FreqPropKey = sharedPreferences.getString("com1FreqKey", getString(R.string.prop_com1Freq)); fgViewPropKey = sharedPreferences.getString("fgViewKey", getString(R.string.prop_fgView)); ((FGToggleButton) findViewById(R.id.gear2)) .setFgProp(sharedPreferences.getString("gearDownKey", getString(R.string.prop_gearDown))); ((FGToggleButton) findViewById(R.id.autoCoordination)).setFgProp( sharedPreferences.getString("autoCoordinationKey", getString(R.string.prop_autoCoordination))); ((FGToggleButton) findViewById(R.id.parking_brake)) .setFgProp(sharedPreferences.getString("parkingBrakeKey", getString(R.string.prop_parkingBrake))); // this will be (0 or 1) not (true or false) ((FGToggleButton) findViewById(R.id.parking_brake)).setBoolean(false); try {/*from w ww . ja v a 2 s.c o m*/ aileronMoltDefault = sharedPreferences.getFloat("aileronMoltDefaultKey", Float.parseFloat(getString(R.string.aileronMoltDefault))); elevatorMoltDefault = sharedPreferences.getFloat("elevatorMoltDefaultKey", Float.parseFloat(getString(R.string.elevatorMoltDefault))); elevatorSubDefault = sharedPreferences.getFloat("elevatorSubDefaultKey", Float.parseFloat(getString(R.string.elevatorSubDefault))); rudderMoltDefault = sharedPreferences.getFloat("rudderMoltDefaultKey", Float.parseFloat(getString(R.string.rudderMoltDefault))); } catch (Exception e) { e.printStackTrace(); } if (sharedPreferences.getBoolean("orientationLandscape", false)) { /* First, get the Display from the WindowManager */ Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); /* Now we can retrieve all display-related infos */ // int width = display.getWidth(); // int height = display.getHeight(); int orientation = display.getOrientation(); if (orientation != Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } thrGetAirspeed.getProp().clear(); thrGetAirspeed.addProp(sharedPreferences.getString("airspeedKey", getString(R.string.prop_airspeed)), getString(R.string.prop_airspeed_format)); thrGetAirspeed.addProp(sharedPreferences.getString("directionKey", getString(R.string.prop_direction)), getString(R.string.prop_direction_format)); thrGetAirspeed.addProp(sharedPreferences.getString("nav1FreqKey", getString(R.string.prop_nav1Freq)), getString(R.string.prop_nav1Freq_format), true); thrGetAirspeed.addProp(sharedPreferences.getString("nav1RadKey", getString(R.string.prop_nav1Rad)), getString(R.string.prop_nav1Rad_format), true); thrGetAirspeed.addProp(sharedPreferences.getString("nav2FreqKey", getString(R.string.prop_nav2Freq)), getString(R.string.prop_nav2Freq_format), true); thrGetAirspeed.addProp(sharedPreferences.getString("nav2RadKey", getString(R.string.prop_nav2Rad)), getString(R.string.prop_nav2Rad_format), true); thrGetAirspeed.addProp(sharedPreferences.getString("adf1FreqKey", getString(R.string.prop_adf1Freq)), getString(R.string.prop_adf1Freq_format), true); thrGetAirspeed.addProp(sharedPreferences.getString("com1FreqKey", getString(R.string.prop_com1Freq)), getString(R.string.prop_com1Freq_format), true); thrGetAirspeed.setEnabled(sharedPreferences.getBoolean("enableGetting", true)); // } }
From source file:com.intel.xdk.device.Device.java
private void updateOrientation() { if (rotateOrientation.equalsIgnoreCase("landscape")) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (rotateOrientation.equalsIgnoreCase("portrait")) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else {/*from w w w .ja v a2 s . c o m*/ activity.setRequestedOrientation(shouldAutoRotate ? ActivityInfo.SCREEN_ORIENTATION_SENSOR : activity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }
From source file:com.youku.player.base.YoukuBasePlayerActivity.java
@Override public void port2Land() {//? if (null != orientationHelper) orientationHelper.disableListener(); if (PreferenceUtil.getPreferenceBoolean(this, "video_lock", false)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else {//from w w w. j av a 2 s.c o m layoutHandler.removeCallbacksAndMessages(null); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } }
From source file:com.youku.player.base.YoukuBasePlayerActivity.java
@Override public void reverseLand() { //OrientationChangeCallback? if (null != orientationHelper) orientationHelper.disableListener(); if (!PreferenceUtil.getPreferenceBoolean(this, "video_lock", false)) { layoutHandler.removeCallbacksAndMessages(null); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else {/*from w w w. j a v a 2s . c o m*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } }
From source file:jmri.enginedriver.threaded_application.java
public boolean setActivityOrientation(Activity activity, Boolean webPref) { String to;/* w w w . j a v a 2 s. co m*/ to = prefs.getString("ThrottleOrientation", activity.getApplicationContext().getResources() .getString(R.string.prefThrottleOrientationDefaultValue)); if (to.equals("Auto-Web")) { int orient = activity.getResources().getConfiguration().orientation; if ((webPref && orient == Configuration.ORIENTATION_PORTRAIT) || (!webPref && orient == Configuration.ORIENTATION_LANDSCAPE)) return (false); } else if (webPref) { to = prefs.getString("WebOrientation", activity.getApplicationContext().getResources() .getString(R.string.prefWebOrientationDefaultValue)); } int co = activity.getRequestedOrientation(); if (to.equals("Landscape") && (co != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); else if (to.equals("Auto-Rotate") && (co != ActivityInfo.SCREEN_ORIENTATION_SENSOR)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); else if (to.equals("Portrait") && (co != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); return true; }
From source file:com.codename1.impl.android.AndroidImplementation.java
public void unlockOrientation() { if (getActivity() == null) { return;//from ww w . j ava 2 s. co m } getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); }