[Android] Automatically open menu only at first launch

Geoffrey Métais git at videolan.org
Thu Sep 21 13:39:18 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 21 13:38:20 2017 +0200| [7c4c63dc98c82a047631369861ac805d0f8a68cb] | committer: Geoffrey Métais

Automatically open menu only at first launch

> https://code.videolan.org/videolan/vlc-android/commit/7c4c63dc98c82a047631369861ac805d0f8a68cb
---

 .../src/org/videolan/vlc/gui/MainActivity.java     | 30 +++++++++++-----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 7c65fb10a..5d94b22c6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -133,8 +133,22 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
             //Restore fragments stack
             restoreFragmentsStack(savedInstanceState, fm);
             mCurrentFragmentId = savedInstanceState.getInt("current", mSettings.getInt("fragment_id", R.id.nav_video));
-        } else
+        } else {
+            if (getIntent().getBooleanExtra(StartActivity.EXTRA_UPGRADE, false)) {
+            /*
+             * 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.
+             */
+            mActivityHandler.postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        mDrawerLayout.openDrawer(mNavigationView);
+                    }
+                }, 500);
+            }
             reloadPreferences();
+        }
 
         /* Set up the action bar */
         prepareActionBar();
@@ -166,20 +180,6 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
         // set a custom shadow that overlays the main content when the drawer opens
         mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
 
-        if (getIntent().getBooleanExtra(StartActivity.EXTRA_UPGRADE, false)) {
-            /*
-             * 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.
-             */
-            new Handler().postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    mDrawerLayout.openDrawer(mNavigationView);
-                }
-            }, 500);
-        }
-
         /* Reload the latest preferences */
         mScanNeeded = savedInstanceState == null && mSettings.getBoolean("auto_rescan", true);
         mExtensionsManager = ExtensionsManager.getInstance();



More information about the Android mailing list