diff options
author | Daniel Sandler <dsandler@google.com> | 2010-03-09 14:45:57 -0500 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2010-03-11 09:00:51 -0500 |
commit | 73a0554de11ed880bfed3dafaa17f5c0d7b5b1fe (patch) | |
tree | fe2f4f33d052e681cedd4bda6beef87ce6ed934c | |
parent | 13c2e7b788203f397085bef563bc5597e4c98028 (diff) | |
download | android_packages_apps_Trebuchet-73a0554de11ed880bfed3dafaa17f5c0d7b5b1fe.tar.gz android_packages_apps_Trebuchet-73a0554de11ed880bfed3dafaa17f5c0d7b5b1fe.tar.bz2 android_packages_apps_Trebuchet-73a0554de11ed880bfed3dafaa17f5c0d7b5b1fe.zip |
Fix trackball focus weirdness in AllApps2D.
Also vertically align AllApps2D's home icon with Workspace's
grid icon.
Change-Id: I81a8759ed33afd08336482484f1b9bdb9a36718e
-rw-r--r-- | res/layout/all_apps_2d.xml | 16 | ||||
-rw-r--r-- | src/com/android/launcher2/AllApps2D.java | 37 |
2 files changed, 32 insertions, 21 deletions
diff --git a/res/layout/all_apps_2d.xml b/res/layout/all_apps_2d.xml index f22b8ea50..7bbfa91e7 100644 --- a/res/layout/all_apps_2d.xml +++ b/res/layout/all_apps_2d.xml @@ -22,8 +22,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:padding="2dip" - > + <GridView android:id="@+id/all_apps_2d_grid" android:tag="all_apps_2d_grid" android:scrollbars="none" @@ -36,20 +36,28 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" - android:layout_marginBottom="24dip" + android:layout_marginBottom="28dip" android:layout_marginTop="8dip" android:nextFocusDown="@+id/all_apps_2d_home" + android:nextFocusUp="@null" + android:nextFocusLeft="@null" + android:nextFocusRight="@null" /> - <ImageButton android:id="@+id/all_apps_2d_home" + <view + class="com.android.launcher2.AllApps2D$HomeButton" + android:id="@+id/all_apps_2d_home" android:tag="all_apps_2d_home" android:src="@drawable/home_button" android:background="#00000000" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" android:layout_width="wrap_content" - android:layout_height="64dip" + android:layout_height="@dimen/button_bar_height" android:nextFocusUp="@+id/all_apps_2d_grid" + android:nextFocusDown="@null" + android:nextFocusLeft="@null" + android:nextFocusRight="@null" /> </com.android.launcher2.AllApps2D> 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<ApplicationInfo> mAllAppsList = new ArrayList<ApplicationInfo>(); - /** - * 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<ApplicationInfo> { 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; |