[Android] TV: Save prefetch files list on browsing

Geoffrey Métais git at videolan.org
Thu Feb 7 15:26:08 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb  7 11:19:48 2019 +0100| [6c0db159e1cb3215aa5689abae77fc03df599958] | committer: Geoffrey Métais

TV: Save prefetch files list on browsing

> https://code.videolan.org/videolan/vlc-android/commit/6c0db159e1cb3215aa5689abae77fc03df599958
---

 .../videolan/vlc/gui/tv/browser/DirectoryBrowserFragment.java | 11 +++++++++++
 .../videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java   | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/DirectoryBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/DirectoryBrowserFragment.java
index a25d23788..c66dcaf3c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/DirectoryBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/DirectoryBrowserFragment.java
@@ -29,7 +29,9 @@ import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 
+import org.jetbrains.annotations.NotNull;
 import org.videolan.medialibrary.media.MediaLibraryItem;
+import org.videolan.medialibrary.media.MediaWrapper;
 import org.videolan.vlc.ExternalMonitor;
 import org.videolan.vlc.viewmodels.browser.BrowserModel;
 import org.videolan.vlc.viewmodels.browser.BrowserModelKt;
@@ -38,6 +40,9 @@ import java.util.List;
 import java.util.Map;
 
 import androidx.annotation.Nullable;
+import androidx.leanback.widget.Presenter;
+import androidx.leanback.widget.Row;
+import androidx.leanback.widget.RowPresenter;
 import androidx.lifecycle.Observer;
 import androidx.lifecycle.ViewModelProviders;
 
@@ -70,4 +75,10 @@ public class DirectoryBrowserFragment extends MediaSortedFragment<BrowserModel>
             }
         });
     }
+
+    @Override
+    public void onItemClicked(@NotNull Presenter.ViewHolder viewHolder, @NotNull Object item, @NotNull RowPresenter.ViewHolder viewHolder1, @NotNull Row row) {
+        if (item instanceof MediaWrapper && ((MediaWrapper)item).getType() == MediaWrapper.TYPE_DIR) viewModel.saveList((MediaWrapper)item);
+        super.onItemClicked(viewHolder, item, viewHolder1, row);
+    }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java
index d3faf9911..5c306a2bf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java
@@ -31,7 +31,9 @@ import android.content.IntentFilter;
 import android.os.Build;
 import android.os.Bundle;
 
+import org.jetbrains.annotations.NotNull;
 import org.videolan.medialibrary.media.MediaLibraryItem;
+import org.videolan.medialibrary.media.MediaWrapper;
 import org.videolan.vlc.ExternalMonitor;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.dialogs.VlcLoginDialog;
@@ -41,6 +43,9 @@ import java.util.List;
 import java.util.Map;
 
 import androidx.annotation.Nullable;
+import androidx.leanback.widget.Presenter;
+import androidx.leanback.widget.Row;
+import androidx.leanback.widget.RowPresenter;
 import androidx.lifecycle.Observer;
 import androidx.lifecycle.ViewModelProviders;
 import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -92,6 +97,12 @@ public class NetworkBrowserFragment extends MediaSortedFragment<NetworkModel> {
         LocalBroadcastManager.getInstance(VLCApplication.getAppContext()).unregisterReceiver(mLocalReceiver);
     }
 
+    @Override
+    public void onItemClicked(@NotNull Presenter.ViewHolder viewHolder, @NotNull Object item, @NotNull RowPresenter.ViewHolder viewHolder1, @NotNull Row row) {
+        if (item instanceof MediaWrapper && ((MediaWrapper)item).getType() == MediaWrapper.TYPE_DIR) viewModel.saveList((MediaWrapper)item);
+        super.onItemClicked(viewHolder, item, viewHolder1, row);
+    }
+
     private BroadcastReceiver mLocalReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {



More information about the Android mailing list