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.yahala.ui.LaunchActivity.java
@Override public void onConfigurationChanged(android.content.res.Configuration newConfig) { super.onConfigurationChanged(newConfig); OSUtilities.checkDisplaySize();/* ww w. ja va 2 s . c om*/ fixLayout(); //if(XmppManager.getInstance().connectionState== ConnectionState.ONLINE) if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { } }
From source file:org.distantshoresmedia.keyboard.LatinIME.java
private boolean isPortrait() { return (mOrientation == Configuration.ORIENTATION_PORTRAIT); }
From source file:com.github.akinaru.hcidebugger.activity.HciDebuggerActivity.java
private void startScanSetup() { MenuItem item;/*from ww w . j a v a 2 s .c o m*/ if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { item = nvDrawer.getMenu().findItem(R.id.scan_btn_nv); } else { item = toolbar.getMenu().findItem(R.id.scan_btn); } if (item != null) { item.setIcon(R.drawable.ic_portable_wifi_off); item.setTitle(getResources().getString(R.string.menu_item_title_stop_scan)); } Toast.makeText(HciDebuggerActivity.this, getResources().getString(R.string.toast_scan_start), Toast.LENGTH_SHORT).show(); }
From source file:nz.ac.auckland.lablet.ExperimentRunViewManager.java
/** * Lock the screen to the current orientation. * @return the previous orientation settings */// w w w . ja va 2 s. c o m private int lockScreenOrientation() { int initialRequestedOrientation = getRequestedOrientation(); // Note: a surface rotation of 90 degrees means a physical device rotation of -90 degrees. int orientation = getResources().getConfiguration().orientation; int rotation = getWindowManager().getDefaultDisplay().getRotation(); switch (rotation) { case Surface.ROTATION_0: if (orientation == Configuration.ORIENTATION_PORTRAIT) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else if (orientation == Configuration.ORIENTATION_LANDSCAPE) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; case Surface.ROTATION_90: if (orientation == Configuration.ORIENTATION_PORTRAIT) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); else if (orientation == Configuration.ORIENTATION_LANDSCAPE) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; case Surface.ROTATION_180: if (orientation == Configuration.ORIENTATION_PORTRAIT) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); else if (orientation == Configuration.ORIENTATION_LANDSCAPE) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); break; case Surface.ROTATION_270: if (orientation == Configuration.ORIENTATION_PORTRAIT) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else if (orientation == Configuration.ORIENTATION_LANDSCAPE) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); break; } return initialRequestedOrientation; }
From source file:com.example.igorklimov.popularmoviesdemo.fragments.DetailFragment.java
private void setMinSizes(View space) { int fragmentHeight; int fragmentWidth; if (!isTabletPreference(context)) { fragmentHeight = this.getResources().getDisplayMetrics().heightPixels; fragmentWidth = this.getResources().getDisplayMetrics().widthPixels; } else {//from www .j a v a 2 s . c o m Bundle arguments = getArguments(); fragmentHeight = arguments.getInt("fragmentHeight"); fragmentWidth = arguments.getInt("fragmentWidth"); } int minHeight = fragmentHeight / 3; int minWidth = (int) (((double) minHeight / 278) * 185); int backdropHeight = (!Utility.isTabletPreference(context) && Configuration.ORIENTATION_LANDSCAPE == context.getResources().getConfiguration().orientation ? fragmentHeight - fragmentHeight / 3 : (int) (((double) fragmentWidth / 500) * 281)); mPosterView.setMinimumWidth(minWidth); mPosterView.setMinimumHeight(minHeight); mBack.setMinimumHeight(backdropHeight); if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT && space != null) { space.setMinimumHeight(backdropHeight); } }
From source file:com.example.igorklimov.popularmoviesdemo.fragments.DetailFragment.java
private void setupParallaxBar(final Toolbar bar, final View parallaxBar) { final boolean isPortrait = context.getResources() .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; new Handler().postDelayed(new Runnable() { @Override//from w ww.j a va 2s . c om public void run() { mScroll.getViewTreeObserver() .addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { int j = bar.getHeight(); int b = parallaxBar.getHeight(); @Override public void onScrollChanged() { int i = mScroll.getScrollY(); float k = -parallaxBar.getTranslationY(); int n = -(i / 2); parallaxBar.setTranslationY(n); if (!isPortrait) { if (j + k >= b) { int i2 = -(j - (n + b)); bar.setTranslationY(Math.min(0, i2)); } } else { int i2 = (b - i - j); bar.setTranslationY(Math.min(0, i2)); } } }); } }, 300); }
From source file:com.concentricsky.android.khanacademy.app.VideoDetailActivity.java
private boolean isPortrait() { return getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; }
From source file:com.custom.music.MusicBrowserActivity.java
/** * initial tab host/* w ww. j a v a 2 s. c o m*/ */ private void initTab() { Log.i(TAG, ">>> initTab", Log.APP); 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); } Log.i(TAG, "addTab:" + i, Log.APP); mTabHost.addTab( mTabHost.newTabSpec(getStringId(i)).setIndicator(tabView).setContent(android.R.id.tabcontent)); } if (mOrientaiton == Configuration.ORIENTATION_PORTRAIT) { TabWidget tabWidgetTemp = mTabHost.getTabWidget(); //update by zjw //PLAYBACK_INDEX for (int i = 0; i < mTabCount; i++) { tabView = tabWidgetTemp.getChildTabViewAt(i); if (tabView != null) { tabView.setVisibility(View.GONE); } Log.i(TAG, "set tab gone:" + i, Log.APP); } } Log.i(TAG, "initTab >>>", Log.APP); }
From source file:org.openremote.android.console.GroupActivity.java
/** * @param newOrientation//from w ww .jav a2 s.co m */ private void manualRotateScreen(boolean newOrientation) { if (newOrientation) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); lastConfigurationOrientation = Configuration.ORIENTATION_LANDSCAPE; isLandscape = true; } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); lastConfigurationOrientation = Configuration.ORIENTATION_PORTRAIT; isLandscape = false; } }
From source file:com.almalence.util.Util.java
public static boolean shouldRemapOrientation(final int orientationProc, final int rotation) { return (orientationProc == Configuration.ORIENTATION_LANDSCAPE && rotation == Surface.ROTATION_0) || (orientationProc == Configuration.ORIENTATION_LANDSCAPE && rotation == Surface.ROTATION_180) || (orientationProc == Configuration.ORIENTATION_PORTRAIT && rotation == Surface.ROTATION_90) || (orientationProc == Configuration.ORIENTATION_PORTRAIT && rotation == Surface.ROTATION_270); }