From 73a0554de11ed880bfed3dafaa17f5c0d7b5b1fe Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 9 Mar 2010 14:45:57 -0500 Subject: Fix trackball focus weirdness in AllApps2D. Also vertically align AllApps2D's home icon with Workspace's grid icon. Change-Id: I81a8759ed33afd08336482484f1b9bdb9a36718e --- src/com/android/launcher2/AllApps2D.java | 37 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'src/com/android/launcher2/AllApps2D.java') diff --git a/src/com/android/launcher2/AllApps2D.java b/src/com/android/launcher2/AllApps2D.java index f02e8c6ae..66744803d 100644 --- a/src/com/android/launcher2/AllApps2D.java +++ b/src/com/android/launcher2/AllApps2D.java @@ -57,28 +57,26 @@ public class AllApps2D private ArrayList mAllAppsList = new ArrayList(); - /** - * True when we are using arrow keys or trackball to drive navigation - */ - private boolean mArrowNavigation = false; - private boolean mStartedScrolling; - - /** - * Used to keep track of the selection when AllApps2D loses window focus. - * One of the SELECTION_ constants. - */ - private int mLastSelection; - - /** - * Used to keep track of the selection when AllApps2D loses window focus - */ - private int mLastSelectedIcon; - + // preserve compatibility with 3D all apps: + // 0.0 -> hidden + // 1.0 -> shown and opaque + // intermediate values -> partially shown & partially opaque private float mZoom; private AppsAdapter mAppsAdapter; // ------------------------------------------------------------ + + public static class HomeButton extends ImageButton { + public HomeButton(Context context, AttributeSet attrs) { + super(context, attrs); + } + @Override + public View focusSearch(int direction) { + if (direction == FOCUS_UP) return super.focusSearch(direction); + return null; + } + } public class AppsAdapter extends ArrayAdapter { private final LayoutInflater mInflater; @@ -184,6 +182,11 @@ public class AllApps2D return true; } + protected void onFocusChanged(boolean gainFocus, int direction, android.graphics.Rect prev) { + if (gainFocus) { + mGrid.requestFocus(); + } + } public void setDragController(DragController dragger) { mDragController = dragger; -- cgit v1.2.3