am 6cfc7a0a: Merge "Fix bug 3365208 - Contextual Action Bar is not displayed when the context item is changing" into honeycomb

* commit '6cfc7a0acb0d3b202ae1dbee88e7e8bdfaee5590':
  Fix bug 3365208 - Contextual Action Bar is not displayed when the context item is changing
This commit is contained in:
Adam Powell
2011-01-18 18:39:10 -08:00
committed by Android Git Automerger
3 changed files with 5 additions and 7 deletions

View File

@@ -388,6 +388,7 @@ public class ActionBarImpl extends ActionBar {
mActionMode.finish(); mActionMode.finish();
} }
mUpperContextView.killMode();
ActionMode mode = new ActionModeImpl(callback); ActionMode mode = new ActionModeImpl(callback);
if (callback.onCreateActionMode(mode, mode.getMenu())) { if (callback.onCreateActionMode(mode, mode.getMenu())) {
mode.invalidate(); mode.invalidate();

View File

@@ -160,10 +160,6 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
} }
public void initForMode(final ActionMode mode) { public void initForMode(final ActionMode mode) {
if (mAnimationMode != ANIMATE_IDLE || mAnimateInOnLayout) {
killMode();
}
if (mClose == null) { if (mClose == null) {
LayoutInflater inflater = LayoutInflater.from(mContext); LayoutInflater inflater = LayoutInflater.from(mContext);
mClose = inflater.inflate(R.layout.action_mode_close_item, this, false); mClose = inflater.inflate(R.layout.action_mode_close_item, this, false);
@@ -198,15 +194,15 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
return; return;
} }
mAnimationMode = ANIMATE_OUT;
finishAnimation(); finishAnimation();
mAnimationMode = ANIMATE_OUT;
mCurrentAnimation = makeOutAnimation(); mCurrentAnimation = makeOutAnimation();
mCurrentAnimation.start(); mCurrentAnimation.start();
} }
private void finishAnimation() { private void finishAnimation() {
final Animator a = mCurrentAnimation; final Animator a = mCurrentAnimation;
if (a != null && a.isRunning()) { if (a != null) {
mCurrentAnimation = null; mCurrentAnimation = null;
a.end(); a.end();
} }
@@ -448,7 +444,7 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
if (mAnimationMode != ANIMATE_IN) { if (mAnimationMode == ANIMATE_OUT) {
killMode(); killMode();
} }
mAnimationMode = ANIMATE_IDLE; mAnimationMode = ANIMATE_IDLE;

View File

@@ -1985,6 +1985,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
} }
if (mActionModeView != null) { if (mActionModeView != null) {
mActionModeView.killMode();
mode = new StandaloneActionMode(getContext(), mActionModeView, wrappedCallback); mode = new StandaloneActionMode(getContext(), mActionModeView, wrappedCallback);
if (callback.onCreateActionMode(mode, mode.getMenu())) { if (callback.onCreateActionMode(mode, mode.getMenu())) {
mode.invalidate(); mode.invalidate();