FileDocCategorySizeDatePackage
UserFolder.javaAPI DocAndroid 1.5 API2580Wed May 06 22:42:46 BST 2009com.android.launcher

UserFolder

public class UserFolder extends Folder implements DropTarget
Folder which contains applications or shortcuts chosen by the user.

Fields Summary
Constructors Summary
public UserFolder(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
Methods Summary
public booleanacceptDrop(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)

        final ItemInfo item = (ItemInfo) dragInfo;
        final int itemType = item.itemType;
        return (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
                itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && item.container != mInfo.id;
    
voidbind(FolderInfo info)

        super.bind(info);
        setContentAdapter(new ApplicationsAdapter(mContext, ((UserFolderInfo) info).contents));
    
static com.android.launcher.UserFolderfromXml(android.content.Context context)
Creates a new UserFolder, inflated from R.layout.user_folder.

param
context The application's context.
return
A new UserFolder.

        return (UserFolder) LayoutInflater.from(context).inflate(R.layout.user_folder, null);
    
public voidonDragEnter(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)

    
public voidonDragExit(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)

    
public voidonDragOver(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)

    
public voidonDrop(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)

        final ApplicationInfo item = (ApplicationInfo) dragInfo;
        //noinspection unchecked
        ((ArrayAdapter<ApplicationInfo>) mContent.getAdapter()).add((ApplicationInfo) dragInfo);
        LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, 0, 0);
    
public voidonDropCompleted(android.view.View target, boolean success)

        if (success) {
            //noinspection unchecked
            ArrayAdapter<ApplicationInfo> adapter =
                    (ArrayAdapter<ApplicationInfo>) mContent.getAdapter();
            adapter.remove(mDragItem);
        }
    
voidonOpen()

        super.onOpen();
        requestFocus();