diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-11-08 19:45:26 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-11-08 19:45:26 -0800 |
commit | 7e29cd25020392fa66c792e756bee3b1a29cbf65 (patch) | |
tree | 34a1796f5522fd01369b106686c97e516a7723ff | |
parent | 1d6294de8292f6945534f3ed4819b86d11c6ea75 (diff) | |
download | dsub-7e29cd25020392fa66c792e756bee3b1a29cbf65.tar.gz dsub-7e29cd25020392fa66c792e756bee3b1a29cbf65.tar.bz2 dsub-7e29cd25020392fa66c792e756bee3b1a29cbf65.zip |
Added a basic menu for when drawer is pulled out
-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;
|