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.smc.tw.waltz.MainActivity.java
@Override public void onMotionFullscreen(boolean fullscreen) { if (DEBUG)//w ww . j av a 2 s .c o 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); } }
From source file:de.sourcestream.movieDB.controller.TVDetails.java
/** * Fired when are restoring from backState or orientation has changed. * * @param args our bundle with saved state. *///from w ww . j a va2 s . c om 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); } // More icon moreIconCheck = args.getInt("moreIconCheck"); if (homeIconCheck == 1 && galleryIconCheck == 1) { moreIconCheck = 1; moreIcon.setVisibility(View.GONE); } else moreIconCheck = 0; mSlidingTabLayout.setOnPageChangeListener(onPageChangeSelected); activity.setTVDetailsInfoBundle(save); activity.setTVDetailsCastBundle(save); activity.setTVDetailsOverviewBundle(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() { tvDetailsInfo = (TVDetailsInfo) tvDetailsSlideAdapter.getRegisteredFragment(0); if (currPos == 0) { moreIcon.setVisibility(View.INVISIBLE); } else if (moreIconCheck == 0) { tvDetailsInfo.getMoreIcon().setVisibility(View.INVISIBLE); updateDownPos(); } if (moreIconCheck == 1) tvDetailsInfo.getMoreIcon().setVisibility(View.GONE); else { // set listener on backdrop and poster path click to open gallery if (galleryIconCheck == 0 && galleryList.size() > 0) { tvDetailsInfo.getBackDropPath().setOnClickListener(onGalleryIconClick); tvDetailsInfo.getPosterPath().setOnClickListener(onGalleryIconClick); } adjustIconsPos(homeIcon, galleryIcon); adjustIconsPos(tvDetailsInfo.getHomeIcon(), tvDetailsInfo.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:de.cachebox_test.splash.java
private void Initial(int width, int height) { // Jetzt ist der workPath erstmal festgelegt. Log.debug(log, "Initial()"); // lolipop ask write permission if (android.os.Build.VERSION.SDK_INT > 20) { // if (LolipopworkPath != null) workPath = LolipopworkPath + "/cachebox"; }//www .java 2 s . co m // Zur Kompatibilitt mit lteren Installationen wird hier noch die redirection.txt abgefragt if (FileIO.FileExists(workPath + "/redirection.txt")) { BufferedReader Filereader; try { Filereader = new BufferedReader(new FileReader(workPath + "/redirection.txt")); String line; while ((line = Filereader.readLine()) != null) { // chk ob der umleitungs Ordner existiert if (FileIO.FileExists(line)) { workPath = line; } } Filereader.close(); } catch (IOException e) { Log.err(log, "read redirection", e); } } new Config(workPath); // Read Config Config.Initialize(workPath, workPath + "/cachebox.config"); // hier muss die Config Db initialisiert werden Database.Settings = new AndroidDB(DatabaseType.Settings, this); boolean userFolderExists = FileIO.createDirectory(Config.mWorkPath + "/User"); if (!userFolderExists) return; Database.Settings.StartUp(Config.mWorkPath + "/User/Config.db3"); // initialisieren der PlattformSettings PlatformSettings.setPlatformSettings(new IPlatformSettings() { @Override public void Write(SettingBase<?> setting) { if (androidSetting == null) androidSetting = splash.this.getSharedPreferences(Global.PREFS_NAME, 0); if (androidSettingEditor == null) androidSettingEditor = androidSetting.edit(); if (setting instanceof SettingBool) { androidSettingEditor.putBoolean(setting.getName(), ((SettingBool) setting).getValue()); } else if (setting instanceof SettingString) { androidSettingEditor.putString(setting.getName(), ((SettingString) setting).getValue()); } else if (setting instanceof SettingInt) { androidSettingEditor.putInt(setting.getName(), ((SettingInt) setting).getValue()); } // Commit the edits! androidSettingEditor.commit(); } @Override public SettingBase<?> Read(SettingBase<?> setting) { if (androidSetting == null) androidSetting = splash.this.getSharedPreferences(Global.PREFS_NAME, 0); if (setting instanceof SettingString) { String value = androidSetting.getString(setting.getName(), ""); ((SettingString) setting).setValue(value); } else if (setting instanceof SettingBool) { boolean value = androidSetting.getBoolean(setting.getName(), ((SettingBool) setting).getDefaultValue()); ((SettingBool) setting).setValue(value); } else if (setting instanceof SettingInt) { int value = androidSetting.getInt(setting.getName(), ((SettingInt) setting).getDefaultValue()); ((SettingInt) setting).setValue(value); } setting.clearDirty(); return setting; } }); // wenn die Settings DB neu Erstellt wurde, mssen die Default werte // geschrieben werden. if (Database.Settings.isDbNew()) { Config.settings.LoadAllDefaultValues(); Config.settings.WriteToDB(); } else { Config.settings.ReadFromDB(); } // Add Android Only Settings AndroidSettings.addToSettiongsList(); new CB_SLF4J(workPath); CB_SLF4J.setLogLevel((LogLevel) Config.AktLogLevel.getEnumValue()); Config.AktLogLevel.addChangedEventListener(new IChanged() { @Override public void isChanged() { CB_SLF4J.setLogLevel((LogLevel) Config.AktLogLevel.getEnumValue()); } }); if (GlobalCore.isTab) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Log.debug(log, "setRequestedOrientation SCREEN_ORIENTATION_LANDSCAPE"); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Log.debug(log, "setRequestedOrientation SCREEN_ORIENTATION_PORTRAIT"); } Database.Data = new AndroidDB(DatabaseType.CacheBox, this); // copy AssetFolder only if Rev-Number changed, like at new installation try { if (Config.installRev.getValue() < GlobalCore.CurrentRevision) { String[] exclude = new String[] { "webkit", "sound", "sounds", "images", "skins", "lang", "kioskmode", "string-files", "" }; copyAssetFolder myCopie = new copyAssetFolder(); myCopie.copyAll(getAssets(), Config.mWorkPath, exclude); Config.installRev.setValue(GlobalCore.CurrentRevision); Config.newInstall.setValue(true); Config.AcceptChanges(); File CreateFile; // create .nomedia Files try { CreateFile = FileFactory.createFile(workPath + "/data/.nomedia"); CreateFile.getParentFile().mkdirs(); CreateFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } try { CreateFile = FileFactory.createFile(workPath + "/skins/.nomedia"); CreateFile.getParentFile().mkdirs(); CreateFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } try { CreateFile = FileFactory.createFile(workPath + "/repository/.nomedia"); CreateFile.getParentFile().mkdirs(); CreateFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } try { CreateFile = FileFactory.createFile(workPath + "/Repositories/.nomedia"); CreateFile.getParentFile().mkdirs(); CreateFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } try { CreateFile = FileFactory.createFile(workPath + "/cache/.nomedia"); CreateFile.getParentFile().mkdirs(); CreateFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } else { Config.newInstall.setValue(false); } } catch (Exception e) { Log.err(log, "Copy Asset", e); } // save askAgain for show SandboxMsg Config.showSandbox.setValue(showSandbox); Config.AcceptChanges(); // UiSize Structur fr die Berechnung der Gren zusammen stellen! Log.debug(log, GlobalCore.getVersionString()); Log.debug(log, "Screen width/height:" + width + "/" + height); if (ui == null) { Resources res = splash.this.getResources(); Log.debug(log, "create new devices-sizes"); ui = new DevicesSizes(); ui.Window = new Size(width, height); ui.Density = res.getDisplayMetrics().density; ui.isLandscape = false; // Log Size values Log.debug(log, "UI-Sizes"); Log.debug(log, "ui.Window: " + ui.Window.toString()); Log.debug(log, "ui.Density: " + ui.Density); Log.debug(log, "ui.isLandscape: " + ui.isLandscape); } new UiSizes(); UI_Size_Base.that.initial(ui); GL_UISizes.defaultDPI = ui.Density; Global.Paints.init(this); {// restrict MapsforgeScaleFactor to max 1.0f (TileSize 256x256) ext_AndroidGraphicFactory.createInstance(this.getApplication()); float restrictedScaleFactor = 1f; DisplayModel.setDeviceScaleFactor(restrictedScaleFactor); new de.cachebox_test.Map.AndroidManager(new DisplayModel()); } Initial2(); }
From source file:com.hichinaschool.flashcards.anki.Info.java
private void lockScreenOrientation() { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }/*from w w w .jav a2 s. c om*/ }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionLivestreamActivity.java
/** * Shows the Presentation on the designated Display. Some UI components are also updated: * a play/pause button is displayed where the video would normally be; the YouTube player style * is updated to MINIMAL (more suitable for an external display); and an action item is updated * to indicate the external display is being used. *//* w w w . ja v a 2 s .co m*/ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void showPresentation(Display presentationDisplay) { LOGD(TAG, "Showing video presentation on display: " + presentationDisplay); if (mIsFullscreen) { if (!mIsTablet) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } if (mYouTubePlayer != null) { mYouTubePlayer.setFullscreen(false); } } View presentationView = mYouTubeFragment.getView(); ((ViewGroup) presentationView.getParent()).removeView(presentationView); mPresentation = new YouTubePresentation(this, presentationDisplay, presentationView); mPresentation.setOnDismissListener(mOnDismissListener); try { mPresentation.show(); mPresentationControls.setVisibility(View.VISIBLE); updatePresentationMenuItem(true); if (mYouTubePlayer != null) { mYouTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.MINIMAL); mYouTubePlayer.play(); setFullscreenFlags(true); } } catch (WindowManager.InvalidDisplayException e) { LOGE(TAG, "Couldn't show presentation! Display was removed in the meantime.", e); hidePresentation(); } }
From source file:androidx.media.widget.VideoView2.java
private int retrieveOrientation() { DisplayMetrics dm = Resources.getSystem().getDisplayMetrics(); int width = dm.widthPixels; int height = dm.heightPixels; return (height > width) ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; }
From source file:it.feio.android.omninotes.DetailFragment.java
private void takeSketch(Attachment attachment) { File f = StorageHelper.createNewAttachmentFile(mainActivity, Constants.MIME_TYPE_SKETCH_EXT); if (f == null) { mainActivity.showMessage(R.string.error, ONStyle.ALERT); return;/* w w w . j a v a2s . c o m*/ } attachmentUri = Uri.fromFile(f); // Forces portrait orientation to this fragment only mainActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Fragments replacing FragmentTransaction transaction = mainActivity.getSupportFragmentManager().beginTransaction(); mainActivity.animateTransition(transaction, mainActivity.TRANSITION_HORIZONTAL); SketchFragment mSketchFragment = new SketchFragment(); Bundle b = new Bundle(); b.putParcelable(MediaStore.EXTRA_OUTPUT, attachmentUri); if (attachment != null) { b.putParcelable("base", attachment.getUri()); } mSketchFragment.setArguments(b); transaction.replace(R.id.fragment_container, mSketchFragment, mainActivity.FRAGMENT_SKETCH_TAG) .addToBackStack(mainActivity.FRAGMENT_DETAIL_TAG).commit(); }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionLivestreamActivity.java
/** * Applies YouTube player full screen flags plus forces portrait orientation on small screens * when presentation (secondary display) is enabled (as the full screen layout won't have * anything to display when an external display is connected). * * @param usePresentationMode Whether or not to use presentation mode. This is used when an * external display is connected and the user toggles between * presentation mode. *//*from w w w .ja v a 2 s .c o m*/ private void setFullscreenFlags(boolean usePresentationMode) { if (mYouTubePlayer != null) { if (usePresentationMode && mPresentation != null && !mIsTablet) { mYouTubePlayer.setFullscreenControlFlags(0); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { mYouTubePlayer.setFullscreenControlFlags(mYouTubeFullscreenFlags); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } } }
From source file:com.dycody.android.idealnote.DetailFragment.java
private void takeSketch(Attachment attachment) { File f = StorageHelper.createNewAttachmentFile(mainActivity, Constants.MIME_TYPE_SKETCH_EXT); if (f == null) { Toast.makeText(getActivity(), R.string.error, Toast.LENGTH_SHORT).show(); //mainActivity.showMessage(R.string.error, ONStyle.ALERT); return;/* w w w . ja va 2s. co m*/ } attachmentUri = Uri.fromFile(f); // Forces portrait orientation to this fragment only mainActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Fragments replacing FragmentTransaction transaction = mainActivity.getSupportFragmentManager().beginTransaction(); mainActivity.animateTransition(transaction, mainActivity.TRANSITION_HORIZONTAL); SketchFragment mSketchFragment = new SketchFragment(); Bundle b = new Bundle(); b.putParcelable(MediaStore.EXTRA_OUTPUT, attachmentUri); if (attachment != null) { b.putParcelable("base", attachment.getUri()); } mSketchFragment.setArguments(b); transaction.replace(R.id.fragment_container, mSketchFragment, mainActivity.FRAGMENT_SKETCH_TAG) .addToBackStack(mainActivity.FRAGMENT_DETAIL_TAG).commit(); }
From source file:com.youku.player.base.YoukuBasePlayerActivity.java
@Override public void reversePort() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }