[Android] Revert "Disable medialibrary options during scan"

Geoffrey Métais git at videolan.org
Wed Oct 4 10:53:22 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct  4 10:25:22 2017 +0200| [1233e5b72c9fafbe33c051479151380f9ea29d17] | committer: Geoffrey Métais

Revert "Disable medialibrary options during scan"

This reverts commit 5b218c176f8edb425c2e157f8c8a570729e8b379.

> https://code.videolan.org/videolan/vlc-android/commit/1233e5b72c9fafbe33c051479151380f9ea29d17
---

 .../vlc/gui/browser/StorageBrowserAdapter.java     | 12 +---------
 .../vlc/gui/browser/StorageBrowserFragment.java    | 27 ++--------------------
 2 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
index a0fa160dc..517b19e8c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
@@ -41,20 +41,10 @@ class StorageBrowserAdapter extends BaseBrowserAdapter {
 
     private static ArrayList<String> mMediaDirsLocation;
     private static ArrayList<String> mCustomDirsLocation;
-    private boolean mParsing = false;
 
     StorageBrowserAdapter(BaseBrowserFragment fragment) {
         super(fragment);
         updateMediaDirs();
-        mParsing = VLCApplication.getMLInstance().isWorking();
-    }
-
-    // Deactivate checkboxes while ML is scanning to avoid ML undefined states
-    void setServiceActive(boolean started) {
-        if (started != mParsing) {
-            mParsing = started;
-            notifyDataSetChanged();
-        }
     }
 
     @Override
@@ -77,7 +67,7 @@ class StorageBrowserAdapter extends BaseBrowserAdapter {
             vh.binding.browserCheckbox.setState(ThreeStatesCheckbox.STATE_PARTIAL);
         else
             vh.binding.browserCheckbox.setState(ThreeStatesCheckbox.STATE_UNCHECKED);
-        vh.binding.setCheckEnabled(!mParsing && !((StorageBrowserFragment) fragment).mScannedDirectory);
+        vh.binding.setCheckEnabled(!((StorageBrowserFragment) fragment).mScannedDirectory);
         if (hasContextMenu)
             vh.setContextMenuListener();
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
index 25933d574..19817dbb0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.java
@@ -23,7 +23,6 @@
 
 package org.videolan.vlc.gui.browser;
 
-import android.content.IntentFilter;
 import android.databinding.DataBindingUtil;
 import android.net.Uri;
 import android.os.Bundle;
@@ -31,7 +30,6 @@ import android.support.annotation.Nullable;
 import android.support.design.widget.Snackbar;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
-import android.support.v4.content.LocalBroadcastManager;
 import android.support.v4.util.SimpleArrayMap;
 import android.text.TextUtils;
 import android.view.Menu;
@@ -44,7 +42,6 @@ import org.videolan.medialibrary.interfaces.EntryPointsEventsCb;
 import org.videolan.medialibrary.media.MediaLibraryItem;
 import org.videolan.medialibrary.media.MediaWrapper;
 import org.videolan.medialibrary.media.Storage;
-import org.videolan.vlc.MediaParsingService;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.databinding.BrowserItemBinding;
@@ -79,8 +76,9 @@ public class StorageBrowserFragment extends FileBrowserFragment implements Entry
         mAdapter = new StorageBrowserAdapter(this);
         if (bundle == null)
             bundle = getArguments();
-        if (bundle != null)
+        if (bundle != null){
             mScannedDirectory = bundle.getBoolean(KEY_IN_MEDIALIB);
+        }
     }
 
     @Override
@@ -104,15 +102,6 @@ public class StorageBrowserFragment extends FileBrowserFragment implements Entry
     }
 
     @Override
-    public void onResume() {
-        super.onResume();
-        final IntentFilter filter = new IntentFilter(MediaParsingService.ACTION_SERVICE_STARTED);
-        filter.addAction(MediaParsingService.ACTION_SERVICE_ENDED);
-        LocalBroadcastManager.getInstance(VLCApplication.getAppContext()).registerReceiver(mParsingServiceReceiver, filter);
-        ((StorageBrowserAdapter)mAdapter).setServiceActive(mMediaLibrary.isWorking());
-    }
-
-    @Override
     public void onStop() {
         super.onStop();
         if (mFabPlay != null) {
@@ -260,16 +249,4 @@ public class StorageBrowserFragment extends FileBrowserFragment implements Entry
             ((StorageBrowserAdapter)mAdapter).updateMediaDirs();
         }
     }
-
-    @Override
-    protected void onParsingServiceFinished() {
-        super.onParsingServiceFinished();
-        ((StorageBrowserAdapter)mAdapter).setServiceActive(false);
-    }
-
-    @Override
-    protected void onParsingServiceStarted() {
-        super.onParsingServiceStarted();
-        ((StorageBrowserAdapter)mAdapter).setServiceActive(true);
-    }
 }



More information about the Android mailing list