FolderIconpublic class FolderIcon extends BubbleTextView implements DropTargetAn 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 |
Methods Summary |
---|
public boolean | acceptDrop(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.FolderIcon | fromXml(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 void | onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)
setCompoundDrawablesWithIntrinsicBounds(null, mOpenIcon, null, null);
| public void | onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)
setCompoundDrawablesWithIntrinsicBounds(null, mCloseIcon, null, null);
| public void | onDragOver(DragSource source, int x, int y, int xOffset, int yOffset, java.lang.Object dragInfo)
| public void | onDrop(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);
|
|