[Android] Disable medialibrary settings while it is scanning
Geoffrey Métais
git at videolan.org
Wed Oct 4 10:53:25 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct 4 10:48:23 2017 +0200| [4b002d893ba221c4af02e6a2d284dc3bbb932f74] | committer: Geoffrey Métais
Disable medialibrary settings while it is scanning
> https://code.videolan.org/videolan/vlc-android/commit/4b002d893ba221c4af02e6a2d284dc3bbb932f74
---
vlc-android/res/values/strings.xml | 1 +
.../videolan/vlc/gui/preferences/PreferencesFragment.java | 13 +++++++++----
.../vlc/gui/tv/preferences/PreferencesFragment.java | 13 +++++++++----
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index da54ec469..e3311c99d 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -564,4 +564,5 @@
<string name="custom_set_restored">Custom equalizer-set restored.</string>
<string name="unsaved_set_deleted_message">Unsaved equalizer-set deleted.</string>
<string name="equalizer_new_preset_name">New</string>
+ <string name="settings_ml_block_scan">Medialibray is scanning your devices right now</string>
</resources>
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java
index 78da2d365..b8c8da98b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesFragment.java
@@ -33,6 +33,7 @@ import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.SecondaryActivity;
+import org.videolan.vlc.gui.helpers.UiTools;
public class PreferencesFragment extends BasePreferenceFragment {
@@ -70,10 +71,14 @@ public class PreferencesFragment extends BasePreferenceFragment {
public boolean onPreferenceTreeClick(Preference preference) {
switch (preference.getKey()){
case "directories":
- Intent intent = new Intent(VLCApplication.getAppContext(), SecondaryActivity.class);
- intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER);
- startActivity(intent);
- getActivity().setResult(PreferencesActivity.RESULT_RESTART);
+ if (VLCApplication.getMLInstance().isWorking())
+ UiTools.snacker(getView(), getString(R.string.settings_ml_block_scan));
+ else {
+ final Intent intent = new Intent(VLCApplication.getAppContext(), SecondaryActivity.class);
+ intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER);
+ startActivity(intent);
+ getActivity().setResult(PreferencesActivity.RESULT_RESTART);
+ }
return true;
case "ui_category":
loadFragment(new PreferencesUi());
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java
index ae343fccd..032525530 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesFragment.java
@@ -32,6 +32,7 @@ import android.support.v7.preference.Preference;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.SecondaryActivity;
+import org.videolan.vlc.gui.helpers.UiTools;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public class PreferencesFragment extends BasePreferenceFragment {
@@ -66,10 +67,14 @@ public class PreferencesFragment extends BasePreferenceFragment {
public boolean onPreferenceTreeClick(Preference preference) {
switch (preference.getKey()){
case "directories":
- Intent intent = new Intent(VLCApplication.getAppContext(), SecondaryActivity.class);
- intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER);
- startActivity(intent);
- getActivity().setResult(PreferencesActivity.RESULT_RESTART);
+ if (VLCApplication.getMLInstance().isWorking())
+ UiTools.snacker(getView(), getString(R.string.settings_ml_block_scan));
+ else {
+ final Intent intent = new Intent(VLCApplication.getAppContext(), SecondaryActivity.class);
+ intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER);
+ startActivity(intent);
+ getActivity().setResult(PreferencesActivity.RESULT_RESTART);
+ }
return true;
case "ui_category":
loadFragment(new PreferencesUi());
More information about the Android
mailing list