Commit e8baf029 authored by Geoffrey Métais's avatar Geoffrey Métais

Option to show hidden files in browsers

parent 6fd911b7
......@@ -303,6 +303,8 @@
<string name="enable_double_tap_seek_summary">Double tap on screen edges to seek by 10 seconds</string>
<string name="popup_keepscreen_title">Keep screen ON in Pop-Up mode</string>
<string name="popup_keepscreen_summary">Always keep screen ON while Pop-Up is displayed, even if video is paused.</string>
<string name="browser_show_hidden_files_title">Show hidden files</string>
<string name="browser_show_hidden_files_summary">Show hidden files in browsers</string>
<string name="subtitles_prefs_category">Subtitles</string>
<string name="subtitles_size_title">Subtitles Size</string>
......
......@@ -9,6 +9,12 @@
android:summary="@string/auto_rescan_summary"
android:title="@string/auto_rescan" />
<CheckBoxPreference
android:defaultValue="false"
android:key="browser_show_hidden_files"
android:summary="@string/browser_show_hidden_files_summary"
android:title="@string/browser_show_hidden_files_title" />
<EditTextPreference
android:defaultValue=""
android:key="network_caching"
......
......@@ -244,9 +244,6 @@ public class BaseBrowserAdapter extends BaseQueuedAdapter<ArrayList<MediaLibrary
else
position = top ? mTop : list.size();
if (item .getItemType() == TYPE_MEDIA && item.getTitle().startsWith("."))
return;
if (item .getItemType() == TYPE_MEDIA && (((MediaWrapper) item).getType() == MediaWrapper.TYPE_VIDEO || ((MediaWrapper) item).getType() == MediaWrapper.TYPE_AUDIO))
mMediaCount++;
......
......@@ -36,6 +36,7 @@ import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -102,6 +103,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
protected int mSavedPosition = -1, mFavorites = 0;
public boolean mRoot;
boolean goBack = false;
private final boolean mShowHiddenFiles;
private SparseArray<ArrayList<MediaWrapper>> mFoldersContentLists;
protected ArrayList<MediaWrapper> mediaList;
......@@ -117,7 +119,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
mBrowserHandler.post(runnable);
}
public BaseBrowserFragment(){
public BaseBrowserFragment() {
mHandler = new BrowserFragmentHandler(this);
mAdapter = new BaseBrowserAdapter(this);
if (mBrowserHandler == null) {
......@@ -125,6 +127,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
handlerThread.start();
mBrowserHandler = new Handler(handlerThread.getLooper());
}
mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("browser_show_hidden_files", false);
}
public void onCreate(Bundle bundle) {
......@@ -148,6 +151,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
mMrl = getActivity().getIntent().getDataString();
getActivity().setIntent(null);
}
}
protected int getLayoutId(){
......@@ -380,7 +384,10 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
}
protected int getBrowserFlags() {
return MediaBrowser.Flag.Interact;
int flags = MediaBrowser.Flag.Interact;
if (mShowHiddenFiles)
flags |= MediaBrowser.Flag.ShowHiddenFiles;
return flags;
}
static class BrowserFragmentHandler extends WeakHandler<BaseBrowserFragment> {
......@@ -588,7 +595,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
if (mw != null){
if (mw.getType() == MediaWrapper.TYPE_DIR || mw.getType() == MediaWrapper.TYPE_PLAYLIST){
final Uri uri = mw.getUri();
mMediaBrowser.browse(uri, 0);
mMediaBrowser.browse(uri, mShowHiddenFiles ? MediaBrowser.Flag.ShowHiddenFiles : 0);
return;
}
}
......
......@@ -33,10 +33,13 @@ import android.support.v17.leanback.widget.OnItemViewSelectedListener;
import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.RowPresenter;
import android.support.v7.preference.PreferenceManager;
import android.text.TextUtils;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.util.MediaBrowser;
import org.videolan.medialibrary.media.MediaWrapper;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.helpers.MediaComparators;
import org.videolan.vlc.gui.tv.DetailsActivity;
import org.videolan.vlc.gui.tv.MainTvActivity;
......@@ -44,7 +47,6 @@ import org.videolan.vlc.gui.tv.MediaItemDetails;
import org.videolan.vlc.gui.tv.TvUtil;
import org.videolan.vlc.gui.tv.browser.interfaces.BrowserActivityInterface;
import org.videolan.vlc.gui.tv.browser.interfaces.DetailsFragment;
import org.videolan.medialibrary.media.MediaWrapper;
import org.videolan.vlc.util.VLCInstance;
import java.util.ArrayList;
......@@ -57,11 +59,13 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
private Uri mUri;
ArrayList<MediaWrapper> mMediaList = null;
private MediaWrapper mItemSelected;
private boolean mShowHiddenFiles = false;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setOnItemViewSelectedListener(this);
setOnItemViewClickedListener(this);
mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("browser_show_hidden_files", false);
}
public void onResume() {
......@@ -70,9 +74,12 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
mMediaBrowser = new MediaBrowser(VLCInstance.get(), this);
if (mMediaBrowser != null) {
mMediaList = new ArrayList<>();
if (mUri != null)
if (mUri != null) {
int flags = MediaBrowser.Flag.Interact;
if (mShowHiddenFiles)
flags |= MediaBrowser.Flag.ShowHiddenFiles;
mMediaBrowser.browse(mUri, MediaBrowser.Flag.Interact);
else
} else
mMediaBrowser.discoverNetworkShares();
((BrowserActivityInterface)mContext).showProgress(true);
}
......
......@@ -33,6 +33,7 @@ import android.os.Handler;
import android.os.HandlerThread;
import android.os.Process;
import android.support.annotation.NonNull;
import android.support.v7.preference.PreferenceManager;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.util.MediaBrowser;
......@@ -47,6 +48,7 @@ public abstract class MediaSortedFragment extends SortedBrowserFragment implemen
protected Uri mUri;
protected MediaBrowser mMediaBrowser;
boolean goBack = false;
private boolean mShowHiddenFiles = false;
private final Medialibrary mMedialibrary = VLCApplication.getMLInstance();
private static Handler sBrowserHandler;
......@@ -60,7 +62,7 @@ public abstract class MediaSortedFragment extends SortedBrowserFragment implemen
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null){
if (savedInstanceState != null) {
mUri = savedInstanceState.getParcelable(KEY_URI);
} else {
Intent intent = getActivity().getIntent();
......@@ -72,6 +74,7 @@ public abstract class MediaSortedFragment extends SortedBrowserFragment implemen
handlerThread.start();
sBrowserHandler = new Handler(handlerThread.getLooper());
}
mShowHiddenFiles = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("browser_show_hidden_files", false);
}
protected void browse() {
......@@ -80,8 +83,11 @@ public abstract class MediaSortedFragment extends SortedBrowserFragment implemen
public void run() {
mMediaBrowser = new MediaBrowser(VLCInstance.get(), MediaSortedFragment.this, sBrowserHandler);
if (mMediaBrowser != null) {
int flags = MediaBrowser.Flag.Interact;
if (mShowHiddenFiles)
flags |= MediaBrowser.Flag.ShowHiddenFiles;
if (mUri != null)
mMediaBrowser.browse(mUri, MediaBrowser.Flag.Interact);
mMediaBrowser.browse(mUri, flags);
else
browseRoot();
((BrowserActivityInterface)getActivity()).showProgress(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment