summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-01 15:37:00 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-06-01 15:37:00 -0700
commitbb593755d2fa8980855072dfdc72aae3adb2e6dd (patch)
treec6247e557f9e549a558859c2170645e2b1d9dc15 /src
parent2eb49ff2a3f7066cae1768d2314c4f912bd6c28d (diff)
parent574d20ec84551370987dde530c27ec493bdef564 (diff)
downloadandroid_packages_apps_Trebuchet-bb593755d2fa8980855072dfdc72aae3adb2e6dd.tar.gz
android_packages_apps_Trebuchet-bb593755d2fa8980855072dfdc72aae3adb2e6dd.tar.bz2
android_packages_apps_Trebuchet-bb593755d2fa8980855072dfdc72aae3adb2e6dd.zip
Merge change 2865 into donut
* changes: Fixes #1890155.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher/Folder.java8
-rw-r--r--src/com/android/launcher/Workspace.java34
2 files changed, 39 insertions, 3 deletions
diff --git a/src/com/android/launcher/Folder.java b/src/com/android/launcher/Folder.java
index bcbccf71b..fb4e8d6c5 100644
--- a/src/com/android/launcher/Folder.java
+++ b/src/com/android/launcher/Folder.java
@@ -24,7 +24,7 @@ import android.widget.AdapterView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.AbsListView;
-import android.widget.ListAdapter;
+import android.widget.BaseAdapter;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
@@ -122,10 +122,14 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
*
* @param adapter The list of applications to display in the folder.
*/
- void setContentAdapter(ListAdapter adapter) {
+ void setContentAdapter(BaseAdapter adapter) {
mContent.setAdapter(adapter);
}
+ void notifyDataSetChanged() {
+ ((BaseAdapter) mContent.getAdapter()).notifyDataSetChanged();
+ }
+
void setLauncher(Launcher launcher) {
mLauncher = launcher;
}
diff --git a/src/com/android/launcher/Workspace.java b/src/com/android/launcher/Workspace.java
index fe309dedb..e4d256028 100644
--- a/src/com/android/launcher/Workspace.java
+++ b/src/com/android/launcher/Workspace.java
@@ -1222,32 +1222,64 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
final ArrayList<View> childrenToRemove = new ArrayList<View>();
final LauncherModel model = Launcher.getModel();
final int count = getChildCount();
+
for (int i = 0; i < count; i++) {
final CellLayout layout = (CellLayout) getChildAt(i);
int childCount = layout.getChildCount();
+
childrenToRemove.clear();
+
for (int j = 0; j < childCount; j++) {
final View view = layout.getChildAt(j);
Object tag = view.getTag();
+
if (tag instanceof ApplicationInfo) {
- ApplicationInfo info = (ApplicationInfo) tag;
+ final ApplicationInfo info = (ApplicationInfo) tag;
// We need to check for ACTION_MAIN otherwise getComponent() might
// return null for some shortcuts (for instance, for shortcuts to
// web pages.)
final Intent intent = info.intent;
final ComponentName name = intent.getComponent();
+
if (Intent.ACTION_MAIN.equals(intent.getAction()) &&
name != null && packageName.equals(name.getPackageName())) {
model.removeDesktopItem(info);
LauncherModel.deleteItemFromDatabase(mLauncher, info);
childrenToRemove.add(view);
}
+ } else if (tag instanceof UserFolderInfo) {
+ final UserFolderInfo info = (UserFolderInfo) tag;
+ final ArrayList<ApplicationInfo> contents = info.contents;
+ final ArrayList<ApplicationInfo> toRemove = new ArrayList<ApplicationInfo>(1);
+ final int contentsCount = contents.size();
+ boolean removedFromFolder = false;
+
+ for (int k = 0; k < contentsCount; k++) {
+ final ApplicationInfo appInfo = contents.get(k);
+ final Intent intent = appInfo.intent;
+ final ComponentName name = intent.getComponent();
+
+ if (Intent.ACTION_MAIN.equals(intent.getAction()) &&
+ name != null && packageName.equals(name.getPackageName())) {
+ toRemove.add(appInfo);
+ LauncherModel.deleteItemFromDatabase(mLauncher, appInfo);
+ removedFromFolder = true;
+ }
+ }
+
+ contents.removeAll(toRemove);
+ if (removedFromFolder) {
+ final Folder folder = getOpenFolder();
+ if (folder != null) folder.notifyDataSetChanged();
+ }
}
}
+
childCount = childrenToRemove.size();
for (int j = 0; j < childCount; j++) {
layout.removeViewInLayout(childrenToRemove.get(j));
}
+
if (childCount > 0) {
layout.requestLayout();
layout.invalidate();