diff --git a/app/src/main/java/org/xbmc/kore/ui/MediaFileListFragment.java b/app/src/main/java/org/xbmc/kore/ui/MediaFileListFragment.java index 0a9585b..20d7803 100644 --- a/app/src/main/java/org/xbmc/kore/ui/MediaFileListFragment.java +++ b/app/src/main/java/org/xbmc/kore/ui/MediaFileListFragment.java @@ -78,6 +78,7 @@ public class MediaFileListFragment extends AbstractListFragment { int playlistId = PlaylistType.MUSIC_PLAYLISTID; // this is the ID of the music player // private MediaFileListAdapter adapter = null; boolean browseRootAlready = false; + FileLocation loadOnVisible = null; ArrayList rootFileLocation = new ArrayList(); Queue mediaQueueFileLocation = new LinkedList<>(); @@ -162,8 +163,9 @@ public class MediaFileListFragment extends AbstractListFragment { ((MediaFileListAdapter) getAdapter()).setFilelistItems(list); } else if (rootPath != null) { - browseRootAlready = true; - browseDirectory(rootPath); + loadOnVisible = rootPath; + // setUserVisibleHint may have already fired + setUserVisibleHint(getUserVisibleHint()); } else { browseSources(); @@ -171,6 +173,17 @@ public class MediaFileListFragment extends AbstractListFragment { return root; } + @Override + public void setUserVisibleHint (boolean isVisibleToUser) { + super.setUserVisibleHint(isVisibleToUser); + if (isVisibleToUser && loadOnVisible != null) { + FileLocation rootPath = loadOnVisible; + loadOnVisible = null; + browseRootAlready = true; + browseDirectory(rootPath); + } + } + void handleFileSelect(FileLocation f) { // if selection is a directory, browse the the level below if (f.isDirectory) {