[Android] Merge development branch
Geoffrey Métais
git at videolan.org
Wed Apr 4 18:36:23 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Apr 4 18:04:01 2018 +0200| [d0c4bfd184339820117eca003a820cc8032cbd2a] | committer: Geoffrey Métais
Merge development branch
> https://code.videolan.org/videolan/vlc-android/commit/d0c4bfd184339820117eca003a820cc8032cbd2a
---
vlc-android/src/org/videolan/vlc/ExternalMonitor.java | 2 +-
.../videolan/vlc/gui/browser/BaseBrowserFragment.java | 17 +++++------------
.../videolan/vlc/gui/browser/FilePickerFragment.java | 5 -----
.../videolan/vlc/viewmodels/browser/BrowserProvider.kt | 1 -
.../vlc/viewmodels/browser/FilePickerProvider.kt | 9 ++++++++-
5 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index 5c16c8ff0..5561321f3 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -82,7 +82,7 @@ public class ExternalMonitor extends BroadcastReceiver implements LifecycleObser
}
private static void checkNewStorages(final Context ctx) {
- if (AndroidUtil.isICSOrLater && VLCApplication.getMLInstance().isInitiated())
+ if (VLCApplication.getMLInstance().isInitiated())
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index cfeaefa3c..64881d2f1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -110,11 +110,11 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment<BrowserPr
if (mCurrentMedia != null) mMrl = mCurrentMedia.getLocation();
else mMrl = bundle.getString(KEY_MRL);
mSavedPosition = bundle.getInt(KEY_POSITION);
- } else if (getActivity().getIntent() != null){
- mMrl = getActivity().getIntent().getDataString();
- getActivity().setIntent(null);
+ } else if (requireActivity().getIntent() != null){
+ mMrl = requireActivity().getIntent().getDataString();
+ requireActivity().setIntent(null);
}
- mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("browser_show_hidden_files", false);
+ mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(requireContext()).getBoolean("browser_show_hidden_files", false);
mRoot = defineIsRoot();
}
@@ -162,7 +162,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment<BrowserPr
mProvider.getDescriptionUpdate().observe(this, new Observer<Pair<Integer, String>>() {
@Override
public void onChanged(@Nullable Pair<Integer, String> pair) {
- mAdapter.notifyItemChanged(pair.getFirst(), pair.getSecond());
+ if (pair != null) mAdapter.notifyItemChanged(pair.getFirst(), pair.getSecond());
}
});
initFavorites();
@@ -290,13 +290,6 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment<BrowserPr
}
}
- protected int getBrowserFlags() {
- int flags = MediaBrowser.Flag.Interact;
- if (mShowHiddenFiles)
- flags |= MediaBrowser.Flag.ShowHiddenFiles;
- return flags;
- }
-
static class BrowserFragmentHandler extends WeakHandler<BaseBrowserFragment> {
static final int MSG_SHOW_LOADING = 0;
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
index 854e4f990..e75151bf7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerFragment.java
@@ -124,9 +124,4 @@ public class FilePickerFragment extends FileBrowserFragment {
return true;
} else return mMrl.length() < 7;
}
-
- @Override
- protected int getBrowserFlags() {
- return MediaBrowser.Flag.Interact|MediaBrowser.Flag.NoSlavesAutodetect;
- }
}
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserProvider.kt b/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserProvider.kt
index 0e6ad9927..905487e84 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/browser/BrowserProvider.kt
@@ -82,7 +82,6 @@ abstract class BrowserProvider(val url: String?, private val showHiddenFiles: Bo
}
}
- //TODO Show hidden files
private fun parseSubDirectories() {
synchronized(currentMediaList) {
currentMediaList.addAll(dataset.value)
diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/browser/FilePickerProvider.kt b/vlc-android/src/org/videolan/vlc/viewmodels/browser/FilePickerProvider.kt
index 5d749b389..f72d8f116 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/browser/FilePickerProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/browser/FilePickerProvider.kt
@@ -3,6 +3,8 @@ package org.videolan.vlc.viewmodels.browser
import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.ViewModelProvider
import org.videolan.libvlc.util.MediaBrowser
+import org.videolan.medialibrary.media.MediaLibraryItem
+import org.videolan.medialibrary.media.MediaWrapper
class FilePickerProvider(url: String?) : FileBrowserProvider(url, true, false) {
@@ -13,8 +15,13 @@ class FilePickerProvider(url: String?) : FileBrowserProvider(url, true, false) {
override fun initBrowser(listener: MediaBrowser.EventListener) {
super.initBrowser(listener)
- mediabrowser?.setIgnoreFileTypes("db,nfo,ini,jpg,jpeg,ljpg,gif,png,pgm,pgmyuv,pbm,pam,tga,bmp,pnm,xpm,xcf,pcx,tif,tiff,lbm,sfv");
+ mediabrowser?.setIgnoreFileTypes("db,nfo,ini,jpg,jpeg,ljpg,gif,png,pgm,pgmyuv,pbm,pam,tga,bmp,pnm,xpm,xcf,pcx,tif,tiff,lbm,sfv")
}
+
+ override suspend fun addMedia(media: MediaLibraryItem) {
+ if (media is MediaWrapper && media.type == MediaWrapper.TYPE_SUBTITLE) super.addMedia(media)
+ }
+
class Factory(val url: String?): ViewModelProvider.NewInstanceFactory() {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@Suppress("UNCHECKED_CAST")
More information about the Android
mailing list