diff options
-rw-r--r-- | res/menu/drawer_menu.xml | 14 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicActivity.java | 13 |
2 files changed, 25 insertions, 2 deletions
diff --git a/res/menu/drawer_menu.xml b/res/menu/drawer_menu.xml new file mode 100644 index 00000000..adba3c90 --- /dev/null +++ b/res/menu/drawer_menu.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:compat="http://schemas.android.com/apk/res-auto">
+
+ <item
+ android:id="@+id/menu_settings"
+ android:icon="@drawable/action_settings"
+ android:title="@string/menu.settings"/>
+
+ <item
+ android:id="@+id/menu_exit"
+ android:icon="@drawable/action_exit"
+ android:title="@string/menu.exit"/>
+</menu>
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 135a76a2..71b2b790 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -85,6 +85,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte ActionBarDrawerToggle drawerToggle;
ListView drawerList;
View lastSelectedView = null;
+ boolean drawerOpen = false;
@Override
protected void onCreate(Bundle bundle) {
@@ -169,6 +170,9 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte setTitle(currentFragment.getTitle());
drawerIdle = true;
+ drawerOpen = false;
+
+ invalidateOptionsMenu();
}
@Override
@@ -182,6 +186,9 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte getSupportActionBar().setDisplayShowCustomEnabled(false);
drawerIdle = true;
+ drawerOpen = true;
+
+ invalidateOptionsMenu();
}
@Override
@@ -272,8 +279,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte @Override
public boolean onCreateOptionsMenu(Menu menu) {
- if(currentFragment != null) {
- MenuInflater menuInflater = getMenuInflater();
+ MenuInflater menuInflater = getMenuInflater();
+ if(drawerOpen == true) {
+ menuInflater.inflate(R.menu.drawer_menu, menu);
+ } else if(currentFragment != null) {
currentFragment.onCreateOptionsMenu(menu, menuInflater);
}
return true;
|