Changing AllApps checked visualization, fixing drag offset issue in AllApps/Customize.

- fixing previous change which clobbered pressed/focused state padding

Change-Id: I229d803322554e51bc9c1f15d3687b01b0f6679f
This commit is contained in:
Winson Chung
2010-12-09 18:52:32 -08:00
parent bf54662596
commit cd4bc491c4
8 changed files with 64 additions and 40 deletions

View File

@@ -16,6 +16,7 @@
package com.android.launcher2;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -28,7 +29,6 @@ import android.os.HandlerThread;
import android.os.Message;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.TextView;
import com.android.launcher.R;
import com.android.launcher2.PagedView.PagedViewIconCache;
@@ -56,6 +56,10 @@ public class PagedViewIcon extends CacheableTextView implements Checkable {
private int mHolographicAlpha;
private boolean mIsChecked;
private ObjectAnimator mCheckedAlphaAnimator;
private final static float sCheckedAlpha = 0.4f;
private final static int sCheckedFadeInDuration = 150;
private final static int sCheckedFadeOutDuration = 200;
// Highlight colors
private int mHoloBlurColor;
@@ -230,19 +234,24 @@ public class PagedViewIcon extends CacheableTextView implements Checkable {
if (mIsChecked != checked) {
mIsChecked = checked;
float alpha;
int duration;
if (mIsChecked) {
mCheckedOutline = Bitmap.createBitmap(mIcon.getWidth(), mIcon.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas checkedOutlineCanvas = new Canvas(mCheckedOutline);
mPaint.setAlpha(255);
checkedOutlineCanvas.drawBitmap(mIcon, 0, 0, mPaint);
sHolographicOutlineHelper.applyThickExpensiveOutlineWithBlur(mCheckedOutline,
checkedOutlineCanvas, mCheckedBlurColor, mCheckedOutlineColor);
alpha = sCheckedAlpha;
duration = sCheckedFadeInDuration;
} else {
invalidateCheckedImage();
alpha = 1.0f;
duration = sCheckedFadeOutDuration;
}
// Initialize the animator
if (mCheckedAlphaAnimator != null) {
mCheckedAlphaAnimator.cancel();
}
mCheckedAlphaAnimator = ObjectAnimator.ofFloat(this, "alpha", alpha);
mCheckedAlphaAnimator.setDuration(duration);
mCheckedAlphaAnimator.start();
invalidate();
}
}