summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/DragLayer.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-02-16 23:53:59 -0800
committerAdam Cohen <adamcohen@google.com>2012-02-27 17:30:32 -0800
commitd41fbf5680750e34335bba6b38298186c144a4b7 (patch)
treedea77d6aa9211dc085e4bb29aac18e9deef601c5 /src/com/android/launcher2/DragLayer.java
parenta95d329dea8c1aa09f50cc7ca897f454b161a454 (diff)
downloadandroid_packages_apps_Trebuchet-d41fbf5680750e34335bba6b38298186c144a4b7.tar.gz
android_packages_apps_Trebuchet-d41fbf5680750e34335bba6b38298186c144a4b7.tar.bz2
android_packages_apps_Trebuchet-d41fbf5680750e34335bba6b38298186c144a4b7.zip
When adding or moving a resizable widget, the widget may resize
-> If a widget is resizable, and there is not enough room to add it in its current (or default) size, but can be scaled down to fit a certain area, it will be resized to fit the available space -> The resizing is animated using a crossfade and scale between the original dragView and the widget rendered in the final size Change-Id: I75db9dcabecce11598b3ae55f20b96b2ec6b7e87
Diffstat (limited to 'src/com/android/launcher2/DragLayer.java')
-rw-r--r--src/com/android/launcher2/DragLayer.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 7bc9bc8b1..a3b389d24 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -458,7 +458,7 @@ public class DragLayer extends FrameLayout {
toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
} else if (child instanceof FolderIcon) {
// Account for holographic blur padding on the drag view
- toY -= HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS / 2;
+ toY -= Workspace.DRAG_BITMAP_PADDING / 2;
// Center in the x coordinate about the target's drawable
toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
} else {
@@ -470,28 +470,19 @@ public class DragLayer extends FrameLayout {
final int fromX = r.left;
final int fromY = r.top;
child.setVisibility(INVISIBLE);
- child.setAlpha(0);
Runnable onCompleteRunnable = new Runnable() {
public void run() {
child.setVisibility(VISIBLE);
- ObjectAnimator oa = ObjectAnimator.ofFloat(child, "alpha", 0f, 1f);
- oa.setDuration(60);
- oa.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(android.animation.Animator animation) {
- if (onFinishAnimationRunnable != null) {
- onFinishAnimationRunnable.run();
- }
- }
- });
- oa.start();
+ if (onFinishAnimationRunnable != null) {
+ onFinishAnimationRunnable.run();
+ }
}
};
animateViewIntoPosition(dragView, fromX, fromY, toX, toY, 1, 1, 1, scale, scale,
- onCompleteRunnable, ANIMATION_END_FADE_OUT, duration, anchorView);
+ onCompleteRunnable, ANIMATION_END_DISAPPEAR, duration, anchorView);
}
- private void animateViewIntoPosition(final DragView view, final int fromX, final int fromY,
+ public void animateViewIntoPosition(final DragView view, final int fromX, final int fromY,
final int toX, final int toY, float finalAlpha, float initScaleX, float initScaleY,
float finalScaleX, float finalScaleY, Runnable onCompleteRunnable,
int animationEndStyle, int duration, View anchorView) {