Loading core/java/android/app/ActionBar.java +4 −0 Original line number Diff line number Diff line Loading @@ -1082,6 +1082,10 @@ public abstract class ActionBar { return false; } /** @hide */ public void onDestroy() { } /** * Common implementation for requestFocus that takes in the Toolbar and moves focus * to the contents. This makes the ViewGroups containing the toolbar allow focus while it stays Loading core/java/android/app/Activity.java +14 −2 Original line number Diff line number Diff line Loading @@ -1703,6 +1703,10 @@ public class Activity extends ContextThemeWrapper mSearchManager.stopSearch(); } if (mActionBar != null) { mActionBar.onDestroy(); } getApplication().dispatchActivityDestroyed(this); } Loading Loading @@ -2208,14 +2212,22 @@ public class Activity extends ContextThemeWrapper * @param toolbar Toolbar to set as the Activity's action bar */ public void setActionBar(@Nullable Toolbar toolbar) { if (getActionBar() instanceof WindowDecorActionBar) { final ActionBar ab = getActionBar(); if (ab instanceof WindowDecorActionBar) { throw new IllegalStateException("This Activity already has an action bar supplied " + "by the window decor. Do not request Window.FEATURE_ACTION_BAR and set " + "android:windowActionBar to false in your theme to use a Toolbar instead."); } // Clear out the MenuInflater to make sure that it is valid for the new Action Bar // If we reach here then we're setting a new action bar // First clear out the MenuInflater to make sure that it is valid for the new Action Bar mMenuInflater = null; // If we have an action bar currently, destroy it if (ab != null) { ab.onDestroy(); } ToolbarActionBar tbab = new ToolbarActionBar(toolbar, getTitle(), this); mActionBar = tbab; mWindow.setCallback(tbab.getWrappedWindowCallback()); Loading core/java/com/android/internal/app/ToolbarActionBar.java +6 −0 Original line number Diff line number Diff line Loading @@ -483,6 +483,12 @@ public class ToolbarActionBar extends ActionBar { return true; } @Override public void onDestroy() { // Remove any invalidation callbacks mDecorToolbar.getViewGroup().removeCallbacks(mMenuInvalidator); } public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) { mMenuVisibilityListeners.add(listener); } Loading Loading
core/java/android/app/ActionBar.java +4 −0 Original line number Diff line number Diff line Loading @@ -1082,6 +1082,10 @@ public abstract class ActionBar { return false; } /** @hide */ public void onDestroy() { } /** * Common implementation for requestFocus that takes in the Toolbar and moves focus * to the contents. This makes the ViewGroups containing the toolbar allow focus while it stays Loading
core/java/android/app/Activity.java +14 −2 Original line number Diff line number Diff line Loading @@ -1703,6 +1703,10 @@ public class Activity extends ContextThemeWrapper mSearchManager.stopSearch(); } if (mActionBar != null) { mActionBar.onDestroy(); } getApplication().dispatchActivityDestroyed(this); } Loading Loading @@ -2208,14 +2212,22 @@ public class Activity extends ContextThemeWrapper * @param toolbar Toolbar to set as the Activity's action bar */ public void setActionBar(@Nullable Toolbar toolbar) { if (getActionBar() instanceof WindowDecorActionBar) { final ActionBar ab = getActionBar(); if (ab instanceof WindowDecorActionBar) { throw new IllegalStateException("This Activity already has an action bar supplied " + "by the window decor. Do not request Window.FEATURE_ACTION_BAR and set " + "android:windowActionBar to false in your theme to use a Toolbar instead."); } // Clear out the MenuInflater to make sure that it is valid for the new Action Bar // If we reach here then we're setting a new action bar // First clear out the MenuInflater to make sure that it is valid for the new Action Bar mMenuInflater = null; // If we have an action bar currently, destroy it if (ab != null) { ab.onDestroy(); } ToolbarActionBar tbab = new ToolbarActionBar(toolbar, getTitle(), this); mActionBar = tbab; mWindow.setCallback(tbab.getWrappedWindowCallback()); Loading
core/java/com/android/internal/app/ToolbarActionBar.java +6 −0 Original line number Diff line number Diff line Loading @@ -483,6 +483,12 @@ public class ToolbarActionBar extends ActionBar { return true; } @Override public void onDestroy() { // Remove any invalidation callbacks mDecorToolbar.getViewGroup().removeCallbacks(mMenuInvalidator); } public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) { mMenuVisibilityListeners.add(listener); } Loading