Merge "QS Anim tweaks" into nyc-dev
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
index 815c679..0b6eaba 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
@@ -41,7 +41,7 @@
     private static final String MOVE_FULL_ROWS = "sysui_qs_move_whole_rows";
 
     public static final float EXPANDED_TILE_DELAY = .7f;
-    private static final float LAST_ROW_EXPANDED_DELAY = .84f;
+    private static final float LAST_ROW_EXPANDED_DELAY = .86f;
 
     private final ArrayList<View> mAllViews = new ArrayList<>();
     private final ArrayList<View> mTopFiveQs = new ArrayList<>();
@@ -139,7 +139,9 @@
         int count = 0;
         int[] loc1 = new int[2];
         int[] loc2 = new int[2];
+        int lastXDiff = 0;
         int lastYDiff = 0;
+        int lastX = 0;
 
         clearAnimationState();
         mAllViews.clear();
@@ -155,10 +157,12 @@
                 // Quick tiles.
                 QSTileBaseView quickTileView = mQuickQsPanel.getTileView(tile);
 
+                lastX = loc1[0];
                 getRelativePosition(loc1, quickTileView.getIcon(), mQsContainer);
                 getRelativePosition(loc2, tileIcon, mQsContainer);
                 final int xDiff = loc2[0] - loc1[0];
                 final int yDiff = loc2[1] - loc1[1];
+                lastXDiff = loc1[0] - lastX;
                 lastYDiff = yDiff;
                 // Move the quick tile right from its location to the new one.
                 translationXBuilder.addFloat(quickTileView, "translationX", 0, xDiff);
@@ -177,9 +181,20 @@
                 mAllViews.add(tileIcon);
                 mAllViews.add(quickTileView);
             } else if (mFullRows && isIconInAnimatedRow(count)) {
+                // TODO: Refactor some of this, it shares a lot with the above block.
+                // Move the last tile position over by the last difference between quick tiles.
+                // This makes the extra icons seems as if they are coming from positions in the
+                // quick panel.
+                loc1[0] += lastXDiff;
+                getRelativePosition(loc2, tileIcon, mQsContainer);
+                final int xDiff = loc2[0] - loc1[0];
+                final int yDiff = loc2[1] - loc1[1];
+
                 firstPageBuilder.addFloat(tileView, "translationY", mQsPanel.getHeight(), 0);
-                translationYBuilder.addFloat(label, "translationY", -lastYDiff, 0);
-                translationYBuilder.addFloat(tileIcon, "translationY", -lastYDiff, 0);
+                translationXBuilder.addFloat(tileView, "translationX", -xDiff, 0);
+                translationYBuilder.addFloat(label, "translationY", -yDiff, 0);
+                translationYBuilder.addFloat(tileIcon, "translationY", -yDiff, 0);
+
                 mAllViews.add(tileIcon);
             } else {
                 lastRowBuilder.addFloat(tileView, "alpha", 0, 1);