summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-11-08 11:54:39 -0500
committerJoe Onorato <joeo@android.com>2009-11-08 12:06:04 -0500
commitc61cff9299a54599c2b214de7c819b6be0412f4e (patch)
tree1eff949fb9b4f8a78781ac99dcdea0286350ef8f
parent487de5d1b283bf1009e77e8223503bfbd180713b (diff)
downloadandroid_packages_apps_Trebuchet-c61cff9299a54599c2b214de7c819b6be0412f4e.tar.gz
android_packages_apps_Trebuchet-c61cff9299a54599c2b214de7c819b6be0412f4e.tar.bz2
android_packages_apps_Trebuchet-c61cff9299a54599c2b214de7c819b6be0412f4e.zip
Make the selection indicator and the focus indicator in 3d all apps different colors. Bug 2239818.
-rw-r--r--src/com/android/launcher2/AllAppsView.java23
-rw-r--r--src/com/android/launcher2/Utilities.java15
2 files changed, 25 insertions, 13 deletions
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java
index 37eb21636..3f3b45254 100644
--- a/src/com/android/launcher2/AllAppsView.java
+++ b/src/com/android/launcher2/AllAppsView.java
@@ -213,7 +213,7 @@ public class AllAppsView extends RSSurfaceView
}
// Select the first icon when we gain window focus
- mRollo.selectIcon(selection);
+ mRollo.selectIcon(selection, false);
mRollo.mState.save();
}
}
@@ -232,7 +232,8 @@ public class AllAppsView extends RSSurfaceView
if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
// Select the first icon when we gain keyboard focus
mArrowNavigation = true;
- mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
+ mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,
+ false);
mRollo.mState.save();
}
} else {
@@ -327,7 +328,7 @@ public class AllAppsView extends RSSurfaceView
break;
}
if (newSelection != currentSelection) {
- mRollo.selectIcon(newSelection);
+ mRollo.selectIcon(newSelection, false);
mRollo.mState.save();
}
}
@@ -373,7 +374,7 @@ public class AllAppsView extends RSSurfaceView
mRollo.clearSelectedIcon();
} else {
mDownIconIndex = mCurrentIconIndex
- = mRollo.selectIcon(x, y, mRollo.mMessageProc.mPosX);
+ = mRollo.selectIcon(x, y, mRollo.mMessageProc.mPosX, true);
if (mDownIconIndex < 0) {
// if nothing was selected, no long press.
cancelLongPress();
@@ -1171,13 +1172,19 @@ public class AllAppsView extends RSSurfaceView
*
* @return the index of the icon that was selected.
*/
- int selectIcon(int x, int y, float pos) {
+ int selectIcon(int x, int y, float pos, boolean selected) {
final int index = chooseTappedIcon(x, y, pos);
- selectIcon(index);
+ selectIcon(index, selected);
return index;
}
- void selectIcon(int index) {
+ /**
+ * Select the icon at the given index.
+ *
+ * @param index The index.
+ * @param selected True if selected, false if just focused (they get different colors).
+ */
+ void selectIcon(int index, boolean selected) {
if (mAllAppsList == null || index < 0 || index >= mAllAppsList.size()) {
mState.selectedIconIndex = -1;
} else {
@@ -1186,7 +1193,7 @@ public class AllAppsView extends RSSurfaceView
Bitmap selectionBitmap = mSelectionBitmap;
Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,
- selectionBitmap.getWidth(), selectionBitmap.getHeight(),
+ selectionBitmap.getWidth(), selectionBitmap.getHeight(), selected,
mAllAppsList.get(index).iconBitmap);
mSelectedIcon = Allocation.createFromBitmap(mRS, selectionBitmap,
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index d5dd06338..b77e00a59 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -54,7 +54,8 @@ final class Utilities {
private static final Paint sPaint = new Paint();
private static final Paint sBlurPaint = new Paint();
- private static final Paint sGlowColorPaint = new Paint();
+ private static final Paint sGlowColorSelectedPaint = new Paint();
+ private static final Paint sGlowColorFocusedPaint = new Paint();
private static final Paint sEmptyPaint = new Paint();
private static final Rect sBounds = new Rect();
private static final Rect sOldBounds = new Rect();
@@ -245,7 +246,8 @@ final class Utilities {
}
}
- static void drawSelectedAllAppsBitmap(Canvas dest, int destWidth, int destHeight, Bitmap src) {
+ static void drawSelectedAllAppsBitmap(Canvas dest, int destWidth, int destHeight,
+ boolean selected, Bitmap src) {
synchronized (sCanvas) { // we share the statics :-(
if (sIconWidth == -1) {
// We can't have gotten to here without src being initialized, which
@@ -261,7 +263,8 @@ final class Utilities {
float px = (destWidth - src.getWidth()) / 2;
float py = (destHeight - src.getHeight()) / 2;
- dest.drawBitmap(mask, px + xy[0], py + xy[1], sGlowColorPaint);
+ dest.drawBitmap(mask, px + xy[0], py + xy[1],
+ selected ? sGlowColorSelectedPaint : sGlowColorFocusedPaint);
mask.recycle();
}
@@ -339,8 +342,10 @@ final class Utilities {
sIconTextureWidth = sIconTextureHeight = roundToPow2(sIconWidth);
sBlurPaint.setMaskFilter(new BlurMaskFilter(5 * density, BlurMaskFilter.Blur.NORMAL));
- sGlowColorPaint.setColor(0xffff9000);
- sGlowColorPaint.setMaskFilter(TableMaskFilter.CreateClipTable(0, 30));
+ sGlowColorSelectedPaint.setColor(0xffffc300);
+ sGlowColorSelectedPaint.setMaskFilter(TableMaskFilter.CreateClipTable(0, 30));
+ sGlowColorFocusedPaint.setColor(0xffff8e00);
+ sGlowColorFocusedPaint.setMaskFilter(TableMaskFilter.CreateClipTable(0, 30));
}
static class BubbleText {