Folder auto-destroys itself when there is only one item left.
Change-Id: I4ea41e0730e3dc474a518eba0a04c11167b5c1df
This commit is contained in:
@@ -380,15 +380,33 @@ public class LauncherModel extends BroadcastReceiver {
|
||||
});
|
||||
}
|
||||
|
||||
static void deleteFolderContentsFromDatabase(Context context, final FolderInfo info) {
|
||||
deleteFolderContentsFromDatabase(context, info, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the contents of the specified folder from the database
|
||||
*/
|
||||
static void deleteFolderContentsFromDatabase(Context context, FolderInfo info) {
|
||||
static void deleteFolderContentsFromDatabase(Context context, final FolderInfo info,
|
||||
boolean post) {
|
||||
// TODO: this post flag is temporary to fix an ordering of commands issue. In future,
|
||||
// all db operations will be moved to the worker thread, so this can be discarded at
|
||||
// that time.
|
||||
final ContentResolver cr = context.getContentResolver();
|
||||
|
||||
cr.delete(LauncherSettings.Favorites.getContentUri(info.id, false), null, null);
|
||||
cr.delete(LauncherSettings.Favorites.CONTENT_URI,
|
||||
LauncherSettings.Favorites.CONTAINER + "=" + info.id, null);
|
||||
if (!post) {
|
||||
cr.delete(LauncherSettings.Favorites.getContentUri(info.id, false), null, null);
|
||||
cr.delete(LauncherSettings.Favorites.CONTENT_URI,
|
||||
LauncherSettings.Favorites.CONTAINER + "=" + info.id, null);
|
||||
} else {
|
||||
sWorker.post(new Runnable() {
|
||||
public void run() {
|
||||
cr.delete(LauncherSettings.Favorites.getContentUri(info.id, false), null, null);
|
||||
cr.delete(LauncherSettings.Favorites.CONTENT_URI,
|
||||
LauncherSettings.Favorites.CONTAINER + "=" + info.id, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user