diff options
-rw-r--r-- | res/values-xlarge/config.xml | 9 | ||||
-rw-r--r-- | res/values/config.xml | 9 | ||||
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 76 |
3 files changed, 47 insertions, 47 deletions
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml index c7c68e2..73e7146 100644 --- a/res/values-xlarge/config.xml +++ b/res/values-xlarge/config.xml @@ -27,8 +27,6 @@ <integer name="config_toolbarButtonFadeInTime">350</integer> <integer name="config_toolbarButtonFadeOutTime">350</integer> - <integer name="config_crosshairsFadeInTime">600</integer> - <!-- When dragging items on the workspace, how much bigger (in pixels) the dragged view should be, as compared to the original view. If 0, it will not be scaled at all. Should be an even number, for pixel alignment. --> @@ -38,11 +36,4 @@ the drag view should be offset from the position of the original view. --> <integer name="config_dragViewOffsetX">0</integer> <integer name="config_dragViewOffsetY">12</integer> - - <!-- The duration (in ms) of the fade animation on the object outlines, used when - we are dragging objects around on the home screen. --> - <integer name="config_dragOutlineFadeTime">900</integer> - - <!-- The alpha value at which to show the most recent drop visualization outline. --> - <integer name="config_dragOutlineMaxAlpha">180</integer> </resources> diff --git a/res/values/config.xml b/res/values/config.xml index db967ea..b6d5037 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -5,6 +5,8 @@ <integer name="config_allAppsBatchSize">0</integer> <bool name="config_hardwareAccelerated">false</bool> + <integer name="config_crosshairsFadeInTime">600</integer> + <!-- When dragging an item on the workspace, how much bigger (in pixels) the dragged view should be, as compared to the original view. If 0, it will not be scaled at all. Should be an even number, for pixel alignment. --> @@ -15,4 +17,11 @@ Setting to 1/2 of config_dragViewExtraPixels keeps it centered on its old position. --> <integer name="config_dragViewOffsetX">20</integer> <integer name="config_dragViewOffsetY">20</integer> + + <!-- The duration (in ms) of the fade animation on the object outlines, used when + we are dragging objects around on the home screen. --> + <integer name="config_dragOutlineFadeTime">900</integer> + + <!-- The alpha value at which to show the most recent drop visualization outline. --> + <integer name="config_dragOutlineMaxAlpha">180</integer> </resources> diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 7da6612..3f9945f 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -145,57 +145,57 @@ public class CellLayout extends ViewGroup implements Dimmable { mWallpaperManager = WallpaperManager.getInstance(context); - if (LauncherApplication.isScreenXLarge()) { - final Resources res = getResources(); + final Resources res = getResources(); + if (LauncherApplication.isScreenXLarge()) { mBackgroundMini = res.getDrawable(R.drawable.mini_home_screen_bg); mBackgroundMini.setFilterBitmap(true); mBackground = res.getDrawable(R.drawable.home_screen_bg); mBackground.setFilterBitmap(true); mBackgroundMiniHover = res.getDrawable(R.drawable.mini_home_screen_bg_hover); mBackgroundMiniHover.setFilterBitmap(true); + } + + // Initialize the data structures used for the drag visualization. - // Initialize the data structures used for the drag visualization. + mDragRectDrawable = res.getDrawable(R.drawable.rounded_rect_green); + mCrosshairsDrawable = res.getDrawable(R.drawable.gardening_crosshairs); + Interpolator interp = new DecelerateInterpolator(2.5f); // Quint ease out - mDragRectDrawable = res.getDrawable(R.drawable.rounded_rect_green); - mCrosshairsDrawable = res.getDrawable(R.drawable.gardening_crosshairs); - Interpolator interp = new DecelerateInterpolator(2.5f); // Quint ease out + // Set up the animation for fading the crosshairs in and out + int animDuration = res.getInteger(R.integer.config_crosshairsFadeInTime); + mCrosshairsAnimator = new ValueAnimator<Float>(animDuration); + mCrosshairsAnimator.addUpdateListener(new AnimatorUpdateListener() { + public void onAnimationUpdate(ValueAnimator animation) { + mCrosshairsVisibility = ((Float) animation.getAnimatedValue()).floatValue(); + CellLayout.this.invalidate(); + } + }); + mCrosshairsAnimator.setInterpolator(interp); + + for (int i = 0; i < mDragRects.length; i++) { + mDragRects[i] = new Rect(); + } - // Set up the animation for fading the crosshairs in and out - int animDuration = res.getInteger(R.integer.config_crosshairsFadeInTime); - mCrosshairsAnimator = new ValueAnimator<Float>(animDuration); - mCrosshairsAnimator.addUpdateListener(new AnimatorUpdateListener() { + // When dragging things around the home screens, we show a green outline of + // where the item will land. The outlines gradually fade out, leaving a trail + // behind the drag path. + // Set up all the animations that are used to implement this fading. + final int duration = res.getInteger(R.integer.config_dragOutlineFadeTime); + final int fromAlphaValue = 0; + final int toAlphaValue = res.getInteger(R.integer.config_dragOutlineMaxAlpha); + for (int i = 0; i < mDragRectAnims.length; i++) { + final InterruptibleInOutAnimator anim = + new InterruptibleInOutAnimator(duration, fromAlphaValue, toAlphaValue); + anim.setInterpolator(interp); + final int thisIndex = i; + anim.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { - mCrosshairsVisibility = ((Float) animation.getAnimatedValue()).floatValue(); - CellLayout.this.invalidate(); + mDragRectAlphas[thisIndex] = (Integer) animation.getAnimatedValue(); + CellLayout.this.invalidate(mDragRects[thisIndex]); } }); - mCrosshairsAnimator.setInterpolator(interp); - - for (int i = 0; i < mDragRects.length; i++) { - mDragRects[i] = new Rect(); - } - - // When dragging things around the home screens, we show a green outline of - // where the item will land. The outlines gradually fade out, leaving a trail - // behind the drag path. - // Set up all the animations that are used to implement this fading. - final int duration = res.getInteger(R.integer.config_dragOutlineFadeTime); - final int fromAlphaValue = 0; - final int toAlphaValue = res.getInteger(R.integer.config_dragOutlineMaxAlpha); - for (int i = 0; i < mDragRectAnims.length; i++) { - final InterruptibleInOutAnimator anim = - new InterruptibleInOutAnimator(duration, fromAlphaValue, toAlphaValue); - anim.setInterpolator(interp); - final int thisIndex = i; - anim.addUpdateListener(new AnimatorUpdateListener() { - public void onAnimationUpdate(ValueAnimator animation) { - mDragRectAlphas[thisIndex] = (Integer) animation.getAnimatedValue(); - CellLayout.this.invalidate(mDragRects[thisIndex]); - } - }); - mDragRectAnims[i] = anim; - } + mDragRectAnims[i] = anim; } } |