Permalink
Browse files

Merge pull request #506 from fzurita/fix_controller_navigation_again

Fixed issues with controller when the sidebar is open in-game
  • Loading branch information...
Gillou68310 committed Nov 2, 2015
2 parents f0a9315 + 8baf163 commit 6660215ce59d23c28a2c11332d6ac2942c79b212
@@ -46,6 +46,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
+ android:nextFocusLeft="@+id/drawerNavigation"
+ android:nextFocusRight="@+id/drawerNavigation"
+ android:nextFocusDown="@+id/drawerNavigation"
+ android:nextFocusUp="@+id/drawerNavigation"
android:paddingTop="20dip" />
<paulscode.android.mupen64plusae.GameSidebar
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
-<paulscode.android.mupen64plusae.game.GameDrawerLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<paulscode.android.mupen64plusae.game.GameDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/drawerLayout"
android:fitsSystemWindows="true" >
<!-- activity view -->
+
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -26,21 +26,21 @@
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true" />
-
</FrameLayout>
<!-- navigation drawer -->
+
<RelativeLayout
- android:layout_gravity="start"
android:layout_width="280dip"
android:layout_height="match_parent"
+ android:layout_gravity="start"
android:fitsSystemWindows="true" >
<paulscode.android.mupen64plusae.GameSidebar
android:id="@+id/gameSidebar"
- android:fillViewport="true"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:fillViewport="true" />
</RelativeLayout>
-</paulscode.android.mupen64plusae.game.GameDrawerLayout>
+</paulscode.android.mupen64plusae.game.GameDrawerLayout>
@@ -9,21 +9,25 @@
<LinearLayout
android:id="@+id/imageLayout"
android:layout_width="279dip"
- android:layout_height="193dip" >
+ android:layout_height="193dip"
+ android:focusable="false" >
<ImageView
- tools:ignore="ContentDescription"
android:id="@+id/imageArt"
android:layout_width="match_parent"
android:layout_height="193dip"
- android:src="@drawable/default_coverart" />
+ android:focusable="false"
+ android:src="@drawable/default_coverart"
+ tools:ignore="ContentDescription" />
</LinearLayout>
<TextView
android:id="@+id/gameTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:focusable="false"
android:padding="5dip"
android:text="@string/galleryItemAdapter_dummyText"
android:textAppearance="?android:attr/textAppearanceMedium" />
-</LinearLayout>
+
+</LinearLayout>
@@ -77,11 +77,8 @@ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCoun
});
setClipToPadding(true);
- setNextFocusDownId(getId());
- setNextFocusLeftId(getId());
- setNextFocusRightId(getId());
- setNextFocusUpId(getId());
+ header.setFocusable(false);
addHeaderView(header);
}
@@ -90,6 +87,11 @@ public void setActionHandler(GameSidebarActionHandler actionHandler, int menuRes
mActionHandler = actionHandler;
setMenuResource( menuResource );
+ setNextFocusDownId(getId());
+ setNextFocusLeftId(getId());
+ setNextFocusRightId(getId());
+ setNextFocusUpId(getId());
+
// Handle menu item selections
setOnClickListener( new MenuListView.OnClickListener()
{
@@ -667,11 +667,14 @@ else if( keyDown && keyCode == KeyEvent.KEYCODE_BACK )
// Let the PeripheralControllers and Android handle everything else
else
{
- // If PeripheralControllers exist and handle the event,
- // they return true. Else they return false, signaling
- // Android to handle the event (menu button, vol keys).
- if( mKeyProvider != null )
- return mKeyProvider.onKey( view, keyCode, event );
+ if( !mDrawerLayout.isDrawerOpen( GravityCompat.START ) )
+ {
+ // If PeripheralControllers exist and handle the event,
+ // they return true. Else they return false, signaling
+ // Android to handle the event (menu button, vol keys).
+ if( mKeyProvider != null )
+ return mKeyProvider.onKey( view, keyCode, event );
+ }
return false;
}

0 comments on commit 6660215

Please sign in to comment.