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

AddAdapter

public class AddAdapter extends android.widget.BaseAdapter
Adapter showing the types of items that can be added to a {@link Workspace}.

Fields Summary
private final android.view.LayoutInflater
mInflater
private final ArrayList
mItems
public static final int
ITEM_SHORTCUT
public static final int
ITEM_APPWIDGET
public static final int
ITEM_LIVE_FOLDER
public static final int
ITEM_WALLPAPER
Constructors Summary
public AddAdapter(Launcher launcher)

        super();

        mInflater = (LayoutInflater) launcher.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        
        // Create default actions
        Resources res = launcher.getResources();
        
        mItems.add(new ListItem(res, R.string.group_shortcuts,
                R.drawable.ic_launcher_shortcut, ITEM_SHORTCUT));

        mItems.add(new ListItem(res, R.string.group_widgets,
                R.drawable.ic_launcher_appwidget, ITEM_APPWIDGET));
        
        mItems.add(new ListItem(res, R.string.group_live_folders,
                R.drawable.ic_launcher_folder_live, ITEM_LIVE_FOLDER));
        
        mItems.add(new ListItem(res, R.string.group_wallpapers,
                R.drawable.ic_launcher_gallery, ITEM_WALLPAPER));

    
Methods Summary
public intgetCount()

        return mItems.size();
    
public java.lang.ObjectgetItem(int position)

        return mItems.get(position);
    
public longgetItemId(int position)

        return position;
    
public android.view.ViewgetView(int position, android.view.View convertView, android.view.ViewGroup parent)

        ListItem item = (ListItem) getItem(position);
        
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.add_list_item, parent, false);
        }
        
        TextView textView = (TextView) convertView;
        textView.setTag(item);
        textView.setText(item.text);
        textView.setCompoundDrawablesWithIntrinsicBounds(item.image, null, null, null);
        
        return convertView;