diff options
author | Adam Powell <adamp@google.com> | 2010-08-20 18:34:46 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2010-08-23 10:24:49 -0700 |
commit | 6c6f575423d6718c3ff322224c1520901ce881e1 (patch) | |
tree | 7432af19bf495397df8d398fc87a4b8786e6cdd8 /policy/src | |
parent | d62847997be926991424e4fba30ff3f5ef71258b (diff) | |
download | frameworks_base-6c6f575423d6718c3ff322224c1520901ce881e1.zip frameworks_base-6c6f575423d6718c3ff322224c1520901ce881e1.tar.gz frameworks_base-6c6f575423d6718c3ff322224c1520901ce881e1.tar.bz2 |
More ActionBar/config change tweaks. Preserve open overflow menus
Change-Id: Ic8ad2b1e3909fbf84ff4d852ae046a9f9508477c
Diffstat (limited to 'policy/src')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 2bb4456..2dabf72 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -364,29 +364,32 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { @Override public void onConfigurationChanged(Configuration newConfig) { - PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false); - if ((st != null) && (st.menu != null)) { - final MenuBuilder menuBuilder = (MenuBuilder) st.menu; + // Action bars handle their own menu state + if (mActionBar == null) { + PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false); + if ((st != null) && (st.menu != null)) { + final MenuBuilder menuBuilder = (MenuBuilder) st.menu; - if (st.isOpen) { - // Freeze state - final Bundle state = new Bundle(); - menuBuilder.saveHierarchyState(state); + if (st.isOpen) { + // Freeze state + final Bundle state = new Bundle(); + menuBuilder.saveHierarchyState(state); - // Remove the menu views since they need to be recreated - // according to the new configuration - clearMenuViews(st); + // Remove the menu views since they need to be recreated + // according to the new configuration + clearMenuViews(st); - // Re-open the same menu - reopenMenu(false); + // Re-open the same menu + reopenMenu(false); - // Restore state - menuBuilder.restoreHierarchyState(state); + // Restore state + menuBuilder.restoreHierarchyState(state); - } else { - // Clear menu views so on next menu opening, it will use - // the proper layout - clearMenuViews(st); + } else { + // Clear menu views so on next menu opening, it will use + // the proper layout + clearMenuViews(st); + } } } } @@ -1515,6 +1518,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { static private final String FOCUSED_ID_TAG = "android:focusedViewId"; static private final String VIEWS_TAG = "android:views"; static private final String PANELS_TAG = "android:Panels"; + static private final String ACTION_BAR_TAG = "android:ActionBar"; /** {@inheritDoc} */ @Override @@ -1548,6 +1552,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { outState.putSparseParcelableArray(PANELS_TAG, panelStates); } + if (mActionBar != null) { + outState.putBoolean(ACTION_BAR_TAG, mActionBar.isOverflowMenuShowing()); + } + return outState; } @@ -1582,6 +1590,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (panelStates != null) { restorePanelState(panelStates); } + + if (mActionBar != null && savedInstanceState.getBoolean(ACTION_BAR_TAG)) { + mActionBar.postShowOverflowMenu(); + } } /** |