[Android] MainActivity: implement up affordance toggle

Edward Wang git at videolan.org
Sun Aug 12 04:28:05 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Aug 11 13:46:29 2012 -0400| [ca342fbd7dd959978cbb31e5bfc778aab101c9b2] | committer: Edward Wang

MainActivity: implement up affordance toggle

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=ca342fbd7dd959978cbb31e5bfc778aab101c9b2
---

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 5ee70b8..560c813 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -155,6 +155,7 @@ public class MainActivity extends SherlockFragmentActivity {
         mActionBar = getSupportActionBar();
         mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
         mActionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
+        mActionBar.setDisplayHomeAsUpEnabled(true);
 
         /* Set up the sidebar click listener */
         listView.setOnItemClickListener(new OnItemClickListener() {
@@ -346,6 +347,13 @@ public class MainActivity extends SherlockFragmentActivity {
             case R.id.ml_menu_search:
             	onSearchRequested();
             	break;
+            case android.R.id.home:
+                /* Toggle the sidebar */
+                if(mMenu.isBehindShowing())
+                    mMenu.showAbove();
+                else
+                    mMenu.showBehind();
+                break;
         }
         return super.onOptionsItemSelected(item);
     }



More information about the Android mailing list