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:org.mitre.svmp.activities.AppRTCActivity.java
private int getDeviceDefaultOrientation() { WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); Configuration config = getResources().getConfiguration(); int rotation = windowManager.getDefaultDisplay().getRotation(); int value = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; if (((rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) && config.orientation == Configuration.ORIENTATION_LANDSCAPE) || ((rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) && config.orientation == Configuration.ORIENTATION_PORTRAIT)) value = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; return value; }
From source file:cn.kavelcortex.bookpriceculculator.TotalPrice.java
private boolean isScreenOrientationPortrait(Context context) { return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; }
From source file:com.poloure.simplerss.FeedsActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (600 <= newConfig.screenWidthDp && Configuration.ORIENTATION_LANDSCAPE == newConfig.orientation) { showFragments(s_fragmentWeb);// www.j ava2 s. c o m } else if (600 <= newConfig.screenWidthDp && Configuration.ORIENTATION_PORTRAIT == newConfig.orientation) { hideFragments(s_fragmentWeb); } // Update the padding of the content view. setTopOffset(this); }
From source file:com.inovex.zabbixmobile.activities.ChecksActivity.java
protected void showHostListFragment() { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.show(mHostListFragment);/*from w ww .j av a2 s . c om*/ if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { // portrait ft.show(mApplicationsFragment); } else { // landscape ft.hide(mItemDetailsFragment); } ft.commit(); // Uncheck the currently selected list item because the item fragment is // no longer visible. mApplicationsFragment.uncheckCurrentListItem(); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); mDrawerToggle.setDrawerIndicatorEnabled(true); mItemDetailsFragment.setHasOptionsMenu(false); }
From source file:com.getchute.android.photopickerplus.ui.activity.ServicesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); fragmentManager = getSupportFragmentManager(); dualPanes = getResources().getBoolean(R.bool.has_two_panes); retrieveValuesFromBundle(savedInstanceState); if (dualPanes && savedInstanceState == null && getResources().getConfiguration().orientation != Configuration.ORIENTATION_PORTRAIT) { FragmentUtil.replaceContentWithEmptyFragment(ServicesActivity.this); }//from w ww .ja va 2s .co m }
From source file:com.hellofyc.base.app.AppSupportDelegate.java
public boolean isScreenPortrait() { return getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; }
From source file:com.ttxgps.zoom.GestureImageViewTouchListener.java
private void startZoom(MotionEvent e) { inZoom = true;//from w w w . java2s.c o m zoomAnimation.reset(); float zoomTo = 1.0f; if (image.isLandscape()) { if (image.getDeviceOrientation() == Configuration.ORIENTATION_PORTRAIT) { int scaledHeight = image.getScaledHeight(); if (scaledHeight < canvasHeight) { zoomTo = fitScaleVertical / currentScale; zoomAnimation.setTouchX(e.getX()); zoomAnimation.setTouchY(image.getCenterY()); } else { zoomTo = fitScaleHorizontal / currentScale; zoomAnimation.setTouchX(image.getCenterX()); zoomAnimation.setTouchY(image.getCenterY()); } } else { int scaledWidth = image.getScaledWidth(); if (scaledWidth == canvasWidth) { zoomTo = currentScale * 4.0f; zoomAnimation.setTouchX(e.getX()); zoomAnimation.setTouchY(e.getY()); } else if (scaledWidth < canvasWidth) { zoomTo = fitScaleHorizontal / currentScale; zoomAnimation.setTouchX(image.getCenterX()); zoomAnimation.setTouchY(e.getY()); } else { zoomTo = fitScaleHorizontal / currentScale; zoomAnimation.setTouchX(image.getCenterX()); zoomAnimation.setTouchY(image.getCenterY()); } } } else { if (image.getDeviceOrientation() == Configuration.ORIENTATION_PORTRAIT) { int scaledHeight = image.getScaledHeight(); if (scaledHeight == canvasHeight) { zoomTo = currentScale * 4.0f; zoomAnimation.setTouchX(e.getX()); zoomAnimation.setTouchY(e.getY()); } else if (scaledHeight < canvasHeight) { zoomTo = fitScaleVertical / currentScale; zoomAnimation.setTouchX(e.getX()); zoomAnimation.setTouchY(image.getCenterY()); } else { zoomTo = fitScaleVertical / currentScale; zoomAnimation.setTouchX(image.getCenterX()); zoomAnimation.setTouchY(image.getCenterY()); } } else { int scaledWidth = image.getScaledWidth(); if (scaledWidth < canvasWidth) { zoomTo = fitScaleHorizontal / currentScale; zoomAnimation.setTouchX(image.getCenterX()); zoomAnimation.setTouchY(e.getY()); } else { zoomTo = fitScaleVertical / currentScale; zoomAnimation.setTouchX(image.getCenterX()); zoomAnimation.setTouchY(image.getCenterY()); } } } zoomAnimation.setZoom(zoomTo); image.animationStart(zoomAnimation); }
From source file:info.rti.tabsswipe.AltitudeFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { if (Configuration.ORIENTATION_PORTRAIT == getResources().getConfiguration().orientation) { mYAxisPadding = 9;/*from w w w . ja v a2s. co m*/ mRenderer.setYLabels(30); } final LinearLayout view = (LinearLayout) inflater.inflate(R.layout.fragment_altitude, container, false); mChartView = ChartFactory.getTimeChartView(getActivity(), mDataset, mRenderer, TIME); mChartView.addZoomListener(mZoomListener3, true, false); view.addView(mChartView, new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); return view; }
From source file:org.apps8os.motivator.ui.MoodHistoryActivity.java
/** Called when the activity is first created. */ @Override//from w w w. j a va 2 s .c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mood_history); mDayDataHandler = new DayDataHandler(this); mCurrentSprint = getIntent().getExtras().getParcelable(Sprint.CURRENT_SPRINT); mRes = getResources(); mSprintStartDateInMillis = mCurrentSprint.getStartTime(); mSprintEndDateInMillis = mCurrentSprint.getEndTime(); mDaysInSprint = mCurrentSprint.getDaysInSprint(); ActionBar actionBar = getActionBar(); Calendar mToday = Calendar.getInstance(); UtilityMethods.setToDayStart(mToday); mToday.setFirstDayOfWeek(Calendar.MONDAY); mNumberOfTodayInSprint = mCurrentSprint.getCurrentDayOfTheSprint(); // Check if the sprint is already over. if (mNumberOfTodayInSprint > mDaysInSprint) { mNumberOfTodayInSprint = mDaysInSprint; } actionBar.setSubtitle(mCurrentSprint.getSprintTitle()); actionBar.setTitle(mNumberOfTodayInSprint + " " + getString(R.string.days)); actionBar.setBackgroundDrawable(mRes.getDrawable(R.drawable.action_bar_orange)); mStartDate = Calendar.getInstance(); mStartDate.setFirstDayOfWeek(Calendar.MONDAY); mStartDate.setTimeInMillis(mSprintStartDateInMillis); // Calculate the number of weeks in the sprint mNumberOfWeeksInSprint = mToday.get(Calendar.WEEK_OF_YEAR) - mStartDate.get(Calendar.WEEK_OF_YEAR) + 1; if (mNumberOfWeeksInSprint < 0) { mNumberOfWeeksInSprint = 52 + 1 - mStartDate.get(Calendar.WEEK_OF_YEAR) + mToday.get(Calendar.WEEK_OF_YEAR); } else { } // Sets the default selections as today or this week. mSelectedDay = mNumberOfTodayInSprint - 1; mSelectedWeek = mNumberOfWeeksInSprint - 1; mViewPager = (ViewPager) findViewById(R.id.activity_mood_history_viewpager); titleIndicator = (TitlePageIndicator) findViewById(R.id.indicator); // Page change listener to keep the selected week and day in a member. titleIndicator.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageScrollStateChanged(int arg0) { } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageSelected(int arg0) { if (mRes.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { mSelectedDay = arg0; } else if (mRes.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { mSelectedWeek = arg0; MoodHistoryWeekFragment fragment = mPagerAdapterWeek.getWeekFragment(arg0); if (fragment != null) { fragment.updateSelectedAttribute(mSelectedAttribute, false); } } } }); setPageTitles(); // Load correct layout and functionality based on orientation if (mRes.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { loadPortraitView(); } else if (mRes.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { loadLandscapeView(); } }
From source file:com.ohso.omgubuntu.BaseFragment.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { if (footerView.isShown()) footerView.setVisibility(TextView.GONE); gridView.setNumColumns(getColumnByScreenSize()); adapter.setColumns(getColumnByScreenSize()); }/* w w w. ja va2 s . c om*/ }