[Android] Code factorization for fast browsing
Geoffrey Métais
git at videolan.org
Wed Feb 22 15:25:13 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 22 15:24:29 2017 +0100| [e7d9c09895dbcb98dd42b15931495a56065a36f2] | committer: Geoffrey Métais
Code factorization for fast browsing
> https://code.videolan.org/videolan/vlc-android/commit/e7d9c09895dbcb98dd42b15931495a56065a36f2
---
.../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java | 7 +++----
.../src/org/videolan/vlc/gui/browser/FileBrowserFragment.java | 9 ---------
.../src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java | 7 +------
3 files changed, 4 insertions(+), 19 deletions(-)
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 56b4338..514a281 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -157,10 +157,9 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- if (!mAdapter.isEmpty()) {
- mAdapter.notifyItemRangeInserted(0, mAdapter.getItemCount());
- onUpdateFinished(mAdapter);
- } else if (!(this instanceof NetworkBrowserFragment) && !(this instanceof FileBrowserFragment))
+ if (mediaList != null && !mediaList.isEmpty())
+ mAdapter.addAll(mediaList);
+ else if (!(this instanceof NetworkBrowserFragment))
refresh();
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
index 4d735d1..25d99ca 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
@@ -66,15 +66,6 @@ public class FileBrowserFragment<T extends BaseBrowserAdapter> extends BaseBrows
}
@Override
- public void onStart() {
- super.onStart();
- if (mediaList != null) {
- mAdapter.addAll(mediaList);
- } else
- refresh();
- }
-
- @Override
protected Fragment createFragment() {
return new FileBrowserFragment();
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
index 59f23d6..91699df 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
@@ -68,13 +68,8 @@ public class NetworkBrowserFragment extends BaseBrowserFragment {
//Handle network connection state
IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
- if (mediaList != null) {
- mSkipRefresh = !mediaList.isEmpty();
- mAdapter.addAll(mediaList);
- }
+ mSkipRefresh = mediaList != null && !mediaList.isEmpty();
getActivity().registerReceiver(networkReceiver, filter);
- if (mSkipRefresh)
- parseSubDirectories();
if (mRoot) {
mFabPlay.setImageResource(R.drawable.ic_fab_add);
mFabPlay.setOnClickListener(this);
More information about the Android
mailing list