Skip to content
Snippets Groups Projects
Commit 4b002d89 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Disable medialibrary settings while it is scanning

parent 1233e5b7
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......@@ -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());
......
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment