From 6eb1fcf167958af2b014d7ece15c5bdcd2cf4902 Mon Sep 17 00:00:00 2001 From: David Eisner Date: Fri, 6 May 2016 18:50:31 +0100 Subject: [PATCH] Delay loading plugin content Some plugins trigger UI when you Kore attempts to browse. We don't want the Content tab to cause this when the user has only opened the Overview tab. For the tabs pinned to the addons view (AddonListContainerFragment), loading by the usual OffScreenPageLimit rules probably makes sense, as you can avoid pinning tabs that don't work well. --- .../org/xbmc/kore/ui/MediaFileListFragment.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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) {