[Android] Improve the user experience by opening the sliding menu at start

Ludovic Fauvet git at videolan.org
Tue Sep 25 17:09:23 CEST 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Tue Sep 25 17:06:25 2012 +0200| [cd4082dbb914464c246ecb45c37a0c1589fb8995] | committer: Ludovic Fauvet

Improve the user experience by opening the sliding menu at start

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index e41b33d..a1f5d64 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -48,6 +48,7 @@ import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.Configuration;
 import android.os.Bundle;
+import android.os.Handler;
 import android.preference.PreferenceManager;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
@@ -217,6 +218,20 @@ public class MainActivity extends SherlockFragmentActivity {
 
             if (mSettings.getInt(PREF_SHOW_INFO, -1) != mVersionNumber)
                 showInfoDialog();
+            else {
+                /*
+                 * The sliding menu is automatically opened when the user closes
+                 * the info dialog. If (for any reason) the dialog is not shown,
+                 * open the menu after a short delay.
+                 */
+                final Handler handler = new Handler();
+                handler.postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        mMenu.showBehind();
+                    }
+                }, 1000);
+            }
         }
 
         /* Prepare the progressBar */
@@ -419,7 +434,10 @@ public class MainActivity extends SherlockFragmentActivity {
                     editor.putInt(PREF_SHOW_INFO, mVersionNumber);
                     editor.commit();
                 }
+                /* Close the dialog */
                 infoDialog.dismiss();
+                /* and finally open the sliding menu */
+                mMenu.showBehind();
             }
         });
         infoDialog.show();



More information about the Android mailing list