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

AllAppsGridView

public class AllAppsGridView extends android.widget.GridView implements DragSource, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener

Fields Summary
private DragController
mDragger
private Launcher
mLauncher
private android.graphics.Bitmap
mTexture
private android.graphics.Paint
mPaint
private int
mTextureWidth
private int
mTextureHeight
Constructors Summary
public AllAppsGridView(android.content.Context context)

        super(context);
    
public AllAppsGridView(android.content.Context context, android.util.AttributeSet attrs)

        this(context, attrs, com.android.internal.R.attr.gridViewStyle);
    
public AllAppsGridView(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

        super(context, attrs, defStyle);

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AllAppsGridView, defStyle, 0);
        final int textureId = a.getResourceId(R.styleable.AllAppsGridView_texture, 0);
        if (textureId != 0) {
            mTexture = BitmapFactory.decodeResource(getResources(), textureId);
            mTextureWidth = mTexture.getWidth();
            mTextureHeight = mTexture.getHeight();

            mPaint = new Paint();
            mPaint.setDither(false);
        }
        a.recycle();
    
Methods Summary
public voiddraw(android.graphics.Canvas canvas)

        final Bitmap texture = mTexture;
        final Paint paint = mPaint;

        final int width = getWidth();
        final int height = getHeight();

        final int textureWidth = mTextureWidth;
        final int textureHeight = mTextureHeight;

        int x = 0;
        int y;

        while (x < width) {
            y = 0;
            while (y < height) {
                canvas.drawBitmap(texture, x, y, paint);
                y += textureHeight;
            }
            x += textureWidth;
        }

        super.draw(canvas);
    
public voidonDropCompleted(android.view.View target, boolean success)

    
protected voidonFinishInflate()

        setOnItemClickListener(this);
        setOnItemLongClickListener(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);
        app = new ApplicationInfo(app);

        mDragger.startDrag(view, this, app, DragController.DRAG_ACTION_COPY);
        mLauncher.closeAllApplications();

        return true;
    
public voidsetDragger(DragController dragger)

        mDragger = dragger;
    
voidsetLauncher(Launcher launcher)

        mLauncher = launcher;