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: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 w w. j a va 2 s. co 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:net.zorgblub.typhon.fragment.ReadingFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void updateFromPrefs() { AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity == null) { return;//from ww w . j a v a 2s .c o m } bookView.setTextSize(config.getTextSize()); int marginH = config.getHorizontalMargin(); int marginV = config.getVerticalMargin(); this.textLoader.setFontFamily(config.getDefaultFontFamily()); this.bookView.setFontFamily(config.getDefaultFontFamily()); this.textLoader.setSansSerifFontFamily(config.getSansSerifFontFamily()); this.textLoader.setSerifFontFamily(config.getSerifFontFamily()); bookView.setHorizontalMargin(marginH); bookView.setVerticalMargin(marginV); if (!isAnimating()) { bookView.setEnableScrolling(config.isScrollingEnabled()); } textLoader.setStripWhiteSpace(config.isStripWhiteSpaceEnabled()); textLoader.setAllowStyling(config.isAllowStyling()); textLoader.setUseColoursFromCSS(config.isUseColoursFromCSS()); bookView.setLineSpacing(config.getLineSpacing()); if (config.isFullScreenEnabled()) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); activity.getSupportActionBar().hide(); } else { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); activity.getSupportActionBar().show(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (config.isFullScreenEnabled()) { activity.getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } if (config.isDimSystemUI()) { activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); } } if (config.isKeepScreenOn()) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } restoreColorProfile(); // Check if we need a restart if (config.isFullScreenEnabled() != savedConfigState.fullscreen || config.isShowPageNumbers() != savedConfigState.usePageNum || config.isBrightnessControlEnabled() != savedConfigState.brightness || config.isStripWhiteSpaceEnabled() != savedConfigState.stripWhiteSpace || !config.getDefaultFontFamily().getName().equalsIgnoreCase(savedConfigState.fontName) || !config.getSerifFontFamily().getName().equalsIgnoreCase(savedConfigState.serifFontName) || !config.getSansSerifFontFamily().getName().equalsIgnoreCase(savedConfigState.sansSerifFontName) || config.getHorizontalMargin() != savedConfigState.hMargin || config.getVerticalMargin() != savedConfigState.vMargin || config.getTextSize() != savedConfigState.textSize || config.isScrollingEnabled() != savedConfigState.scrolling || config.isAllowStyling() != savedConfigState.allowStyling || config.isUseColoursFromCSS() != savedConfigState.allowColoursFromCSS || config.isRikaiEnabled() != savedConfigState.rikaiEnabled || dictionaryService.getLastUpdateTimestamp() > this.dictionaryLastUpdate) { DictionaryServiceImpl.reset(); textLoader.invalidateCachedText(); restartActivity(); } Configuration.OrientationLock orientation = config.getScreenOrientation(); switch (orientation) { case PORTRAIT: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; case LANDSCAPE: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; case REVERSE_LANDSCAPE: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); // Android 2.3+ value break; case REVERSE_PORTRAIT: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); // Android 2.3+ value break; default: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } }
From source file:processing.core.PApplet.java
public void orientation(int which) { if (which == PORTRAIT) { this.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (which == LANDSCAPE) { this.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }/*from www . j av a 2s . co m*/ }
From source file:com.aimfire.main.MainActivity.java
public int getScreenOrientation() { int rotation = getWindowManager().getDefaultDisplay().getRotation(); int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270) { return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else {// ww w . j a v a 2 s .co m return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; } } if (orientation == Configuration.ORIENTATION_LANDSCAPE) { if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) { return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else { return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; } } return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; }
From source file:org.woltage.irssiconnectbot.ConsoleActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Log.d(TAG, String.format("onConfigurationChanged; requestedOrientation=%d, newConfig.orientation=%d", getRequestedOrientation(), newConfig.orientation)); if (bound != null) { if (forcedOrientation && (newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE && getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) || (newConfig.orientation != Configuration.ORIENTATION_PORTRAIT && getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)) bound.setResizeAllowed(false); else/* w w w . j a v a 2 s . co m*/ bound.setResizeAllowed(true); bound.hardKeyboardHidden = (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES); mKeyboardButton.setVisibility(bound.hardKeyboardHidden ? View.VISIBLE : View.GONE); mInputButton.setVisibility(bound.hardKeyboardHidden ? View.VISIBLE : View.GONE); } }
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 ww . ja v a 2s . com 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.smc.tw.waltz.MainActivity.java
@Override public void onCameraFullscreen(boolean fullscreen) { if (DEBUG)/*from w ww .ja va 2 s . c o m*/ Log.d(TAG, "onCameraFullscreen"); if (mIsStopped || mIsInstanceStateSaved) return; if (mDevicePagerFragment == null) return; if (fullscreen) { hideToolbar(); mDevicePagerFragment.setMediaFullscreen(true); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { showToolbar(); mDevicePagerFragment.setMediaFullscreen(false); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }
From source file:org.connectbot.ConsoleActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Log.d(TAG, String.format("onConfigurationChanged; requestedOrientation=%d, newConfig.orientation=%d", getRequestedOrientation(), newConfig.orientation)); if (bound != null) { if (forcedOrientation && (newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE && getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) || (newConfig.orientation != Configuration.ORIENTATION_PORTRAIT && getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)) bound.setResizeAllowed(false); else//from ww w.j a v a 2 s . c om bound.setResizeAllowed(true); bound.hardKeyboardHidden = (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES); mKeyboardButton.setVisibility(bound.hardKeyboardHidden ? View.VISIBLE : View.GONE); } }
From source file:com.smc.tw.waltz.MainActivity.java
@Override public void onVideoListFullscreen(boolean fullscreen) { if (DEBUG)// w w w. ja v a 2 s . c o m Log.d(TAG, "onVideoListFullscreen"); if (mIsStopped || mIsInstanceStateSaved) return; if (mDevicePagerFragment == null) return; if (fullscreen) { hideToolbar(); mDevicePagerFragment.setVideoListFullscreen(true); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { showToolbar(); mDevicePagerFragment.setVideoListFullscreen(false); mDeviceVideoListFragment.stopVideoPlay(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }
From source file:com.smc.tw.waltz.MainActivity.java
@Override public void onMotionFullscreen(boolean fullscreen) { if (DEBUG)// w w w. j av a2s. co m Log.d(TAG, "onMotionFullscreen"); if (mIsStopped || mIsInstanceStateSaved) return; if (mDevicePagerFragment == null) return; if (fullscreen) { hideToolbar(); mDevicePagerFragment.setMotionFullscreen(true); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { showToolbar(); mDevicePagerFragment.setMotionFullscreen(false); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }