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

HandleView

public class HandleView extends android.widget.ImageView

Fields Summary
private static final int
ORIENTATION_HORIZONTAL
private Launcher
mLauncher
private int
mOrientation
Constructors Summary
public HandleView(android.content.Context context)


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

        this(context, attrs, 0);
    
public HandleView(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

        super(context, attrs, defStyle);

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HandleView, defStyle, 0);
        mOrientation = a.getInt(R.styleable.HandleView_direction, ORIENTATION_HORIZONTAL);
        a.recycle();
    
Methods Summary
public android.view.ViewfocusSearch(int direction)

        View newFocus = super.focusSearch(direction);
        if (newFocus == null && mLauncher.isDrawerDown()) {
            final Workspace workspace = mLauncher.getWorkspace();
            workspace.dispatchUnhandledMove(null, direction);
            return (mOrientation == ORIENTATION_HORIZONTAL && direction == FOCUS_DOWN) ?
                    this : workspace;
        }
        return newFocus;
    
private static booleanisDirectionKey(int keyCode)

        return keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_LEFT ||
                keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_UP;
    
public booleanonKeyDown(int keyCode, android.view.KeyEvent event)

        final boolean handled = super.onKeyDown(keyCode, event);

        if (!handled && !mLauncher.isDrawerDown() && !isDirectionKey(keyCode)) {
            return mLauncher.getApplicationsGrid().onKeyDown(keyCode, event);
        }

        return handled;
    
public booleanonKeyUp(int keyCode, android.view.KeyEvent event)

        final boolean handled = super.onKeyUp(keyCode, event);

        if (!handled && !mLauncher.isDrawerDown() && !isDirectionKey(keyCode)) {
            return mLauncher.getApplicationsGrid().onKeyUp(keyCode, event);
        }

        return handled;
    
voidsetLauncher(Launcher launcher)

        mLauncher = launcher;