OSDN Git Service

Fix bug 3365208 - Contextual Action Bar is not displayed when the context item is...
authorAdam Powell <adamp@google.com>
Wed, 19 Jan 2011 00:51:22 +0000 (16:51 -0800)
committerAdam Powell <adamp@google.com>
Wed, 19 Jan 2011 00:51:22 +0000 (16:51 -0800)
Change-Id: I9e7ec4ab14c6008397d26c499ccf478f8875f918

core/java/com/android/internal/app/ActionBarImpl.java
core/java/com/android/internal/widget/ActionBarContextView.java
policy/src/com/android/internal/policy/impl/PhoneWindow.java

index 0e31fef..a8eb6fe 100644 (file)
@@ -388,6 +388,7 @@ public class ActionBarImpl extends ActionBar {
             mActionMode.finish();
         }
 
+        mUpperContextView.killMode();
         ActionMode mode = new ActionModeImpl(callback);
         if (callback.onCreateActionMode(mode, mode.getMenu())) {
             mode.invalidate();
index 31e7bab..bb0c752 100644 (file)
@@ -160,10 +160,6 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
     }
 
     public void initForMode(final ActionMode mode) {
-        if (mAnimationMode != ANIMATE_IDLE || mAnimateInOnLayout) {
-            killMode();
-        }
-
         if (mClose == null) {
             LayoutInflater inflater = LayoutInflater.from(mContext);
             mClose = inflater.inflate(R.layout.action_mode_close_item, this, false);
@@ -198,15 +194,15 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
             return;
         }
 
-        mAnimationMode = ANIMATE_OUT;
         finishAnimation();
+        mAnimationMode = ANIMATE_OUT;
         mCurrentAnimation = makeOutAnimation();
         mCurrentAnimation.start();
     }
 
     private void finishAnimation() {
         final Animator a = mCurrentAnimation;
-        if (a != null && a.isRunning()) {
+        if (a != null) {
             mCurrentAnimation = null;
             a.end();
         }
@@ -448,7 +444,7 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
 
     @Override
     public void onAnimationEnd(Animator animation) {
-        if (mAnimationMode != ANIMATE_IN) {
+        if (mAnimationMode == ANIMATE_OUT) {
             killMode();
         }
         mAnimationMode = ANIMATE_IDLE;
index 68c1453..646b719 100644 (file)
@@ -1983,6 +1983,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                 }
 
                 if (mActionModeView != null) {
+                    mActionModeView.killMode();
                     mode = new StandaloneActionMode(getContext(), mActionModeView, wrappedCallback);
                     if (callback.onCreateActionMode(mode, mode.getMenu())) {
                         mode.invalidate();