[Android] Fix crash on rotation with login dialog

Geoffrey Métais git at videolan.org
Wed Apr 11 11:57:12 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Apr 11 11:25:13 2018 +0200| [09323729337a450aea57baa5ea0adc72ec221105] | committer: Geoffrey Métais

Fix crash on rotation with login dialog

> https://code.videolan.org/videolan/vlc-android/commit/09323729337a450aea57baa5ea0adc72ec221105
---

 .../org/videolan/vlc/gui/browser/BaseBrowserFragment.java   | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 64881d2f1..1df47e7d9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -48,14 +48,11 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.widget.TextView;
 
-import org.videolan.libvlc.util.MediaBrowser;
 import org.videolan.medialibrary.media.MediaLibraryItem;
 import org.videolan.medialibrary.media.MediaWrapper;
 import org.videolan.vlc.R;
-import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.databinding.DirectoryBrowserBinding;
 import org.videolan.vlc.gui.InfoActivity;
-import org.videolan.vlc.gui.MainActivity;
 import org.videolan.vlc.gui.dialogs.SavePlaylistDialog;
 import org.videolan.vlc.gui.helpers.UiTools;
 import org.videolan.vlc.gui.view.ContextMenuRecyclerView;
@@ -224,15 +221,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment<BrowserPr
     public boolean goBack(){
         final FragmentActivity activity = getActivity();
         if (activity == null) return false;
-        if (!mRoot) {
-            final FragmentManager fm = activity.getSupportFragmentManager();
-            final String tag = fm.getBackStackEntryAt(fm.getBackStackEntryCount()-1).getName();
-            if (!activity.getSupportFragmentManager().popBackStackImmediate() && activity instanceof MainActivity)
-                ((MainActivity)activity).getNavigator().showFragment(this instanceof NetworkBrowserFragment ? R.id.nav_network : R.id.nav_directories);
-            final Fragment current = fm.findFragmentByTag(tag);
-            final View view = current != null ? current.getView() : null;
-            if (view != null) view.setVisibility(View.VISIBLE);
-        }
+        if (!mRoot) activity.getSupportFragmentManager().popBackStack();
         return !mRoot;
     }
 



More information about the Android mailing list