Merge branch 'eclair' into eclair-release
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java
index e51e9b0..3c4ea77 100644
--- a/src/com/android/launcher2/AllAppsView.java
+++ b/src/com/android/launcher2/AllAppsView.java
@@ -279,7 +279,7 @@
mShouldGainFocus = true;
}
} else {
- if (mRollo != null && mRollo.mHasSurface) {
+ if (mRollo != null) {
if (mArrowNavigation) {
// Clear selection when we lose focus
mRollo.clearSelectedIcon();
@@ -676,7 +676,7 @@
}
final int N = list.size();
- if (mRollo != null && mRollo.mHasSurface) {
+ if (mRollo != null) {
mRollo.reallocAppsList(mRollo.mState.iconCount + N);
}
@@ -688,13 +688,12 @@
index = -(index+1);
}
mAllAppsList.add(index, item);
- if (mRollo != null && mRollo.mHasSurface) {
+ if (mRollo != null) {
mRollo.addApp(index, item);
- mRollo.mState.iconCount++;
}
}
- if (mRollo != null && mRollo.mHasSurface) {
+ if (mRollo != null) {
mRollo.saveAppsList();
}
}
@@ -712,7 +711,7 @@
if (index >= 0) {
int ic = mRollo != null ? mRollo.mState.iconCount : 666;
mAllAppsList.remove(index);
- if (mRollo != null && mRollo.mHasSurface) {
+ if (mRollo != null) {
mRollo.removeApp(index);
}
} else {
@@ -721,7 +720,7 @@
}
}
- if (mRollo != null && mRollo.mHasSurface) {
+ if (mRollo != null) {
mRollo.saveAppsList();
}
}
@@ -1052,16 +1051,12 @@
mRS.contextBindRootScript(mScript);
}
- private void uploadApps(ArrayList<ApplicationInfo> list) {
- for (int i=0; i < mState.iconCount; i++) {
- uploadAppIcon(i, list.get(i));
- }
- }
-
void dirtyCheck() {
if (mHasSurface) {
if (mAppsDirty) {
- uploadApps(mAllAppsList);
+ for (int i=0; i < mState.iconCount; i++) {
+ uploadAppIcon(i, mAllAppsList.get(i));
+ }
saveAppsList();
mAppsDirty = false;
}
@@ -1088,10 +1083,11 @@
Element ie8888 = Element.RGBA_8888(mRS);
- Utilities.BubbleText bubble = new Utilities.BubbleText(getContext());
-
mState.iconCount = count;
- uploadApps(list);
+ for (int i=0; i < mState.iconCount; i++) {
+ createAppIconAllocations(i, list.get(i));
+ uploadAppIcon(i, list.get(i));
+ }
saveAppsList();
}
@@ -1126,22 +1122,32 @@
a.subData(0, 0, 1, 1, black);
}
- private void uploadAppIcon(int index, ApplicationInfo item) {
+ private void createAppIconAllocations(int index, ApplicationInfo item) {
mIcons[index] = Allocation.createFromBitmap(mRS, item.iconBitmap,
Element.RGBA_8888(mRS), true);
- frameBitmapAllocMips(mIcons[index], item.iconBitmap.getWidth(), item.iconBitmap.getHeight());
+ frameBitmapAllocMips(mIcons[index], item.iconBitmap.getWidth(),
+ item.iconBitmap.getHeight());
mLabels[index] = Allocation.createFromBitmap(mRS, item.titleBitmap,
Element.RGBA_8888(mRS), true);
- frameBitmapAllocMips(mLabels[index], item.titleBitmap.getWidth(), item.titleBitmap.getHeight());
-
- mIcons[index].uploadToTexture(0);
- mLabels[index].uploadToTexture(0);
+ frameBitmapAllocMips(mLabels[index], item.titleBitmap.getWidth(),
+ item.titleBitmap.getHeight());
mIconIds[index] = mIcons[index].getID();
mLabelIds[index] = mLabels[index].getID();
}
+ private void uploadAppIcon(int index, ApplicationInfo item) {
+ if (mIconIds[index] != mIcons[index].getID()) {
+ throw new IllegalStateException("uploadAppIcon index=" + index
+ + " mIcons[index].getID=" + mIcons[index].getID()
+ + " mIconsIds[index]=" + mIconIds[index]
+ + " item=" + item);
+ }
+ mIcons[index].uploadToTexture(0);
+ mLabels[index].uploadToTexture(0);
+ }
+
/**
* Puts the empty spaces at the end. Updates mState.iconCount. You must
* fill in the values and call saveAppsList().
@@ -1180,11 +1186,15 @@
System.arraycopy(mLabels, index, mLabels, dest, count);
System.arraycopy(mLabelIds, index, mLabelIds, dest, count);
+ createAppIconAllocations(index, item);
+
if (mHasSurface) {
uploadAppIcon(index, item);
} else {
mAppsDirty = true;
}
+
+ mRollo.mState.iconCount++;
}
/**
@@ -1200,7 +1210,7 @@
System.arraycopy(mLabelIds, src, mLabelIds, index, count);
mRollo.mState.iconCount--;
- final int last = mState.iconCount - 1;
+ final int last = mState.iconCount;
mIcons[last] = null;
mIconIds[last] = 0;