summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/CellLayout.java
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2010-10-14 13:21:48 -0700
committerPatrick Dubroy <dubroy@google.com>2010-10-20 14:37:49 -0700
commit8e58e916061cbe2623697efac0924f2aa3753a92 (patch)
treea0350aadf47041a62cf81aa1230a3a6769b6bb97 /src/com/android/launcher2/CellLayout.java
parentce34a9768b01115def95f000a6a8f35870f10d3a (diff)
downloadandroid_packages_apps_Trebuchet-8e58e916061cbe2623697efac0924f2aa3753a92.tar.gz
android_packages_apps_Trebuchet-8e58e916061cbe2623697efac0924f2aa3753a92.tar.bz2
android_packages_apps_Trebuchet-8e58e916061cbe2623697efac0924f2aa3753a92.zip
Various cleanups in the drag viz code.
Most importantly: - Don't allocate a new Paint object in CellLayout.onDraw - Scale holographic outlines based on the screen density
Diffstat (limited to 'src/com/android/launcher2/CellLayout.java')
-rw-r--r--src/com/android/launcher2/CellLayout.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index c9be887d3..d94bacfbf 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -49,6 +49,8 @@ import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LayoutAnimationController;
+import java.util.Arrays;
+
public class CellLayout extends ViewGroup implements Dimmable {
static final String TAG = "CellLayout";
@@ -107,6 +109,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
// Used as an index into the above 3 arrays; indicates which is the most current value.
private int mDragOutlineCurrent = 0;
+ private final Paint mDragOutlinePaint = new Paint();
private Drawable mCrosshairsDrawable = null;
private InterruptibleInOutAnimator mCrosshairsAnimator = null;
@@ -188,7 +191,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
mCrosshairsAnimator.getAnimator().addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
mCrosshairsVisibility = ((Float) animation.getAnimatedValue()).floatValue();
- CellLayout.this.invalidate();
+ invalidate();
}
});
mCrosshairsAnimator.getAnimator().setInterpolator(mEaseOutInterpolator);
@@ -205,9 +208,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
final float fromAlphaValue = 0;
final float toAlphaValue = (float)res.getInteger(R.integer.config_dragOutlineMaxAlpha);
- for (int i = 0; i < mDragOutlineAlphas.length; i++) {
- mDragOutlineAlphas[i] = fromAlphaValue;
- }
+ Arrays.fill(mDragOutlineAlphas, fromAlphaValue);
for (int i = 0; i < mDragOutlineAnims.length; i++) {
final InterruptibleInOutAnimator anim =
@@ -404,7 +405,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
}
}
- final Paint paint = new Paint();
+ final Paint paint = mDragOutlinePaint;
for (int i = 0; i < mDragOutlines.length; i++) {
final float alpha = mDragOutlineAlphas[i];
if (alpha > 0) {