List of usage examples for android.content.res Configuration ORIENTATION_PORTRAIT
int ORIENTATION_PORTRAIT
To view the source code for android.content.res Configuration ORIENTATION_PORTRAIT.
Click Source Link
From source file:com.android.music.MusicBrowserActivity.java
/** * initial tab host// ww w . j a v a 2s . com */ private void initTab() { if (mPermissionReqProcessed == true) { MusicLogUtils.d(TAG, "initTab>>"); final TabWidget tabWidget = (TabWidget) getLayoutInflater().inflate(R.layout.buttonbar, null); mOrientaiton = getResources().getConfiguration().orientation; mTabCount = tabWidget.getChildCount(); View tabView; /// M:remove fake menu if (mHasMenukey) { mTabCount--; } for (int i = 0; i < mTabCount; i++) { tabView = tabWidget.getChildAt(0); if (tabView != null) { tabWidget.removeView(tabView); } MusicLogUtils.d(TAG, "addTab:" + i); mTabHost.addTab(mTabHost.newTabSpec(getStringId(i)).setIndicator(tabView) .setContent(android.R.id.tabcontent)); } if (mOrientaiton == Configuration.ORIENTATION_PORTRAIT) { TabWidget tabWidgetTemp = mTabHost.getTabWidget(); for (int i = PLAYBACK_INDEX; i < mTabCount; i++) { tabView = tabWidgetTemp.getChildTabViewAt(i); if (tabView != null) { tabView.setVisibility(View.GONE); } MusicLogUtils.d(TAG, "set tab gone:" + i); } } MusicLogUtils.d(TAG, "initTab<<"); } }
From source file:org.jsharkey.grouphome.LauncherActivity.java
/** * Force columns shown in adapter based on orientation. *//*from w w w . j a va 2s.c om*/ private void updateColumns(GroupAdapter adapter, Configuration config) { adapter.setColumns((config.orientation == Configuration.ORIENTATION_PORTRAIT) ? 4 : 6); }
From source file:de.tlabs.ssr.g1.client.SourcesView.java
@Override public boolean onScroll(MotionEvent firstEvent, MotionEvent thisEvent, float distanceX, float distanceY) { // transform sound source or surface? if (lastTouchSoundSource != null) { // transform sound source synchronized (GlobalData.audioScene) { // is lastTouchSoundSource selected? if (!lastTouchSoundSource.isSelected()) { // select only this source GlobalData.audioScene.deselectAllSoundSources(); GlobalData.audioScene.selectSoundSource(lastTouchSoundSource); }/* w w w .j av a 2s . c o m*/ // save positions of sources if this is first scroll event if (!scrolling) { scrolling = true; firstScrollPoint[0] = firstEvent.getX(); firstScrollPoint[1] = firstEvent.getY(); ArrayList<SoundSource> selectedSources = GlobalData.audioScene.getSelectedSoundSources(); int numSources = selectedSources.size(); for (int i = 0; i < numSources; i++) { // loop through all currently selected sources selectedSources.get(i).getXY(point); GlobalData.audioScene.mapPoint(point); viewportTransformation.mapPoints(point); selectedSources.get(i).savePosition(point); } } // enough time elapsed to do next position update? long currentTime = SystemClock.uptimeMillis(); if (currentTime - lastSendTime < MAX_POSITION_UPDATE_FREQ) return true; lastSendTime = currentTime; // translate or rotate? if (transformationMode == TransformationMode.TRANSLATE) { // translate // generate server request string String strMsg = "<request>"; ArrayList<SoundSource> selectedSources = GlobalData.audioScene.getSelectedSoundSources(); int numSources = selectedSources.size(); SoundSource soundSource; for (int i = 0; i < numSources; i++) { // loop through all currently selected sources soundSource = selectedSources.get(i); // if source is fixed, skip it if (soundSource.isPositionFixed()) continue; strMsg += "<source id='" + soundSource.getId() + "'>"; // transform screen coords into object coords, consider offset point[0] = soundSource.getSavedX() + thisEvent.getX() - firstScrollPoint[0]; point[1] = soundSource.getSavedY() + thisEvent.getY() - firstScrollPoint[1]; inverseViewportTransformation.mapPoints(point); if (soundSource.getSourceModel() == SoundSource.SourceModel.PLANE) { // recalculate orientation for plane waves float norm = FloatMath.sqrt(point[0] * point[0] + point[1] * point[1]); // for plane waves, if source is movable if (norm != 0.0f) { float newAzimuth; if (point[1] >= 0.0f) newAzimuth = (float) (Math.acos(point[0] / norm) / Math.PI * 180.0f) - 180.0f + GlobalData.audioScene.getReference().getAzimuth(); else newAzimuth = (float) -(Math.acos(point[0] / norm) / Math.PI * 180.0f) - 180.0f + GlobalData.audioScene.getReference().getAzimuth(); strMsg += "<orientation azimuth='" + String.valueOf(newAzimuth) + "'/>"; } } GlobalData.audioScene.inverseMapPoint(point); strMsg += "<position x='" + String.valueOf(point[0]) + "' y='" + String.valueOf(point[1]) + "'/>"; strMsg += "</source>"; } strMsg += "</request>\0"; // send changes to server sendToServer(strMsg); } else { // rotate // not implemented } } } else { // transform surface if (!scrolling) { scrolling = true; firstScrollPoint[0] = thisEvent.getX(); firstScrollPoint[1] = thisEvent.getY(); currentSavedTranslation[0] = currentTranslation[0]; currentSavedTranslation[1] = currentTranslation[1]; } // translate or rotate? if (transformationMode == TransformationMode.TRANSLATE) { // translate if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) { point[0] = thisEvent.getX() - firstScrollPoint[0]; point[1] = thisEvent.getY() - firstScrollPoint[1]; } else if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { point[0] = thisEvent.getY() - firstScrollPoint[1]; point[1] = -(thisEvent.getX() - firstScrollPoint[0]); } setCurrentTranslation(currentSavedTranslation[0] + point[0], currentSavedTranslation[1] + point[1]); } else { // rotate // not implemented } } return true; }
From source file:net.robotmedia.acv.ui.widget.OcrLayout.java
/** Should the simplified interface be shown? */ private boolean showSimplifiedInterface() { boolean simplified = false; int screenOrientation = this.context.getResources().getConfiguration().orientation; if (screenOrientation == Configuration.ORIENTATION_PORTRAIT) { if (this.ocrSettingsSimplifiedLayoutPortrait) { simplified = true;//from www.java2 s .co m } } else // ORIENTATION_LANDSCAPE { if (this.ocrSettingsSimplifiedLayoutLandscape) { simplified = true; } } return simplified; }
From source file:de.dmarcini.bt.homelight.HomeLightMainActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { if (BuildConfig.DEBUG) { Log.i(TAG, "new orientation is PORTRAIT"); }/* w w w.ja v a 2 s. co m*/ } else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (BuildConfig.DEBUG) { Log.i(TAG, "new orientation is LANDSCAPE"); } } else { if (BuildConfig.DEBUG) { Log.w(TAG, "new orientation is UNKNOWN"); } } }
From source file:it.geosolutions.android.map.MapsActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); // Checks the orientation of the screen for landscape and portrait and set portrait mode always if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }// w w w . j av a2 s . c o m }
From source file:com.esri.squadleader.view.SquadLeaderActivity.java
private void adjustLayoutForOrientation(int orientation) { View displayView = findViewById(R.id.tableLayout_display); if (displayView.getLayoutParams() instanceof RelativeLayout.LayoutParams) { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) displayView.getLayoutParams(); switch (orientation) { case Configuration.ORIENTATION_LANDSCAPE: { params.addRule(RelativeLayout.RIGHT_OF, R.id.toggleButton_grid); params.addRule(RelativeLayout.LEFT_OF, R.id.toggleButton_followMe); params.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.imageButton_zoomOut); params.addRule(RelativeLayout.ABOVE, -1); break; }/*from w w w . j a v a2 s . c om*/ case Configuration.ORIENTATION_PORTRAIT: default: { params.addRule(RelativeLayout.RIGHT_OF, -1); params.addRule(RelativeLayout.LEFT_OF, R.id.imageButton_zoomIn); params.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.imageButton_zoomIn); params.addRule(RelativeLayout.ABOVE, R.id.toggleButton_grid); } } displayView.setLayoutParams(params); } }
From source file:org.openremote.android.console.GroupActivity.java
/** * Detect the phone's orientation and display the corresponding screen. * /*ww w .j a va2 s . c o m*/ * @see android.app.Activity#onConfigurationChanged(android.content.res.Configuration) */ @Override public void onConfigurationChanged(Configuration newConfig) { int newOrientation = newConfig.orientation; Log.i("OpenRemote-ORIENTATION", "orientation:" + newOrientation); if (lastConfigurationOrientation != newOrientation) { if (newOrientation == Configuration.ORIENTATION_PORTRAIT) { isLandscape = false; } else if (newOrientation == Configuration.ORIENTATION_LANDSCAPE) { isLandscape = true; } if (canRotateToInterfaceOrientation()) { rotateToIntefaceOrientation(); } } super.onConfigurationChanged(newConfig); lastConfigurationOrientation = newOrientation; }
From source file:org.rebo.app.TileMap.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // recreate(); // setContentView(R.layout.activity_tilemap_nav); // Checks the orientation of the screen // mCompassFab.invalidate(); // mLocationFab.invalidate(); // mToolbar.invalidate(); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { //Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show(); mMap.viewport().setMaxTilt(79);/* w ww .ja va 2s . com*/ float tilt = mCompass.getTilt() + 15; mCompass.setTilt(tilt); //getLayoutInflater().inflate(mCompassFab, ); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { //Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show(); mMap.viewport().setMaxTilt(70); float tilt = mCompass.getTilt() - 15; mCompass.setTilt(tilt); } }
From source file:com.example.android.bluepayandroidsdk.MainActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { //you can make sure if you would change it }/* w ww.ja v a 2s . c om*/ if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { //you can make sure if you would change it } if (newConfig.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO) { //you can make sure if you need change it } super.onConfigurationChanged(newConfig); }