diff options
author | Joe Onorato <joeo@android.com> | 2009-12-10 17:39:36 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-12-10 17:39:36 -0800 |
commit | 616e3a0892511e14b812228e6e8d879c44082cb4 (patch) | |
tree | ead15559cff9389c694b7c3c2a677b6d31de33d8 /src | |
parent | 7984c9496bcaeca23ee7fdecc4d4f1bb2467e0f2 (diff) | |
parent | 8eea3914a012eec703b5c7829361bbc6e356dc66 (diff) | |
download | android_packages_apps_Trebuchet-616e3a0892511e14b812228e6e8d879c44082cb4.tar.gz android_packages_apps_Trebuchet-616e3a0892511e14b812228e6e8d879c44082cb4.tar.bz2 android_packages_apps_Trebuchet-616e3a0892511e14b812228e6e8d879c44082cb4.zip |
am 8eea3914: fix 2315821 and 2315729 - problems caused because the apps list could become unsynchronized with the list of icons.
Merge commit '8eea3914a012eec703b5c7829361bbc6e356dc66' into eclair-mr2
* commit '8eea3914a012eec703b5c7829361bbc6e356dc66':
fix 2315821 and 2315729 - problems caused because the apps list could become
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index 0c45075c7..88f074cdd 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -277,7 +277,7 @@ public class AllAppsView extends RSSurfaceView mShouldGainFocus = true; } } else { - if (mRollo != null && mRollo.mHasSurface) { + if (mRollo != null) { if (mArrowNavigation) { // Clear selection when we lose focus mRollo.clearSelectedIcon(); @@ -674,7 +674,7 @@ public class AllAppsView extends RSSurfaceView } final int N = list.size(); - if (mRollo != null && mRollo.mHasSurface) { + if (mRollo != null) { mRollo.reallocAppsList(mRollo.mState.iconCount + N); } @@ -686,13 +686,12 @@ public class AllAppsView extends RSSurfaceView 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(); } } @@ -710,7 +709,7 @@ public class AllAppsView extends RSSurfaceView 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 { @@ -719,7 +718,7 @@ public class AllAppsView extends RSSurfaceView } } - if (mRollo != null && mRollo.mHasSurface) { + if (mRollo != null) { mRollo.saveAppsList(); } } @@ -1050,16 +1049,12 @@ public class AllAppsView extends RSSurfaceView 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; } @@ -1086,10 +1081,11 @@ public class AllAppsView extends RSSurfaceView 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(); } @@ -1124,22 +1120,32 @@ public class AllAppsView extends RSSurfaceView 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(). @@ -1178,11 +1184,15 @@ public class AllAppsView extends RSSurfaceView 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++; } /** @@ -1198,7 +1208,7 @@ public class AllAppsView extends RSSurfaceView 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; |