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

Browse back with arrow

parent 41e6ece3
......@@ -51,6 +51,7 @@ public class AudioPlayerContainerActivity extends AppCompatActivity {
public static final String ACTION_SHOW_PLAYER = "org.videolan.vlc.gui.ShowPlayer";
protected ActionBar mActionBar;
protected Toolbar mToolbar;
protected AudioPlayer mAudioPlayer;
protected AudioServiceController mAudioController;
protected SlidingPaneLayout mSlidingPane;
......@@ -71,8 +72,8 @@ public class AudioPlayerContainerActivity extends AppCompatActivity {
mRootContainer = (ViewGroup) ((ViewGroup) this
.findViewById(android.R.id.content)).getChildAt(0);
Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
setSupportActionBar(toolbar);
mToolbar = (Toolbar) findViewById(R.id.main_toolbar);
setSupportActionBar(mToolbar);
mActionBar = getSupportActionBar();
mSlidingPane = (SlidingPaneLayout) findViewById(R.id.pane);
......
......@@ -27,6 +27,7 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.MediaWrapper;
......@@ -43,7 +44,7 @@ import org.videolan.vlc.interfaces.ISortable;
import java.util.ArrayList;
public class SecondaryActivity extends AudioPlayerContainerActivity {
public final static String TAG = "VLC/EqualizerFragment";
public final static String TAG = "VLC/SecondaryActivity";
public static final String ALBUMS_SONGS = "albumsSongs";
public static final String ALBUM = "album";
......@@ -62,6 +63,14 @@ public class SecondaryActivity extends AudioPlayerContainerActivity {
initAudioPlayerContainerActivity();
mActionBar.setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);
if (current instanceof StorageBrowserFragment)
((StorageBrowserFragment) current).goBack();
}
});
if (getSupportFragmentManager().getFragments() == null) {
String fragmentId = getIntent().getStringExtra("fragment");
......@@ -85,7 +94,7 @@ public class SecondaryActivity extends AudioPlayerContainerActivity {
@Override
protected void onPause() {
if (isFinishing())
overridePendingTransition(0,0);
overridePendingTransition(0, 0);
super.onPause();
}
......
......@@ -57,7 +57,6 @@ import org.videolan.vlc.gui.CommonDialogs;
import org.videolan.vlc.gui.DividerItemDecoration;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.gui.SidebarAdapter;
import org.videolan.vlc.gui.audio.MediaComparators;
import org.videolan.vlc.gui.video.VideoPlayerActivity;
import org.videolan.vlc.interfaces.IRefreshable;
import org.videolan.vlc.util.Util;
......@@ -70,7 +69,6 @@ import org.videolan.vlc.widget.SwipeRefreshLayout;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
public abstract class BaseBrowserFragment extends MediaBrowserFragment implements IRefreshable, MediaBrowser.EventListener, SwipeRefreshLayout.OnRefreshListener {
......@@ -91,7 +89,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
public String mMrl;
protected MediaWrapper mCurrentMedia;
protected int mSavedPosition = -1, mFavorites = 0;
protected boolean mRoot;
public boolean mRoot;
protected LibVLC mLibVLC;
private SparseArray<ArrayList<MediaWrapper>> mMediaLists = new SparseArray<ArrayList<MediaWrapper>>();
......@@ -181,7 +179,10 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
}
public void goBack(){
getActivity().getSupportFragmentManager().popBackStack();
if (!mRoot)
getActivity().getSupportFragmentManager().popBackStack();
else
getActivity().finish();
}
public void browse (MediaWrapper media, int position){
......
......@@ -29,7 +29,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.AppCompatEditText;
......@@ -46,7 +45,6 @@ import org.videolan.vlc.MediaWrapper;
import org.videolan.vlc.R;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.CustomDirectories;
import org.videolan.vlc.util.Strings;
import java.io.File;
......
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