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:net.majorkernelpanic.spydroid.ui.SpydroidActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mApplication = (SpydroidApplication) getApplication(); setContentView(R.layout.spydroid);//from w w w . j a va 2 s. c om if (findViewById(R.id.handset_pager) != null) { // Handset detected ! mAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.handset_pager); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mSurfaceView = (SurfaceView) findViewById(R.id.handset_camera_view); SessionBuilder.getInstance().setSurfaceView(mSurfaceView); SessionBuilder.getInstance().setPreviewOrientation(90); } else { // Tablet detected ! device = TABLET; mAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.tablet_pager); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); SessionBuilder.getInstance().setPreviewOrientation(0); } mViewPager.setAdapter(mAdapter); // Remove the ads if this is the donate version of the app. if (mApplication.DONATE_VERSION) { ((LinearLayout) findViewById(R.id.adcontainer)).removeAllViews(); } // Prevents the phone from going to sleep mode PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "net.majorkernelpanic.spydroid.wakelock"); // Starts the service of the HTTP server this.startService(new Intent(this, CustomHttpServer.class)); // Starts the service of the RTSP server this.startService(new Intent(this, CustomRtspServer.class)); }
From source file:com.just.agentweb.VideoImpl.java
@Override public void onHideCustomView() { if (mMoiveView == null) { return;//from ww w. jav a 2 s . c om } if (mActivity != null && mActivity.getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } if (!mFlags.isEmpty()) { for (Pair<Integer, Integer> mPair : mFlags) { mActivity.getWindow().setFlags(mPair.second, mPair.first); } mFlags.clear(); } mMoiveView.setVisibility(View.GONE); if (mMoiveParentView != null && mMoiveView != null) { mMoiveParentView.removeView(mMoiveView); } if (mMoiveParentView != null) { mMoiveParentView.setVisibility(View.GONE); } if (this.mCallback != null) { mCallback.onCustomViewHidden(); } this.mMoiveView = null; if (mWebView != null) { mWebView.setVisibility(View.VISIBLE); } }
From source file:kn.uni.gis.foxhunt.GameActivity.java
@SuppressWarnings("deprecation") @Override/*from w ww.ja va 2 s.c o m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); if (!!!GameContext.isGameRunning()) { Log.e(GameActivity.class.getName(), "no game running and we are in the game activity -.-"); finish(); } setContentView(R.layout.game); Util.setEditText(this, R.id.ED_GAME_GAME_ID, GameContext.getGame().getId()); Util.setEditText(this, R.id.ED_GAME_GAME_TYPE, GameContext.getGame().getType().toString()); registerOnGPS(); view = (CompassImageView) findViewById(R.id.IV_COMPASS_GAME); if (Type.HUNTER == GameContext.getGame().getType()) { sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION); Util.setVisible(this, R.id.IV_COMPASS_GAME, View.VISIBLE); } else { Util.setVisible(this, R.id.IV_COMPASS_GAME, View.INVISIBLE); Util.setVisible(this, R.id.ED_GAME_FOX_LAST_UPDATE, View.INVISIBLE); Util.setVisible(this, R.id.TV_GAME_FOX_LAST_UPDATE, View.INVISIBLE); } postJob = postLocation(); scheduledPostJob = scheduledService.scheduleAtFixedRate(postJob, 0, 3000, TimeUnit.MILLISECONDS); disableConnectionButton(R.id.GAME_RB_CONNECTED); disableConnectionButton(R.id.GAME_RB_GPS); }
From source file:net.chuzarski.crowdednews.activities.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Start logging Timber.tag("MainActivity"); //Since this app is going to be released quickly, we may have Activity Lifecycle quirks //allow ONLY portrait orientation for now setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //UI References vWaitIndicator = (ProgressBar) findViewById(R.id.waiting_icon); vList = (ListView) findViewById(R.id.posts_list_view); vOurActionBar = getActionBar();/*w w w .j ava2 s .c om*/ vNavDrawer = (DrawerLayout) findViewById(R.id.navigation_drawer_layout); vDrawerList = (ListView) findViewById(R.id.navigation_list); abTitle = (TextView) findViewById(getResources().getIdentifier("action_bar_title", "id", "android")); //MISC mNewsSources = new RedditSources(); navEventHandler = new DrawerHandler(); pageLoader = new PageListener(); filterDialog = createFilterDialog(); //Settings PreferenceManager.setDefaultValues(this, R.xml.settings_layout, true); mSettings = PreferenceManager.getDefaultSharedPreferences(this); //setup navigation mDrawerAdapter = new ArrayAdapter<String>(this, R.layout.navigation_list_item, R.id.navigation_item_list, getResources().getStringArray(R.array.news_channels_strings)); vDrawerList.setAdapter(mDrawerAdapter); vDrawerList.setOnItemClickListener(navEventHandler); //setup the listview mAdapter = new PostsAdapter(getApplicationContext()); vList.setAdapter(mAdapter); //multitasking events = EventBus.getDefault(); jobs = CrowdedNewsApplication.getInstance().getJobManager(); events.register(this); //wire event handlers vList.setOnItemClickListener(new ListHandler()); vList.setOnScrollListener(pageLoader); //app Session mSession = new AppSession(); }
From source file:org.sigimera.app.android.MainActivity.java
@Override protected final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_main); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); ApplicationController appController = ApplicationController.getInstance(); int currentapiVersion = Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { appController.init(getApplicationContext(), getSharedPreferences(Constants.PREFS_NAME, 0), getActionBar());//from w w w. ja v a 2s . com if (!Common.hasInternet()) { getActionBar().setIcon(getResources().getDrawable(R.drawable.sigimera_logo_offline)); } } else { appController.init(getApplicationContext(), getSharedPreferences(Constants.PREFS_NAME, 0), null); } // Initialize the tabs initTabs(); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); } }
From source file:com.orangelabs.rcs.ri.messaging.filetransfer.FileTransferList.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.filetransfer_list); mFileTransferService = getFileTransferApi(); /* Set list adapter */ ListView listView = (ListView) findViewById(android.R.id.list); TextView emptyView = (TextView) findViewById(android.R.id.empty); listView.setEmptyView(emptyView);//from www. j a v a 2 s . c o m registerForContextMenu(listView); mAdapter = new FtCursorAdapter(this); listView.setAdapter(mAdapter); /* * Initialize the Loader with id '1' and callbacks 'mCallbacks'. */ getSupportLoaderManager().initLoader(LOADER_ID, null, this); }
From source file:org.worshipsongs.activity.CustomYoutubeBoxActivity.java
private void initSetUp(Bundle bundle) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); if (bundle != null) { millis = bundle.getInt(KEY_VIDEO_TIME); Log.i(this.getClass().getSimpleName(), "Video time " + millis); bundle.remove("android:fragments"); }// ww w . j a v a2 s . c o m Bundle extras = getIntent().getExtras(); if (extras != null && extras.containsKey(KEY_VIDEO_ID)) { mVideoId = extras.getString(KEY_VIDEO_ID); } else { finish(); } }
From source file:com.google.zxing.client.android.history.HistoryActivity.java
@Override public void pegaScreenResolution() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; Log.i("Script", " Tela do dispositivo - " + height + "x" + width); // pegar - largura por altura if (width <= 780 && height <= 1080) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else {/*from w w w . j a v a 2 s .com*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } }
From source file:de.sourcestream.movieDB.controller.GalleryList.java
/** * @param savedInstanceState if the fragment is being re-created from a previous saved state, this is the state. *//*from www . j a va 2 s. com*/ @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (this.isVisible()) { // Check orientation and lock to portrait if we are on phone if (getResources().getBoolean(R.bool.portrait_only)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } if (save != null) setTitle(save.getString("title")); activity.setTitle(getTitle()); activity.getWindow().getDecorView() .setBackgroundColor(ContextCompat.getColor(activity, R.color.background_material_light)); new Handler().post(new Runnable() { @Override public void run() { if (activity.getSupportActionBar() != null) activity.getSupportActionBar().show(); } }); 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); listView.setOnItemClickListener(this); setGallery(); System.gc(); Tracker t = ((MovieDB) activity.getApplication()).getTracker(); t.setScreenName("GalleryList - " + getTitle()); t.send(new HitBuilders.ScreenViewBuilder().build()); }
From source file:org.apache.cordova.screenorientation.ScreenOrientation.java
public int getOrientation(String orientation) { if (orientation.equals(UNSPECIFIED)) { return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(USER)) { return (ActivityInfo.SCREEN_ORIENTATION_USER); } else if (orientation.equals(BEHIND)) { return (ActivityInfo.SCREEN_ORIENTATION_BEHIND); } else if (orientation.equals(SENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else if (orientation.equals(NOSENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } else if (orientation.equals(SENSOR_LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(SENSOR_PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(REVERSE_LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(REVERSE_PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } else if (orientation.equals(FULL_SENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); }/*from www. j av a 2 s .c o m*/ return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); }