[Android] Properly open the navigation drawer when pressing menu or back in the game list.

This commit is contained in:
Ryan Houdek 2013-05-26 22:29:40 -05:00
parent 0bd8aaf9d4
commit f06fc78814
2 changed files with 16 additions and 23 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dolphinemu.dolphinemu" package="org.dolphinemu.dolphinemu"
android:versionCode="3" android:versionCode="4"
android:versionName="0.3" > android:versionName="0.4" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/> <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>

View File

@ -6,7 +6,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.MenuItem; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
@ -205,25 +205,18 @@ public class GameListView extends ListActivity {
mDrawer.setContentView(layoutResID); mDrawer.setContentView(layoutResID);
onContentChanged(); onContentChanged();
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
mDrawer.toggleMenu();
return true;
}
return super.onOptionsItemSelected(item); @Override
} public boolean onKeyUp(int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.KEYCODE_MENU|| event.getAction() == KeyEvent.KEYCODE_BACK) {
@Override final int drawerState = mDrawer.getDrawerState();
public void onBackPressed() { if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) {
final int drawerState = mDrawer.getDrawerState(); mDrawer.closeMenu();
if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) { return true;
mDrawer.closeMenu(); }
return; mDrawer.openMenu();
} return true;
}
super.onBackPressed(); return false;
} }
} }