[Android] [PATCH] Replace SlidingMenu lib by support MenuDrawer

Geoffrey Métais geoffrey.metais at gmail.com
Thu Sep 25 16:24:49 CEST 2014


From: Geoffrey <geoffrey.metais at gmail.com>

MenuDrawer is the menu framework provided by Google in android support library v4.
This removes a dependency on a 3rd party lib.

A remaining issue is that the menu listview is wiped from main layout when audio player is shown,
I had to re-add it once SlidingPanel is opened as a work-around.
---
 vlc-android/project.properties                     |   3 +-
 vlc-android/res/drawable-hdpi/drawer_shadow.9.png  | Bin 0 -> 171 bytes
 vlc-android/res/drawable-hdpi/ic_drawer.png        | Bin 0 -> 2842 bytes
 vlc-android/res/drawable-mdpi/drawer_shadow.9.png  | Bin 0 -> 158 bytes
 vlc-android/res/drawable-mdpi/ic_drawer.png        | Bin 0 -> 2837 bytes
 vlc-android/res/drawable-xhdpi/drawer_shadow.9.png | Bin 0 -> 182 bytes
 vlc-android/res/drawable-xhdpi/ic_drawer.png       | Bin 0 -> 1056 bytes
 vlc-android/res/layout/main.xml                    |   8 +-
 vlc-android/res/layout/sidebar.xml                 |  26 +++---
 vlc-android/res/layout/sliding_menu.xml            |   9 --
 vlc-android/res/values/strings.xml                 |   3 +
 .../src/org/videolan/vlc/gui/MainActivity.java     |  96 ++++++++++++---------
 12 files changed, 79 insertions(+), 66 deletions(-)
 create mode 100644 vlc-android/res/drawable-hdpi/drawer_shadow.9.png
 create mode 100644 vlc-android/res/drawable-hdpi/ic_drawer.png
 create mode 100644 vlc-android/res/drawable-mdpi/drawer_shadow.9.png
 create mode 100644 vlc-android/res/drawable-mdpi/ic_drawer.png
 create mode 100644 vlc-android/res/drawable-xhdpi/drawer_shadow.9.png
 create mode 100644 vlc-android/res/drawable-xhdpi/ic_drawer.png
 delete mode 100644 vlc-android/res/layout/sliding_menu.xml

diff --git a/vlc-android/project.properties b/vlc-android/project.properties
index fde0b26..75dcc30 100644
--- a/vlc-android/project.properties
+++ b/vlc-android/project.properties
@@ -10,5 +10,4 @@
 # Project target.
 target=android-19
 android.library.reference.1=../java-libs/appcompat
-android.library.reference.2=../java-libs/SlidingMenu
-android.library.reference.3=../java-libs/WheelView
+android.library.reference.2=../java-libs/WheelView
diff --git a/vlc-android/res/drawable-hdpi/drawer_shadow.9.png b/vlc-android/res/drawable-hdpi/drawer_shadow.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..224cc4ff43a29c546ae50c654c20c58c2f4cdb75
GIT binary patch
literal 171
zcmeAS at N?(olHy`uVBq!ia0vp^JV0#3!3HEVSgovp6icy_X9x!n)NrJ90QsB+9+AZi
z4BVX{%xHe{^je^xucwP+h)3t!Yl?gg4m>OeUfNFiFU`@U5Xr+-Y2h+^&Fz!7ypldm
za#4)fkaYOplLMWvd)czen2t>^YG&h=GRe5G;NW`))xgl;_^?U481>l1!)FR53IYvg
N at O1TaS?83{1OO&fGZ_E?

literal 0
HcmV?d00001

diff --git a/vlc-android/res/drawable-hdpi/ic_drawer.png b/vlc-android/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 0000000000000000000000000000000000000000..ff7b1def9ac3f86488a855f502b965ac75b633fb
GIT binary patch
literal 2842
zcmV+#3+42QP)<h;3K|Lk000e1NJLTq000;O000;W1^@s6;CDUv00009a7bBm000XU
z000XU0RWnu7ytkYPiaF#P*7-ZbZ>KLZ*U+<Lqi~Na&Km7Y-Iodc-oy)XH-+^7Crag
z^g>IBfRsybQWXdwQbLP>6p<z>Aqfylh#{fb6;Z(vMMVS~$e at S=j*ftg6;Uh<iVD~V
z<RPMtgQJLw%KPDaqifc at _vX$1wbwr9tn;0-&j-K=43<bUQ8j=JsX`tR;Dg7+#^K~H
zK!FM*Z~zbpvt%K2{UZSY_<lS*D<Z%Lz5oGu(+dayz)hRLFdT>f59&ghTmgWD0l;*T
zI7<kC6aYYajzXpYKt=(8otP$50H6c_V9R4-;{Z at C0AMG7=F<Rxo%or10RUT+Ar%3j
zkpLhQWr#!oXgdI`&sK^>09Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX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jR8wja~s)SsH?4F9B>~DeG6C^7#J9bv=11Ed_EY>
sXrmczG^34Xw9$-44FCWD0RR6306G;FG3hs#*#H0l07*qoM6N<$f)^G)DF6Tf

literal 0
HcmV?d00001

diff --git a/vlc-android/res/drawable-mdpi/drawer_shadow.9.png b/vlc-android/res/drawable-mdpi/drawer_shadow.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..3797f99c0ef9f657c2b0a1f84a4d0f16cc8ee5f4
GIT binary patch
literal 158
zcmeAS at N?(olHy`uVBq!ia0vp^96+qZ!3HFgEN0vWQY^(zo*^7SP{WbZ0pxQQctjR6
zFmQK*Fr)d&(`$i(4xTQKAr`%FuWaOOaA06QaQd;(yN7D;?7i2paNm#nvBfgTEqd~o
zcU{8lWjX#P6K=BftS at S075ic65$zclza&>r_mjZQ`zwzw1DeI)>FVdQ&MBb at 0Ae69
AivR!s

literal 0
HcmV?d00001

diff --git a/vlc-android/res/drawable-mdpi/ic_drawer.png b/vlc-android/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 0000000000000000000000000000000000000000..fb681ba2639897cc4646d3784b97bbe16f5d4e91
GIT binary patch
literal 2837
zcmV+w3+nWVP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00009a7bBm000XU
z000XU0RWnu7ytkYPiaF#P*7-ZbZ>KLZ*U+<Lqi~Na&Km7Y-Iodc-oy)XH-+^7Crag
z^g>IBfRsybQWXdwQbLP>6p<z>Aqfylh#{fb6;Z(vMMVS~$e at S=j*ftg6;Uh<iVD~V
z<RPMtgQJLw%KPDaqifc at _vX$1wbwr9tn;0-&j-K=43<bUQ8j=JsX`tR;Dg7+#^K~H
zK!FM*Z~zbpvt%K2{UZSY_<lS*D<Z%Lz5oGu(+dayz)hRLFdT>f59&ghTmgWD0l;*T
zI7<kC6aYYajzXpYKt=(8otP$50H6c_V9R4-;{Z at C0AMG7=F<Rxo%or10RUT+Ar%3j
zkpLhQWr#!oXgdI`&sK^>09Y^p6lP1rIRMx#05C~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
z0000$Nkl<Zc-mt8|NlP&C4i-=xs50j>T0VPv57M=PzWeCfQ5m9fsqme7%2 at z%Dpfe
n3zWNnaWpS500000|NjF3akv#B{xHpr00000NkvXXu0mjfm;ygF

literal 0
HcmV?d00001

diff --git a/vlc-android/res/drawable-xhdpi/drawer_shadow.9.png b/vlc-android/res/drawable-xhdpi/drawer_shadow.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..fa3d853e902401d850f09b1cc50a58cda9bd3bb5
GIT binary patch
literal 182
zcmeAS at N?(olHy`uVBq!ia0vp^{6Or)!3HEd1bTh|DVAa<&kznEsNqQI0P;BtJR*x3
z7`Qt at n9=;?>9s(?2u~Ns5RcBc*A at 8=2k<aom at ZfHU481R#!RUh-d)GOIZkwDS|k40
zBPnsx5rv8et+M$t*Xte?r{2HMES<JgYFlVT3^J&(o~M%b>^;BD$vKZ(B+Ju<=2igh
OVDNPHb6Mw<&;$UPn>!5v

literal 0
HcmV?d00001

diff --git a/vlc-android/res/drawable-xhdpi/ic_drawer.png b/vlc-android/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 0000000000000000000000000000000000000000..b9bc3d70f1d29fec2e4530e5d1809edc8e15ad35
GIT binary patch
literal 1056
zcmbVLy>HV%6u%0oKud=rkbnW5+yx|J`<&Q`t(wY-lQsgURT^lJI at GnVjg{JG>??6I
zp$-TJMs}p`%!m$vm_Q6HNWh<fkWfX%0z=RFC=6ARux#JEcklOmANSs)h1%@I*rhQ5
zz(jS<tg{uS->FgdkGtJ{wp^s;CS4?Jv|~pY7%o}Gu<G0ExQ=ai>+V}T4Zw+(*J#qF
zbyIVQ&)caDpZFm|128?4gtpVh6t3cRFVMN~yDvHDxjMHbTcQ<~aLb$PMtHGXYdGDu
zqq^M8bvT`9jKIg#hKaus#9E?rJzkB;saoJ*&xE#ht{+s>T7V at IVJP$2j3Xih6@^DR
zSy9k6D2YfCMD{8fl+$EIlk#xzaLileu4#3%GVsNAI at h8!)C8f^>F}K_Poi}Jsj8ZC
zNK%GbWa6!W+DRser-lqBj-AL0sYe2sGTN(Tlj<Ccw4Z_>TGk<P5DyB)N+u+BC?H-G
zd_T>rXC2cz{u9QL)^TGi#6lg%WHWNueXLCl!K`-2J4y{%G}?URu}iTxOyX?%IG|Ni
z=hzAFdahPhWYd&UB`ZouDIio33t8338aX7(id>P097kc5Tt2T#qN-LD1EI21DCNpU
z)l>>nF>e%+ImA|jnA(AZhkiZgcYrM%i`7aIwke4kglr5uV4+1QiCZLur9}l^v24c+
zQpMHug8KQIIP&gcw-ON__A0D-M?~=N%==jPf2t<1V1%?i{%V(@iuGVB9yUMQ9F7kT
z*vv$1ICdVt{>%oeRyB=A^5xqTV+_DEZ*K2>+`fG7_s{+D?GHCbcTc|H- at OlOr+<7J
z`MUh8J-U;h90BvQ$x;pMJp at l5JO^O;{&-)=znWYD7w()l&fdzcq%&JB*UV?dmF)v&
C(MM<i

literal 0
HcmV?d00001

diff --git a/vlc-android/res/layout/main.xml b/vlc-android/res/layout/main.xml
index ab2a972..069624a 100644
--- a/vlc-android/res/layout/main.xml
+++ b/vlc-android/res/layout/main.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v4.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/root_container"
     android:layout_width="match_parent"
     android:layout_height="match_parent" >
@@ -68,4 +69,7 @@
             android:layout_height="fill_parent" />
     </org.videolan.vlc.widget.SlidingPaneLayout>
 
-</RelativeLayout>
\ No newline at end of file
+    <!-- The navigation drawer -->
+	<include layout="@layout/sidebar"/>
+    
+</android.support.v4.widget.DrawerLayout>
diff --git a/vlc-android/res/layout/sidebar.xml b/vlc-android/res/layout/sidebar.xml
index a2f2bd8..34fe075 100644
--- a/vlc-android/res/layout/sidebar.xml
+++ b/vlc-android/res/layout/sidebar.xml
@@ -1,13 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
-<ListView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/list"
-    android:layout_height="match_parent"
-    android:divider="?attr/background_menu_divider"
-    android:dividerHeight="0.2dp"
-    android:layout_width="208dp"
-    android:paddingTop="?attr/marginTopContent"
-    android:cacheColorHint="#0000"
-    android:fastScrollEnabled="true"
-    android:background="?attr/background_menu">
-
-</ListView>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+	<ListView
+	    android:id="@+id/sidelist"
+	    android:layout_height="match_parent"
+	    android:divider="?attr/background_menu_divider"
+	    android:dividerHeight="0.2dp"
+	    android:layout_width="208dp"
+	    android:paddingTop="?attr/marginTopContent"
+	    android:layout_gravity="start"
+	    android:cacheColorHint="#0000"
+	    android:fastScrollEnabled="true"
+	    android:background="?attr/background_menu">
+	</ListView>
+</merge>
diff --git a/vlc-android/res/layout/sliding_menu.xml b/vlc-android/res/layout/sliding_menu.xml
deleted file mode 100644
index 0c91b5e..0000000
--- a/vlc-android/res/layout/sliding_menu.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<com.slidingmenu.lib.SlidingMenu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:sliding="http://schemas.android.com/apk/res-auto"
-    android:id="@+id/sliding_menu"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    sliding:behindScrollScale="1.0"
-    sliding:shadowDrawable="@drawable/slidingmenu_shadow"
-    sliding:shadowWidth="@dimen/shadow_width" />
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index ed70538..1b50a91 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -293,6 +293,9 @@
     <string name="send_log">Send the log</string>
     <string name="sending_log">Sending the log…</string>
 
+    <string name="drawer_open">Open navigation drawer</string>
+    <string name="drawer_close">Close navigation drawer</string>
+
     <string-array name="hardware_acceleration_list">
         <item>@string/automatic</item>
         <item>@string/hardware_acceleration_disabled</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 093ec81..416ee52 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -64,15 +64,18 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.preference.PreferenceManager;
+import android.support.v4.app.ActionBarDrawerToggle;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentActivity;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v4.widget.DrawerLayout.LayoutParams;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.ActionBarActivity;
 import android.text.InputType;
 import android.util.Log;
-import android.view.Display;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -88,8 +91,6 @@ import android.widget.ProgressBar;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.slidingmenu.lib.SlidingMenu;
-
 public class MainActivity extends ActionBarActivity {
     public final static String TAG = "VLC/MainActivity";
 
@@ -105,12 +106,13 @@ public class MainActivity extends ActionBarActivity {
     private static final int ACTIVITY_SHOW_INFOLAYOUT = 2;
 
     private ActionBar mActionBar;
-    private SlidingMenu mMenu;
     private SidebarAdapter mSidebarAdapter;
     private AudioPlayer mAudioPlayer;
     private AudioServiceController mAudioController;
     private SlidingPaneLayout mSlidingPane;
-    private RelativeLayout mRootContainer;
+    private DrawerLayout mRootContainer;
+    private ListView mListView;
+    private ActionBarDrawerToggle mDrawerToggle;
 
     private View mInfoLayout;
     private ProgressBar mInfoProgress;
@@ -184,10 +186,6 @@ public class MainActivity extends ActionBarActivity {
         /* Enable the indeterminate progress feature */
         requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
 
-        // Set up the sliding menu
-        mMenu = (SlidingMenu) LayoutInflater.from(this).inflate(R.layout.sliding_menu, null);
-        changeMenuOffset();
-
         SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
         boolean enableBlackTheme = pref.getBoolean("enable_black_theme", false);
         if (enableBlackTheme)
@@ -199,35 +197,44 @@ public class MainActivity extends ActionBarActivity {
         mSlidingPane = (SlidingPaneLayout) v_main.findViewById(R.id.pane);
         mSlidingPane.setPanelSlideListener(mPanelSlideListener);
 
-        View sidebar = LayoutInflater.from(this).inflate(R.layout.sidebar, null);
-        final ListView listView = (ListView)sidebar.findViewById(android.R.id.list);
-        listView.setFooterDividersEnabled(true);
+        mListView = (ListView)v_main.findViewById(R.id.sidelist);
+        mListView.setFooterDividersEnabled(true);
         mSidebarAdapter = new SidebarAdapter(this);
-        listView.setAdapter(mSidebarAdapter);
-        mMenu.setMenu(sidebar);
-        mMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT, true);
+        mListView.setAdapter(mSidebarAdapter);
+
 
         /* Initialize UI variables */
         mInfoLayout = v_main.findViewById(R.id.info_layout);
         mInfoProgress = (ProgressBar) v_main.findViewById(R.id.info_progress);
         mInfoText = (TextView) v_main.findViewById(R.id.info_text);
         mAudioPlayerFilling = v_main.findViewById(R.id.audio_player_filling);
-        mRootContainer = (RelativeLayout) v_main.findViewById(R.id.root_container);
+        mRootContainer = (DrawerLayout) v_main.findViewById(R.id.root_container);
 
         /* Set up the action bar */
         prepareActionBar();
 
-        /* Set up the sidebar click listener */
-        listView.setOnItemClickListener(new OnItemClickListener() {
+        /* Set up the sidebar click listener
+         * no need to invalidate menu for now */
+        mDrawerToggle = new ActionBarDrawerToggle(this, mRootContainer,
+                R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {};
+
+        // Set the drawer toggle as the DrawerListener
+        mRootContainer.setDrawerListener(mDrawerToggle);
+        // set a custom shadow that overlays the main content when the drawer opens
+        mRootContainer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+        getSupportActionBar().setHomeButtonEnabled(true);
+
+        mListView.setOnItemClickListener(new OnItemClickListener() {
 
             @Override
             public void onItemClick(AdapterView<?> parent, View view,
                     int position, long id) {
-                SidebarAdapter.SidebarEntry entry = (SidebarEntry) listView.getItemAtPosition(position);
+                SidebarAdapter.SidebarEntry entry = (SidebarEntry) mListView.getItemAtPosition(position);
                 Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);
 
                 if(current == null || (entry != null && current.getTag().equals(entry.id))) { /* Already selected */
-                    mMenu.showContent();
+                    mRootContainer.closeDrawer(mListView);
                     return;
                 }
 
@@ -261,7 +268,7 @@ public class MainActivity extends ActionBarActivity {
                 if(current.getTag().equals("tracks"))
                     getFragment("audio").setUserVisibleHint(false);
 
-                mMenu.showContent();
+                mRootContainer.closeDrawer(mListView);
             }
         });
 
@@ -282,7 +289,7 @@ public class MainActivity extends ActionBarActivity {
             mHandler.postDelayed(new Runnable() {
                 @Override
                 public void run() {
-                    mMenu.showMenu();
+                    mRootContainer.openDrawer(mListView);
                 }
             }, 500);
         }
@@ -299,12 +306,12 @@ public class MainActivity extends ActionBarActivity {
         reloadPreferences();
     }
 
-    private void changeMenuOffset() {
-        WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
-        Display display = wm.getDefaultDisplay();
-        @SuppressWarnings("deprecation")
-        int behindOffset_dp = Util.convertPxToDp(display.getWidth()) - 208;
-        mMenu.setBehindOffset(Util.convertDpToPx(behindOffset_dp));
+
+    @Override
+    protected void onPostCreate(Bundle savedInstanceState) {
+        super.onPostCreate(savedInstanceState);
+        // Sync the toggle state after onRestoreInstanceState has occurred.
+        mDrawerToggle.syncState();
     }
 
     @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@@ -327,7 +334,7 @@ public class MainActivity extends ActionBarActivity {
         /* Load media items from database and storage */
         if (mScanNeeded)
             MediaLibrary.getInstance().loadMediaItems();
-    }
+   }
 
     @Override
     protected void onResumeFragments() {
@@ -422,9 +429,9 @@ public class MainActivity extends ActionBarActivity {
 
     @Override
     public void onBackPressed() {
-        if(mMenu.isMenuShowing()) {
+        if(mRootContainer.isDrawerOpen(mListView)) {
             /* Close the menu first */
-            mMenu.showContent();
+            mRootContainer.closeDrawer(mListView);
             return;
         }
 
@@ -579,7 +586,7 @@ public class MainActivity extends ActionBarActivity {
     @Override
     public void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
-        changeMenuOffset();
+        mDrawerToggle.onConfigurationChanged(newConfig);
     }
 
     @Override
@@ -654,10 +661,9 @@ public class MainActivity extends ActionBarActivity {
                     break;
                 }
                 /* Toggle the sidebar */
-                if(mMenu.isMenuShowing())
-                    mMenu.showContent();
-                else
-                    mMenu.showMenu();
+                if (mDrawerToggle.onOptionsItemSelected(item)) {
+                    return true;
+                }
                 break;
             case R.id.search_clear_history:
                 MediaDatabase.getInstance().clearSearchHistory();
@@ -871,21 +877,29 @@ public class MainActivity extends ActionBarActivity {
                 if (resId != 0)
                     mSlidingPane.setShadowResource(resId);
                 mAudioPlayer.setHeaderVisibilities(false, false, true, true, true);
-                mMenu.setSlidingEnabled(true);
+                mRootContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
                 removeTipViewIfDisplayed();
                 mAudioPlayer.showAudioPlayerTips();
+                /*
+                 * TODO proper resolution of this bug
+                 * Drawer listview disappears when audio player is displayed
+                 * Here we restore it, this is just a workaround...
+                 */
+                if (findViewById(R.id.sidelist) == null){
+                	mRootContainer.addView(mListView);
+                }
             }
 
             @Override
             public void onPanelOpenedEntirely() {
                 mSlidingPane.setShadowDrawable(null);
-                mMenu.setSlidingEnabled(true);
+                mRootContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
             }
 
             @Override
             public void onPanelClosed() {
                 mAudioPlayer.setHeaderVisibilities(true, true, false, false, false);
-                mMenu.setSlidingEnabled(false);
+                mRootContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
                 mAudioPlayer.showPlaylistTips();
             }
 
@@ -901,8 +915,8 @@ public class MainActivity extends ActionBarActivity {
             removeTipViewIfDisplayed();
             View v = LayoutInflater.from(this).inflate(layoutId, null);
             mRootContainer.addView(v,
-                    new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
-                            RelativeLayout.LayoutParams.MATCH_PARENT));
+                    new DrawerLayout.LayoutParams(DrawerLayout.LayoutParams.MATCH_PARENT,
+                    		DrawerLayout.LayoutParams.MATCH_PARENT));
 
             v.setOnClickListener(new View.OnClickListener() {
                 @Override
-- 
1.9.1



More information about the Android mailing list