Index: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java |
index a227ef07873ad69287375c247956d6ec7c9d0600..806c6f42a175fe29140dcd471d41df02f569901f 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java |
@@ -4,6 +4,8 @@ |
package org.chromium.chrome.browser.appmenu; |
+import android.animation.Animator; |
+import android.animation.AnimatorSet; |
import android.content.Context; |
import android.content.res.Resources; |
import android.graphics.Rect; |
@@ -134,6 +136,15 @@ public class AppMenu implements OnItemClickListener, OnKeyListener { |
mPopup.getListView().setVerticalFadingEdgeEnabled(true); |
mPopup.getListView().setFadingEdgeLength(mVerticalFadeDistance); |
} |
+ |
+ mPopup.getListView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() { |
+ @Override |
+ public void onLayoutChange(View v, int left, int top, int right, int bottom, |
+ int oldLeft, int oldTop, int oldRight, int oldBottom) { |
+ mPopup.getListView().removeOnLayoutChangeListener(this); |
+ runMenuItemEnterAnimations(); |
+ } |
+ }); |
} |
private void setPopupOffset(ListPopupWindow popup, int screenRotation, Rect appRect) { |
@@ -212,7 +223,10 @@ public class AppMenu implements OnItemClickListener, OnKeyListener { |
*/ |
void dismiss() { |
mHandler.appMenuDismissed(); |
- if (isShowing()) mPopup.dismiss(); |
+ if (isShowing()) { |
+ runMenuItemExitAnimations(); |
+ mPopup.dismiss(); |
+ } |
} |
/** |
@@ -264,4 +278,32 @@ public class AppMenu implements OnItemClickListener, OnKeyListener { |
mPopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); |
} |
} |
+ |
+ private void runMenuItemEnterAnimations() { |
+ runMenuItemAnimators(R.id.menu_item_enter_anim_id); |
+ } |
+ |
+ private void runMenuItemExitAnimations() { |
+ runMenuItemAnimators(R.id.menu_item_exit_anim_id); |
+ } |
+ |
+ private void runMenuItemAnimators(int animationTagId) { |
+ AnimatorSet animation = new AnimatorSet(); |
+ AnimatorSet.Builder builder = null; |
+ |
+ ViewGroup list = mPopup.getListView(); |
aurimas (slooooooooow)
2014/07/15 01:37:25
Should we be animating the views that are currentl
David Trainor- moved to gerrit
2014/07/15 20:53:38
This will animate all the views that are currently
|
+ for (int i = 0; i < list.getChildCount(); i++) { |
+ View view = list.getChildAt(i); |
+ Object animatorObject = view.getTag(animationTagId); |
+ if (animatorObject != null) { |
+ if (builder == null) { |
+ builder = animation.play((Animator) animatorObject); |
+ } else { |
+ builder.with((Animator) animatorObject); |
+ } |
+ } |
+ } |
+ |
+ animation.start(); |
+ } |
} |