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

Folder

public class Folder extends android.widget.LinearLayout implements android.widget.AdapterView.OnItemClickListener, android.view.View.OnClickListener, DragSource, View.OnLongClickListener, android.widget.AdapterView.OnItemLongClickListener
Represents a set of icons chosen by the user or generated by the system.

Fields Summary
protected android.widget.AbsListView
mContent
protected DragController
mDragger
protected Launcher
mLauncher
protected android.widget.Button
mCloseButton
protected FolderInfo
mInfo
protected ApplicationInfo
mDragItem
Which item is being dragged
private boolean
mCloneInfo
Constructors Summary
public Folder(android.content.Context context, android.util.AttributeSet attrs)
Used to inflate the Workspace from XML.

param
context The application's context.
param
attrs The attribtues set containing the Workspace's customization values.

        super(context, attrs);
        setAlwaysDrawnWithCacheEnabled(false);
    
Methods Summary
voidbind(FolderInfo info)

        mInfo = info;
        mCloseButton.setText(info.title);
    
FolderInfogetInfo()

return
the FolderInfo object associated with this folder

        return mInfo;
    
public voidonClick(android.view.View v)

        mLauncher.closeFolder(this);
    
voidonClose()

        final Workspace workspace = mLauncher.getWorkspace();
        workspace.getChildAt(workspace.getCurrentScreen()).requestFocus();
    
public voidonDropCompleted(android.view.View target, boolean success)

    
protected voidonFinishInflate()

        super.onFinishInflate();

        mContent = (AbsListView) findViewById(R.id.content);
        mContent.setOnItemClickListener(this);
        mContent.setOnItemLongClickListener(this);
        
        mCloseButton = (Button) findViewById(R.id.close);
        mCloseButton.setOnClickListener(this);
        mCloseButton.setOnLongClickListener(this);
    
public voidonItemClick(android.widget.AdapterView parent, android.view.View v, int position, long id)

        ApplicationInfo app = (ApplicationInfo) parent.getItemAtPosition(position);
        mLauncher.startActivitySafely(app.intent);
    
public booleanonItemLongClick(android.widget.AdapterView parent, android.view.View view, int position, long id)

        if (!view.isInTouchMode()) {
            return false;
        }

        ApplicationInfo app = (ApplicationInfo) parent.getItemAtPosition(position);
        if (mCloneInfo) {
            app = new ApplicationInfo(app);
        }

        mDragger.startDrag(view, this, app, DragController.DRAG_ACTION_COPY);
        mLauncher.closeFolder(this);
        mDragItem = app;

        return true;
    
public booleanonLongClick(android.view.View v)

        mLauncher.closeFolder(this);
        mLauncher.showRenameDialog(mInfo);
        return true;
    
voidonOpen()

        mContent.requestLayout();
    
voidsetCloneInfo(boolean cloneInfo)

        mCloneInfo = cloneInfo;
    
voidsetContentAdapter(android.widget.ListAdapter adapter)
Sets the adapter used to populate the content area. The adapter must only contains ApplicationInfo items.

param
adapter The list of applications to display in the folder.

        mContent.setAdapter(adapter);
    
public voidsetDragger(DragController dragger)

        mDragger = dragger;
    
voidsetLauncher(Launcher launcher)

        mLauncher = launcher;