Merge "Adding animation post-installing a shortcut."

This commit is contained in:
Winson Chung
2012-03-23 14:54:09 -07:00
committed by Android (Google) Code Review
8 changed files with 215 additions and 57 deletions
+20
View File
@@ -184,6 +184,7 @@ public class Workspace extends SmoothPagedView
WallpaperOffsetInterpolator mWallpaperOffset;
boolean mUpdateWallpaperOffsetImmediately = false;
private Runnable mDelayedResizeRunnable;
private Runnable mDelayedSnapToPageRunnable;
private int mDisplayWidth;
private int mDisplayHeight;
private boolean mIsStaticWallpaper;
@@ -766,6 +767,11 @@ public class Workspace extends SmoothPagedView
mDelayedResizeRunnable.run();
mDelayedResizeRunnable = null;
}
if (mDelayedSnapToPageRunnable != null) {
mDelayedSnapToPageRunnable.run();
mDelayedSnapToPageRunnable = null;
}
}
@Override
@@ -907,6 +913,20 @@ public class Workspace extends SmoothPagedView
computeWallpaperScrollRatio(whichPage);
}
@Override
protected void snapToPage(int whichPage, int duration) {
super.snapToPage(whichPage, duration);
computeWallpaperScrollRatio(whichPage);
}
protected void snapToPage(int whichPage, Runnable r) {
if (mDelayedSnapToPageRunnable != null) {
mDelayedSnapToPageRunnable.run();
}
mDelayedSnapToPageRunnable = r;
snapToPage(whichPage, SLOW_PAGE_SNAP_ANIMATION_DURATION);
}
private void computeWallpaperScrollRatio(int page) {
// Here, we determine what the desired scroll would be with and without a layout scale,
// and compute a ratio between the two. This allows us to adjust the wallpaper offset