Commit 18739166 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Fix close warning not shown in browsers

parent 6e64f80d
......@@ -200,11 +200,10 @@ public class AudioPlayerContainerActivity extends BaseActivity implements Playba
switch (item.getItemId()) {
// Current fragment loaded
Fragment current = getCurrentFragment();
if (current instanceof StorageBrowserFragment)
((StorageBrowserFragment) current).goBack();
final Fragment current = getCurrentFragment();
if (current instanceof StorageBrowserFragment && ((StorageBrowserFragment) current).goBack())
return true;
return true;
return super.onOptionsItemSelected(item);
......@@ -347,8 +347,7 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
// If it's the directory view, a "backpressed" action shows a parent.
final Fragment fragment = getCurrentFragment();
if (fragment instanceof BaseBrowserFragment){
if (fragment instanceof BaseBrowserFragment && ((BaseBrowserFragment)fragment).goBack()){
} else if (fragment instanceof ExtensionBrowser) {
((ExtensionBrowser) fragment).goBack();
......@@ -277,15 +277,14 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
return mCurrentMedia != null ? mrl : null;
public void goBack(){
public boolean goBack(){
final FragmentActivity activity = getActivity();
if (activity == null)
if (activity == null) return false;
if (!mRoot) {
if (!activity.getSupportFragmentManager().popBackStackImmediate() && activity instanceof MainActivity)
((MainActivity)activity).showFragment(this instanceof NetworkBrowserFragment ? :;
} else
return !mRoot;
public void browse(MediaWrapper media, int position, boolean save) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment