diff options
Diffstat (limited to 'src/com/android/launcher2/CellLayout.java')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 76 |
1 files changed, 38 insertions, 38 deletions
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; } } |