Skip to content

Commit

Permalink
Fix (once again) the apps button not passing focus properly to app dr…
Browse files Browse the repository at this point in the history
…awer or desktop.

Seems my Viewstub borked the old xml nextFocus properties somewhat, so I've ended up changing
the nextFocus ids in code depending the screen orientation and the app drawer status.

I don't think it's a good idea allowing the LAB/RAB/LAB2/RAB2 buttons to be added to this fix,
the app drawer should maintain the focus only to/from the apps button...
  • Loading branch information
AnderWeb committed Aug 19, 2010
1 parent 772d100 commit 1d4407b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion res/layout-land/new_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:scrollbarStyle="insideInset"
android:drawSelectorOnTop="false"
launcher:listSelector="@drawable/grid_selector"
android:nextFocusRight="@+id/all_apps"
android:nextFocusRight="@id/all_apps"
android:nextFocusDown="@id/all_apps_view"
android:nextFocusUp="@id/all_apps_view"
android:nextFocusLeft="@id/all_apps_view"
Expand Down
2 changes: 1 addition & 1 deletion res/layout-land/old_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:scrollbarStyle="insideInset"
android:drawSelectorOnTop="false"
android:listSelector="@drawable/grid_selector"
android:nextFocusRight="@+id/all_apps"
android:nextFocusRight="@id/all_apps"
android:nextFocusDown="@id/all_apps_view"
android:nextFocusUp="@id/all_apps_view"
android:nextFocusLeft="@id/all_apps_view"
Expand Down
3 changes: 1 addition & 2 deletions res/layout-port/new_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
<com.android.launcher.AllAppsSlidingView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:id="@+id/all_apps_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbarStyle="insideInset"
android:drawSelectorOnTop="false"
launcher:listSelector="@drawable/grid_selector"
android:nextFocusLeft="@id/all_apps_view"
android:nextFocusUp="@id/all_apps_view"
android:nextFocusDown="@+id/all_apps"
android:nextFocusDown="@id/all_apps"
android:nextFocusRight="@id/all_apps_view"
android:visibility="gone"
android:paddingBottom="60dip"
Expand Down
3 changes: 1 addition & 2 deletions res/layout-port/old_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
launcher:texture="@drawable/pattern_carbon_fiber_dark"
android:id="@+id/all_apps_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbarStyle="insideInset"
android:drawSelectorOnTop="false"
android:listSelector="@drawable/grid_selector"
android:nextFocusLeft="@id/all_apps_view"
android:nextFocusUp="@id/all_apps_view"
android:nextFocusDown="@+id/all_apps"
android:nextFocusDown="@id/all_apps"
android:nextFocusRight="@id/all_apps_view"
android:visibility="gone"
android:paddingBottom="50dip"
Expand Down
11 changes: 11 additions & 0 deletions src/com/android/launcher/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,8 @@ public void onClick(View v) {
}
}
});
mHandleView.setNextFocusUpId(R.id.drag_layer);
mHandleView.setNextFocusLeftId(R.id.drag_layer);
if(newDrawer){
((AllAppsSlidingView)grid).setDragger(dragLayer);
((AllAppsSlidingView)grid).setLauncher(this);
Expand Down Expand Up @@ -3194,6 +3196,13 @@ public void onWindowFocusChanged(boolean hasFocus) {
*/
private void showAllApps(boolean animated){
if(!allAppsOpen){
if(getWindow().getDecorView().getWidth()>getWindow().getDecorView().getHeight()){
mHandleView.setNextFocusUpId(R.id.drag_layer);
mHandleView.setNextFocusLeftId(R.id.all_apps_view);
}else{
mHandleView.setNextFocusUpId(R.id.all_apps_view);
mHandleView.setNextFocusLeftId(R.id.drag_layer);
}
mWorkspace.hideWallpaper(true);
allAppsOpen=true;
mWorkspace.enableChildrenCache();
Expand All @@ -3214,6 +3223,8 @@ private void showAllApps(boolean animated){
}
private void closeAllApps(boolean animated){
if(allAppsOpen){
mHandleView.setNextFocusUpId(R.id.drag_layer);
mHandleView.setNextFocusLeftId(R.id.drag_layer);
mWorkspace.hideWallpaper(false);
allAppsOpen=false;
mWorkspace.unlock();
Expand Down

0 comments on commit 1d4407b

Please sign in to comment.