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.myapps.playnation.main.MainActivity.java
@SuppressLint("NewApi") private void miniSetup() { if (android.os.Build.VERSION.SDK_INT > 10) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); }//from w ww. j a v a 2 s. com // requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); getSupportActionBar().setTitle("Playnation Mobile"); getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.background_gradient)); con = DataConnector.getInst(); Log.i("MainActiv", "intent.getInt() = " + getIntent().getExtras().getInt(Keys.AppState)); isTablet = Configurations.getConfigs().isTablet(); if (!isTablet) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setSupportProgressBarIndeterminateVisibility(true); }
From source file:com.sharedcab.batchcar.MainActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Log.i(TAG, "Here"); // Pass any configuration change to the drawer toggle mDrawerToggle.onConfigurationChanged(newConfig); }
From source file:de.androvdr.activities.AndroVDR.java
public void initWorkspaceView(Bundle savedInstanceState) { if (!Preferences.alternateLayout) setTheme(R.style.Theme_Original); logger.debug("Model: {}", Build.MODEL); logger.debug("SDK Version: {}", Build.VERSION.SDK_INT); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); logger.debug("Width: {}", metrics.widthPixels); logger.debug("Height: {}", metrics.heightPixels); logger.debug("Density: {}", metrics.densityDpi); Configuration conf = getResources().getConfiguration(); boolean screenSmall = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_SMALL) == Configuration.SCREENLAYOUT_SIZE_SMALL); boolean screenNormal = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_NORMAL) == Configuration.SCREENLAYOUT_SIZE_NORMAL); boolean screenLong = ((conf.screenLayout & Configuration.SCREENLAYOUT_LONG_YES) == Configuration.SCREENLAYOUT_LONG_YES); boolean screenLarge = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == Configuration.SCREENLAYOUT_SIZE_LARGE); boolean screenXLarge = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_XLARGE) == Configuration.SCREENLAYOUT_SIZE_XLARGE); logger.debug("Screen Small: {}", screenSmall); logger.debug("Screen Normal: {}", screenNormal); logger.debug("Screen Long: {}", screenLong); logger.debug("Screen Large: {}", screenLarge); logger.debug("Screen XLarge: {}", screenXLarge); if (screenSmall) Preferences.screenSize = Preferences.SCREENSIZE_SMALL; if (screenNormal) Preferences.screenSize = Preferences.SCREENSIZE_NORMAL; if (screenLong) Preferences.screenSize = Preferences.SCREENSIZE_LONG; if (screenLarge) Preferences.screenSize = Preferences.SCREENSIZE_LARGE; if (screenXLarge) Preferences.screenSize = Preferences.SCREENSIZE_XLARGE; logger.trace("Screen size: {}", Preferences.screenSize); // --- init default text size for buttons --- TextResizeButton.resetDefaultTextSize(); TextResizeButton rb = (TextResizeButton) LayoutInflater.from(this).inflate(R.layout.reference_button, null); if ((Preferences.screenSize >= Preferences.SCREENSIZE_LARGE) && (metrics.widthPixels > metrics.heightPixels)) rb.setTextSizeAsDefault(metrics.widthPixels / 2 / 5, 100); else/*w w w.j ava 2 s . c o m*/ rb.setTextSizeAsDefault(Math.min(metrics.widthPixels, metrics.heightPixels) / 4, 100); logger.debug("Default TextSize (px): {}", rb.getTextSize()); // --- landscape mode only on large displays --- if (Preferences.screenSize < Preferences.SCREENSIZE_LARGE) { logger.trace("setting SCREEN_ORIENTATION_PORTRAIT"); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } setContentView(R.layout.remote_pager); mPagerAdapter = new PagerAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mPagerAdapter); LinePageIndicator indicator = (LinePageIndicator) findViewById(R.id.titles); if (mPagerAdapter.getCount() > 1) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); int last = sp.getInt("remote_last_page", 0); if (last < mPagerAdapter.getCount()) indicator.setViewPager(mPager, last); else indicator.setViewPager(mPager); } else { indicator.setVisibility(View.GONE); } // --- show current channel in status bar --- if (Preferences.screenSize < Preferences.SCREENSIZE_XLARGE) mDevices.addOnSensorChangeListener("VDR.channel", 1, new OnSensorChangeListener() { @Override public void onChange(String result) { logger.trace("Channel: {}", result); Message msg = Message.obtain(mSensorHandler, SENSOR_CHANNEL); Bundle bundle = new Bundle(); bundle.putString(MSG_RESULT, result); msg.setData(bundle); msg.sendToTarget(); } }); mDevices.startSensorUpdater(0); }
From source file:ch.jeda.platform.android.Main.java
private int getScreenOrientation(final ViewRequest request) { if (request.getFeatures().contains(WindowFeature.ORIENTATION_LANDSCAPE)) { return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else if (request.getFeatures().contains(WindowFeature.ORIENTATION_PORTRAIT)) { return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else {//from ww w . j a v a 2 s . c o m final int rotation = this.getWindowManager().getDefaultDisplay().getRotation(); if (this.getResources().getConfiguration().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; } } else { if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) { return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else { return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; } } } }
From source file:org.fossasia.phimpme.leafpic.activities.PlayerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_share: Intent share = new Intent(Intent.ACTION_SEND); Media m = new Media(ContentHelper.getMediaPath(getApplicationContext(), getIntent().getData())); share.setType(m.getMimeType());/*from w w w.ja v a2 s .c o m*/ share.putExtra(Intent.EXTRA_STREAM, getIntent().getData()); startActivity(Intent.createChooser(share, getString(R.string.send_to))); return true; case R.id.action_settings: startActivity(new Intent(getApplicationContext(), SettingsActivity.class)); return true; case R.id.rotate_layout: int rotation = (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay()).getRotation(); if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); showControls(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.jinfukeji.jinyihuiup.indexBannerClick.ZhiboActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); this.setContentView(R.layout.activity_zhibo); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); screen_direction = SCREEN_LAND;//from ww w .jav a 2 s.c o m initLandView(); setLandOnClick(); isShowLayout = true; if (isPlayed) { player.leave(); player.setGSVideoView(mGSzhiboLand); initplayer(); mivPlayLand.setVisibility(View.GONE); } } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); this.setContentView(R.layout.activity_zhibo); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); screen_direction = SCREEN_PORT; initView(); zhibo_viewpager.addOnPageChangeListener(new ZhiboOnPageChangeListener()); initClickListener(); zhiboVPAdapter = new ZhiboVPAdapter(getSupportFragmentManager(), mFragments); zhibo_viewpager.setAdapter(zhiboVPAdapter); setOnClick(); isShowLayout = true; if (isPlayed) { mIvplayer.setVisibility(View.GONE); player.leave(); player.setGSVideoView(mGSzhibo); initplayer(); } } }
From source file:org.zakky.memopad.PadActivity.java
private void fixOrientation() { final Configuration config = getResources().getConfiguration(); if (config.orientation == Configuration.ORIENTATION_PORTRAIT) { // TODO SCREEN_ORIENTATION_REVERSE_PORTRAIT ? setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else {/*from w w w . ja v a 2s. c o m*/ // TODO SCREEN_ORIENTATION_REVERSE_LADSCAPE ? setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } }
From source file:demo.camera.library.ui.CameraCaptureActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_camera_capture); CameraUtils.clearSessionConfig();/*from www . j a v a 2 s .c o m*/ CameraUtils.clearSessionFolders(this, true, true); Spinner spinner = (Spinner) findViewById(R.id.filterSpinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.cameraFilterNames, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner. spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); // Define a handler that receives camera-control messages from other threads. All calls // to Camera must be made on the same thread. Note we create this before the renderer // thread, so we know the fully-constructed object will be visible. mSessionConfig = CameraUtils.getSessionConfig(this); CameraUtils.clearSessionConfig(); mCameraHandler = new CameraHandler(this); mVideoEncoder = new TextureMovieEncoder(); mRecordingEnabled = mVideoEncoder.isRecording(); try { mMicEncoder = new MicrophoneEncoder(mSessionConfig); } catch (IOException e) { e.printStackTrace(); } // Configure the GLSurfaceView. This will start the Renderer thread, with an // appropriate EGL context. mGLView = (GLSurfaceView) findViewById(R.id.cameraPreview_surfaceView); mGLView.setEGLContextClientVersion(2); // select GLES 2.0 mRenderer = new CameraSurfaceRenderer(mCameraHandler, mSessionConfig, mVideoEncoder); mGLView.setRenderer(mRenderer); mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); mCameraManager = new AppCameraManager(this, mSessionConfig); setUpUi(); Log.d(TAG, "onCreate complete: " + this); }
From source file:aws.apps.underthehood.Main.java
private void mLockScreenRotation() { // Stop the screen orientation changing during an event switch (this.getResources().getConfiguration().orientation) { case Configuration.ORIENTATION_PORTRAIT: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break;/* w w w. ja v a 2 s .co m*/ case Configuration.ORIENTATION_LANDSCAPE: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; } }
From source file:me.drakeet.meizhi.ui.GankFragment.java
void closePlayer() { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Toasts.showShort(getString(R.string.tip_for_no_gank)); }