List of usage examples for android.content.res Configuration ORIENTATION_LANDSCAPE
int ORIENTATION_LANDSCAPE
To view the source code for android.content.res Configuration ORIENTATION_LANDSCAPE.
Click Source Link
From source file:com.android.music.MusicBrowserActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (mPermissionReqProcessed == true) { MusicLogUtils.d(TAG, "onConfigurationChanged>>"); TabWidget tabWidgetTemp = mTabHost.getTabWidget(); View tabView;//w w w. ja va 2 s . co m Activity activity; int viewStatusForTab = View.GONE; mOrientaiton = newConfig.orientation; if (mOrientaiton == Configuration.ORIENTATION_LANDSCAPE) { MusicLogUtils.d(TAG, "onConfigurationChanged--LandScape"); viewStatusForTab = View.VISIBLE; } /// M: load tab which is alive only for Landscape; for (int i = PLAYBACK_INDEX; i < mTabCount; i++) { tabView = tabWidgetTemp.getChildTabViewAt(i); if (tabView != null) { tabView.setVisibility(viewStatusForTab); } } /// M: notify sub Activity for configuration changed; for (int i = 0; i < PLAYBACK_INDEX; i++) { activity = mActivityManager.getActivity(getStringId(i)); if (activity != null) { activity.onConfigurationChanged(newConfig); } } if (!mHasMenukey) { boolean popupMenuShowing = mPopupMenuShowing; if (popupMenuShowing && mPopupMenu != null) { mPopupMenu.dismiss(); MusicLogUtils.d(TAG, "changeFakeMenu:mPopupMenu.dismiss()"); } MusicLogUtils.d(TAG, "changeFakeMenu:popupMenuShowing=" + popupMenuShowing); createFakeMenu(); if (!mSearchViewShowing) { mOverflowMenuButton.setEnabled(true); } if (popupMenuShowing && mOverflowMenuButton != null) { /**M: Disable the sound effect while the configuration changed.@**/ mOverflowMenuButton.setSoundEffectsEnabled(false); mOverflowMenuButton.performClick(); mOverflowMenuButton.setSoundEffectsEnabled(true); /**@}**/ MusicLogUtils.d(TAG, "changeFakeMenu:performClick()"); } } if (mService != null) { MusicLogUtils.d(TAG, "mSearchViewShowing:" + mSearchViewShowing); if (mSearchViewShowing) { mSearchButton.setVisibility(View.GONE); } else { mSearchButton.setVisibility(View.VISIBLE); } MusicUtils.updateNowPlaying(MusicBrowserActivity.this, mOrientaiton); updatePlaybackTab(); } /**M: Added for forcing init last visible view.@{**/ MusicLogUtils.d(TAG, "onConfigurationChanged--mCurrentTab = " + mCurrentTab); mTabHost.setCurrentTab(mCurrentTab); mViewPager.setAdapter(new MusicPagerAdapter()); onTabChanged(getStringId(mCurrentTab)); /**@}**/ MusicLogUtils.d(TAG, "onConfigurationChanged<<"); } }
From source file:com.flipzu.flipzu.ListingsFragment.java
private void initGATracker() { /* get analytics singleton */ tracker = GoogleAnalyticsTracker.getInstance(); /* start tracker. Dispatch every 30 seconds. */ tracker.startNewSession("UA-20341887-1", 30, getSupportActivity().getApplicationContext()); /* debug GA */ tracker.setDebug(false);/*w w w .j av a2 s . co m*/ tracker.setDryRun(false); // Determine the screen orientation and set it in a custom variable. String orientation = "unknown"; switch (this.getResources().getConfiguration().orientation) { case Configuration.ORIENTATION_LANDSCAPE: orientation = "landscape"; break; case Configuration.ORIENTATION_PORTRAIT: orientation = "portrait"; break; } tracker.setCustomVar(3, "Screen Orientation", orientation, 2); }
From source file:co.taqat.call.ChatFragment.java
public void hideKeyboardVisibleMode() { boolean isOrientationLandscape = getResources() .getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; //contactPicture.setVisibility(View.VISIBLE); if (isOrientationLandscape && topBar != null) { //topBar.setVisibility(View.VISIBLE); }/*w ww.j a va 2 s . c o m*/ LinphoneActivity.instance().hideTabBar(false); }
From source file:com.example.mapsv2.ClustersAreListsActivity.java
private Point getZoneCenter(final Marker marker) { final int orientation = getResources().getConfiguration().orientation; final int w = fullScreenOverlay.getWidth(); // this is full screen width final int h = fullScreenOverlay.getHeight(); // this is full screen height final int cx, cy; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { // Left Zone: Leftmost 1/4 of screen cx = (w / 4) / 2;//from w ww . j a va 2 s. c om cy = h / 2; } else { // Top Zone: Upper 1/4 of screen cx = w / 2; cy = (h / 4) / 2; } return new Point(cx, cy); }
From source file:com.nearnotes.MainActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { mOnlyOrientation = true;//w ww . j a v a 2s .c om } else { mOnlyOrientation = true; } mDrawerToggle.onConfigurationChanged(newConfig); // Pass any configuration change to the drawer toggls }
From source file:com.hplasplas.cam_capture.activitys.CamCapture.java
private void loadMainBitmap(String fileName, int requestedHeight, int requestedWidth) { int orientation = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; mainProgressBar.setVisibility(View.VISIBLE); MainExecutor.getInstance().execute(new BitmapInThreadLoader(this, createBundleBitmap(fileName, MAIN_PICTURE_INDEX, requestedHeight, requestedWidth, 0, orientation))); }
From source file:com.daiv.android.twitter.manipulations.widgets.swipe_refresh_layout.FullScreenSwipeRefreshLayout.java
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { final int width = getMeasuredWidth(); final int height = getMeasuredHeight(); ResourceHelper helper = new ResourceHelper(getContext(), "com.daiv.android.twitter"); if (Build.VERSION.SDK_INT > 18 && AppSettings.getInstance(getContext()).uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || helper.getBoolean("isTablet")) && !MainActivity.isPopup) { // action bar plus the status bar translation = Utils.getStatusBarHeight(getContext()) + Utils.getActionBarHeight(getContext()); } else {/*from w w w. j a v a2 s. c o m*/ // just the action bar translation = Utils.getActionBarHeight(getContext()); } try { int immersive = android.provider.Settings.System.getInt(getContext().getContentResolver(), "immersive_mode"); if (immersive == 1) { mImmersive = true; } } catch (Exception e) { } statusTranslation = Utils.getStatusBarHeight(getContext()); actionBarTranslation = Utils.getActionBarHeight(getContext()); mProgressBar.setBounds(0, 0, width, mProgressBarHeight); if (getChildCount() == 0) { return; } final View child = getChildAt(0); final int childLeft = getPaddingLeft(); final int childTop = mCurrentTargetOffsetTop + getPaddingTop(); final int childWidth = width - getPaddingLeft() - getPaddingRight(); final int childHeight = height - getPaddingTop() - getPaddingBottom(); child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight); }
From source file:com.ferdi2005.secondgram.AndroidUtilities.java
public static void lockOrientation(Activity activity) { if (activity == null || prevOrientation != -10) { return;/* w w w . j a va 2 s . c o m*/ } try { prevOrientation = activity.getRequestedOrientation(); WindowManager manager = (WindowManager) activity.getSystemService(Activity.WINDOW_SERVICE); if (manager != null && manager.getDefaultDisplay() != null) { int rotation = manager.getDefaultDisplay().getRotation(); int orientation = activity.getResources().getConfiguration().orientation; if (rotation == Surface.ROTATION_270) { if (orientation == Configuration.ORIENTATION_PORTRAIT) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } } else if (rotation == Surface.ROTATION_90) { if (orientation == Configuration.ORIENTATION_PORTRAIT) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } else { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } } else if (rotation == Surface.ROTATION_0) { if (orientation == Configuration.ORIENTATION_LANDSCAPE) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } else { if (orientation == Configuration.ORIENTATION_LANDSCAPE) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } } } } catch (Exception e) { FileLog.e(e); } }
From source file:com.klinker.android.twitter.manipulations.widgets.swipe_refresh_layout.FullScreenSwipeRefreshLayout.java
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { final int width = getMeasuredWidth(); final int height = getMeasuredHeight(); ResourceHelper helper = new ResourceHelper(getContext(), "com.klinker.android.twitter"); if (Build.VERSION.SDK_INT > 18 && AppSettings.getInstance(getContext()).uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || helper.getBoolean("isTablet")) && !MainActivity.isPopup) { // action bar plus the status bar translation = Utils.getStatusBarHeight(getContext()) + Utils.getActionBarHeight(getContext()); } else {/* w ww . ja va2 s . co m*/ // just the action bar translation = Utils.getActionBarHeight(getContext()); } try { int immersive = android.provider.Settings.System.getInt(getContext().getContentResolver(), "immersive_mode"); if (immersive == 1) { mImmersive = true; } } catch (Exception e) { } statusTranslation = Utils.getStatusBarHeight(getContext()); actionBarTranslation = Utils.getActionBarHeight(getContext()); mProgressBar.setBounds(0, 0, width, mProgressBarHeight); if (getChildCount() == 0) { return; } final View child = getChildAt(0); final int childLeft = getPaddingLeft(); final int childTop = mCurrentTargetOffsetTop + getPaddingTop(); final int childWidth = width - getPaddingLeft() - getPaddingRight(); final int childHeight = height - getPaddingTop() - getPaddingBottom(); child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight); }
From source file:com.android.calendar.AllInOneActivity.java
@Override protected void onCreate(Bundle icicle) { if (Utils.getSharedPreference(this, OtherPreferences.KEY_OTHER_1, false)) { setTheme(R.style.CalendarTheme_WithActionBarWallpaper); }//from w w w .j av a 2 s . co m super.onCreate(icicle); dynamicTheme.onCreate(this); if (icicle != null && icicle.containsKey(BUNDLE_KEY_CHECK_ACCOUNTS)) { mCheckForAccounts = icicle.getBoolean(BUNDLE_KEY_CHECK_ACCOUNTS); } // Launch add google account if this is first time and there are no // accounts yet if (mCheckForAccounts && !Utils.getSharedPreference(this, GeneralPreferences.KEY_SKIP_SETUP, false)) { mHandler = new QueryHandler(this.getContentResolver()); mHandler.startQuery(0, null, Calendars.CONTENT_URI, new String[] { Calendars._ID }, null, null /* selection args */, null /* sort order */); } // This needs to be created before setContentView mController = CalendarController.getInstance(this); // Check and ask for most needed permissions checkAppPermissions(); // Get time from intent or icicle long timeMillis = -1; int viewType = -1; final Intent intent = getIntent(); if (icicle != null) { timeMillis = icicle.getLong(BUNDLE_KEY_RESTORE_TIME); viewType = icicle.getInt(BUNDLE_KEY_RESTORE_VIEW, -1); } else { String action = intent.getAction(); if (Intent.ACTION_VIEW.equals(action)) { // Open EventInfo later timeMillis = parseViewAction(intent); } if (timeMillis == -1) { timeMillis = Utils.timeFromIntentInMillis(intent); } } if (viewType == -1 || viewType > ViewType.MAX_VALUE) { viewType = Utils.getViewTypeFromIntentAndSharedPref(this); } mTimeZone = Utils.getTimeZone(this, mHomeTimeUpdater); Time t = new Time(mTimeZone); t.set(timeMillis); if (DEBUG) { if (icicle != null && intent != null) { Log.d(TAG, "both, icicle:" + icicle.toString() + " intent:" + intent.toString()); } else { Log.d(TAG, "not both, icicle:" + icicle + " intent:" + intent); } } Resources res = getResources(); mHideString = res.getString(R.string.hide_controls); mShowString = res.getString(R.string.show_controls); mOrientation = res.getConfiguration().orientation; if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) { mControlsAnimateWidth = (int) res.getDimension(R.dimen.calendar_controls_width); if (mControlsParams == null) { mControlsParams = new LayoutParams(mControlsAnimateWidth, 0); } mControlsParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } else { // Make sure width is in between allowed min and max width values mControlsAnimateWidth = Math.max(res.getDisplayMetrics().widthPixels * 45 / 100, (int) res.getDimension(R.dimen.min_portrait_calendar_controls_width)); mControlsAnimateWidth = Math.min(mControlsAnimateWidth, (int) res.getDimension(R.dimen.max_portrait_calendar_controls_width)); } mControlsAnimateHeight = (int) res.getDimension(R.dimen.calendar_controls_height); mHideControls = !Utils.getSharedPreference(this, GeneralPreferences.KEY_SHOW_CONTROLS, true); mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config); mIsTabletConfig = Utils.getConfigBool(this, R.bool.tablet_config); mShowAgendaWithMonth = Utils.getConfigBool(this, R.bool.show_agenda_with_month); mShowCalendarControls = Utils.getConfigBool(this, R.bool.show_calendar_controls); mShowEventDetailsWithAgenda = Utils.getConfigBool(this, R.bool.show_event_details_with_agenda); mShowEventInfoFullScreenAgenda = Utils.getConfigBool(this, R.bool.agenda_show_event_info_full_screen); mShowEventInfoFullScreen = Utils.getConfigBool(this, R.bool.show_event_info_full_screen); mCalendarControlsAnimationTime = res.getInteger(R.integer.calendar_controls_animation_time); Utils.setAllowWeekForDetailView(mIsMultipane); // setContentView must be called before configureActionBar setContentView(R.layout.all_in_one_material); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mNavigationView = (NavigationView) findViewById(R.id.navigation_view); mFab = (FloatingActionButton) findViewById(R.id.floating_action_button); if (mIsTabletConfig) { mDateRange = (TextView) findViewById(R.id.date_bar); mWeekTextView = (TextView) findViewById(R.id.week_num); } else { mDateRange = (TextView) getLayoutInflater().inflate(R.layout.date_range_title, null); } setupToolbar(viewType); setupNavDrawer(); setupFloatingActionButton(); mHomeTime = (TextView) findViewById(R.id.home_time); mMiniMonth = findViewById(R.id.mini_month); if (mIsTabletConfig && mOrientation == Configuration.ORIENTATION_PORTRAIT) { mMiniMonth.setLayoutParams( new RelativeLayout.LayoutParams(mControlsAnimateWidth, mControlsAnimateHeight)); } mCalendarsList = findViewById(R.id.calendar_list); mMiniMonthContainer = findViewById(R.id.mini_month_container); mSecondaryPane = findViewById(R.id.secondary_pane); // Must register as the first activity because this activity can modify // the list of event handlers in it's handle method. This affects who // the rest of the handlers the controller dispatches to are. mController.registerFirstEventHandler(HANDLER_KEY, this); initFragments(timeMillis, viewType, icicle); // Listen for changes that would require this to be refreshed SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this); prefs.registerOnSharedPreferenceChangeListener(this); mContentResolver = getContentResolver(); }