List of usage examples for android.app Activity onConfigurationChanged
public void onConfigurationChanged(Configuration newConfig)
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;//ww 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.custom.music.MusicBrowserActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Log.i(TAG, "<onConfigurationChanged>", Log.APP); TabWidget tabWidgetTemp = mTabHost.getTabWidget(); View tabView;//from w ww. j ava2s.c om Activity activity; int viewStatusForTab = View.GONE; mOrientaiton = newConfig.orientation; if (mOrientaiton == Configuration.ORIENTATION_LANDSCAPE) { Log.i(TAG, "onConfigurationChanged--LandScape", Log.APP); viewStatusForTab = View.VISIBLE; } if (mService != null) { MusicUtils.updateNowPlaying(MusicBrowserActivity.this, mOrientaiton); updatePlaybackTab(); } /// 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(); Log.i(TAG, "changeFakeMenu:mPopupMenu.dismiss()", Log.APP); } Log.i(TAG, "changeFakeMenu:popupMenuShowing=" + popupMenuShowing, Log.APP); createFakeMenu(); if (popupMenuShowing && mOverflowMenuButton != null) { mOverflowMenuButton.performClick(); Log.i(TAG, "changeFakeMenu:performClick()", Log.APP); } } Log.i(TAG, "onConfigurationChanged >>>", Log.APP); }