[Android] Exit Subs picker on back at 'Home' level

Geoffrey Métais git at videolan.org
Tue Jun 27 10:19:39 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 27 10:18:15 2017 +0200| [0db8737e0d6d5ecb8ca515e531053c352a58fb6c] | committer: Geoffrey Métais

Exit Subs picker on back at 'Home' level

Close #307

> https://code.videolan.org/videolan/vlc-android/commit/0db8737e0d6d5ecb8ca515e531053c352a58fb6c
---

 .../src/org/videolan/vlc/gui/browser/FileBrowserFragment.java  |  1 +
 .../src/org/videolan/vlc/gui/browser/FilePickerActivity.java   | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
index 984e96daf..e8d072391 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
@@ -115,6 +115,7 @@ public class FileBrowserFragment<T extends BaseBrowserAdapter> extends BaseBrows
                     }
                 });
                 mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING);
+                mRoot = true;
             }
         });
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java
index 02c42b34d..9c8e40c02 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.java
@@ -44,11 +44,13 @@ public class FilePickerActivity extends AppCompatActivity {
 
     @Override
     public void onBackPressed() {
-        if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
+        FilePickerFragment fpf = ((FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder));
+        if (fpf.isRootDirectory())
+            finish();
+        else if (getSupportFragmentManager().getBackStackEntryCount() > 0)
             super.onBackPressed();
-        } else {
-            ((FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder)).browseUp();
-        }
+        else
+            fpf.browseUp();
     }
 
     public void onHomeClick(View v) {



More information about the Android mailing list