Skip to content
Snippets Groups Projects
Commit 7d91be5b authored by Alexandre Perraud's avatar Alexandre Perraud
Browse files

Clear data app directly from Android app info view

parent 22d15b9c
Branches dev-bugC
No related tags found
No related merge requests found
......@@ -357,6 +357,7 @@
<string name="auto_rescan">Auto rescan</string>
<string name="auto_rescan_summary">Automatically scan device for new or deleted media at application startup</string>
<string name="clear_media_db">Clear media database</string>
<string name="clear_media_db_summary">Access Android VLC info to clear data</string>
<string name="clear_history">Clear search history</string>
<string name="media_db_cleared">Media database cleared!</string>
<string name="set_locale">Set locale</string>
......
......@@ -19,6 +19,7 @@
<Preference
android:enabled="true"
android:key="clear_media_db"
android:summary="@string/clear_media_db_summary"
android:title="@string/clear_media_db" />
<PreferenceScreen
......
......@@ -28,6 +28,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.EditTextPreference;
......@@ -36,12 +37,9 @@ import android.text.TextUtils;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.MediaParsingService;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.DebugLogActivity;
import org.videolan.vlc.gui.helpers.AudioUtil;
import org.videolan.vlc.gui.helpers.BitmapCache;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.util.VLCInstance;
......@@ -106,10 +104,10 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
.setNegativeButton(android.R.string.cancel, null).show();
return true;
case "clear_media_db":
getActivity().startService(new Intent(MediaParsingService.ACTION_RELOAD, null, getActivity(), MediaParsingService.class));
BitmapCache.getInstance().clear();
AudioUtil.clearCacheFolders();
UiTools.snacker(getView(), R.string.media_db_cleared);
Intent i = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
i.addCategory(Intent.CATEGORY_DEFAULT);
i.setData(Uri.parse("package:" + VLCApplication.getAppContext().getPackageName()));
startActivity(i);
return true;
case "quit_app":
android.os.Process.killProcess(android.os.Process.myPid());
......
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