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

FolderIcon

public class FolderIcon extends BubbleTextView implements DropTarget
An icon that can appear on in the workspace representing an {@link UserFolder}.

Fields Summary
private UserFolderInfo
mInfo
private Launcher
mLauncher
private android.graphics.drawable.Drawable
mCloseIcon
private android.graphics.drawable.Drawable
mOpenIcon
Constructors Summary
public FolderIcon(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
public FolderIcon(android.content.Context context)

        super(context);
    
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;
    
static com.android.launcher.FolderIconfromXml(int resId, Launcher launcher, android.view.ViewGroup group, UserFolderInfo folderInfo)


        FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);

        final Resources resources = launcher.getResources();
        Drawable d = resources.getDrawable(R.drawable.ic_launcher_folder);
        d = Utilities.createIconThumbnail(d, launcher);
        icon.mCloseIcon = d;
        icon.mOpenIcon = resources.getDrawable(R.drawable.ic_launcher_folder_open);
        icon.setCompoundDrawablesWithIntrinsicBounds(null, d, null, null);
        icon.setText(folderInfo.title);
        icon.setTag(folderInfo);
        icon.setOnClickListener(launcher);
        icon.mInfo = folderInfo;
        icon.mLauncher = launcher;
        
        return icon;
    
public voidonDragEnter(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)

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

        setCompoundDrawablesWithIntrinsicBounds(null, mCloseIcon, null, null);
    
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;
        // TODO: update open folder that is looking at this data
        mInfo.add(item);
        LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, 0, 0);