From 7e29cd25020392fa66c792e756bee3b1a29cbf65 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 8 Nov 2013 19:45:26 -0800 Subject: Added a basic menu for when drawer is pulled out --- res/menu/drawer_menu.xml | 14 ++++++++++++++ src/github/daneren2005/dsub/activity/SubsonicActivity.java | 13 +++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 res/menu/drawer_menu.xml 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 @@ + + + + + + + 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; -- cgit v1.2.3