Skip to content
Snippets Groups Projects
Commit f54716b4 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Show path from browsers in ActionBar subtitle

parent 86060784
No related branches found
No related tags found
No related merge requests found
......@@ -847,6 +847,9 @@ public class MainActivity extends AudioPlayerContainerActivity implements Filter
if(item == null)
return false;
getSupportActionBar().setTitle(null); //clear title
getSupportActionBar().setSubtitle(null); //clear subtitle
int id = item.getItemId();
FragmentManager fm = getSupportFragmentManager();
Fragment current = fm.findFragmentById(R.id.fragment_placeholder);
......
......@@ -60,7 +60,9 @@ import org.videolan.vlc.interfaces.IRefreshable;
import org.videolan.vlc.media.MediaDatabase;
import org.videolan.vlc.media.MediaUtils;
import org.videolan.vlc.media.MediaWrapper;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.FileUtils;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.WeakHandler;
......@@ -192,6 +194,18 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
return mCurrentMedia != null ? mCurrentMedia.getTitle() : mMrl;
}
public String getSubTitle(){
if (mRoot)
return null;
String mrl = Strings.removeFileProtocole(mMrl);
if (!TextUtils.isEmpty(mrl)) {
if (this instanceof FileBrowserFragment && mrl.startsWith(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY))
mrl = getString(R.string.internal_memory)+mrl.substring(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY.length());
mrl = mrl.replaceAll("://", " ").replaceAll("/", " > ");
}
return mCurrentMedia != null ? mrl : null;
}
@Override
protected void display() {
if (!mReadyToDisplay) {
......
......@@ -41,6 +41,16 @@ public abstract class MediaBrowserFragment extends PlaybackServiceFragment {
mMediaLibrary = MediaLibrary.getInstance();
}
public void onStart(){
super.onStart();
final AppCompatActivity activity = (AppCompatActivity)getActivity();
if (activity != null && activity.getSupportActionBar() != null) {
activity.getSupportActionBar().setTitle(getTitle());
activity.getSupportActionBar().setSubtitle(getSubTitle());
getActivity().supportInvalidateOptionsMenu();
}
}
public void setReadyToDisplay(boolean ready) {
if (ready && !mReadyToDisplay)
display();
......@@ -51,13 +61,6 @@ public abstract class MediaBrowserFragment extends PlaybackServiceFragment {
protected abstract void display();
protected abstract String getTitle();
protected String getSubTitle() { return null; }
public abstract void clear();
public void onStart(){
super.onStart();
final AppCompatActivity activity = (AppCompatActivity)getActivity();
if (activity != null && activity.getSupportActionBar() != null) {
activity.getSupportActionBar().setTitle(getTitle());
getActivity().supportInvalidateOptionsMenu();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment