List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT
int SCREEN_ORIENTATION_PORTRAIT
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT.
Click Source Link
portrait
in the android.R.attr#screenOrientation attribute. From source file:com.google.appinventor.components.runtime.Form.java
/** * ScreenOrientation property setter method: sets the screen orientation for * the form.//from www .jav a 2s . com * * @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); } }
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 w w w . java 2 s .com } 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: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 {// www . jav a 2 s .c om 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: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); }/* w ww .j a v a2 s. c om*/ }
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// www. j av a 2 s .c o 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:de.sourcestream.movieDB.controller.MovieDetails.java
/** * Fired when are restoring from backState or orientation has changed. * * @param args our bundle with saved state. *///from w w w .ja va 2 s .co m private void onOrientationChange(Bundle args) { // Home page homeIconCheck = args.getInt("homeIconCheck"); if (homeIconCheck == 0) homeIconUrl = args.getString("homepage"); // Gallery galleryIconCheck = args.getInt("galleryIconCheck"); if (galleryIconCheck == 0) { galleryList = new ArrayList<>(); galleryList = args.getStringArrayList("galleryList"); if (galleryList.size() == 0) activity.hideView(galleryIcon); } // Trailers trailerIconCheck = args.getInt("trailerIconCheck"); if (trailerIconCheck == 0) { trailerList = new ArrayList<>(); trailerList = args.getStringArrayList("trailerList"); if (trailerList.size() == 0) activity.hideView(trailerIcon); } // More icon moreIconCheck = args.getInt("moreIconCheck"); if (homeIconCheck == 1 && galleryIconCheck == 1 && trailerIconCheck == 1) { moreIconCheck = 1; moreIcon.setVisibility(View.GONE); } else moreIconCheck = 0; mSlidingTabLayout.setOnPageChangeListener(onPageChangeSelected); activity.setMovieDetailsInfoBundle(save); activity.setMovieDetailsCastBundle(save); activity.setMovieDetailsOverviewBundle(save); castList = save.getParcelableArrayList("castList"); if (castList != null && castList.size() == 0) { noCast = true; mSlidingTabLayout.disableTabClickListener(1); } new Handler().post(new Runnable() { @Override public void run() { movieDetailsInfo = (MovieDetailsInfo) movieDetailsSlideAdapter.getRegisteredFragment(0); if (currPos == 0) { moreIcon.setVisibility(View.INVISIBLE); } else if (moreIconCheck == 0) { movieDetailsInfo.getMoreIcon().setVisibility(View.INVISIBLE); updateDownPos(); } if (moreIconCheck == 1) movieDetailsInfo.getMoreIcon().setVisibility(View.GONE); else { // set listener on backdrop and poster path click to open gallery if (galleryIconCheck == 0 && galleryList.size() > 0) { movieDetailsInfo.getBackDropPath().setOnClickListener(onGalleryIconClick); movieDetailsInfo.getPosterPath().setOnClickListener(onGalleryIconClick); } adjustIconsPos(homeIcon, trailerIcon, galleryIcon); adjustIconsPos(movieDetailsInfo.getHomeIcon(), movieDetailsInfo.getTrailerIcon(), movieDetailsInfo.getGalleryIcon()); } // disable orientation changing, enable nav drawer sliding, show toolbar if (galleryIconCheck == 0 && galleryList.size() == 1) { activity.getWindow().getDecorView().setBackgroundColor( ContextCompat.getColor(activity, R.color.background_material_light)); if (activity.getSupportActionBar() != null) activity.getSupportActionBar().show(); activity.getMDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); if (Build.VERSION.SDK_INT >= 19) activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); // Check orientation and lock to portrait if we are on phone if (getResources().getBoolean(R.bool.portrait_only)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } }); }
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 ww w . j a va 2 s . c om*/ 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)/* w w w . ja va2 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//ww w. j ava 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)// ww 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); } }