Commit 8cef981e authored by Edward Wang's avatar Edward Wang Committed by Jean-Baptiste Kempf

Add debugging feature to clear database

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent f324baea
......@@ -66,6 +66,7 @@
<string name="enable_iomx">Enable hardware accelerated decoding</string>
<string name="advanced_debugging">Advanced Debugging</string>
<string name="quit">Quit Application</string>
<string name="clear_media_db">Clear media database</string>
<string name="detect_headset">Detect headset</string>
<string name="detect_headset_detail">Pause on headset removed, Resume on headset inserted</string>
<string name="refresh">Refresh</string>
......
......@@ -34,6 +34,7 @@
<PreferenceCategory android:title="@string/advanced_prefs_category">
<PreferenceScreen android:title="@string/advanced_debugging">
<Preference android:title="@string/quit" android:key="quit_app" android:enabled="true"/>
<Preference android:title="@string/clear_media_db" android:key="clear_media_db" android:enabled="true" />
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
......@@ -475,5 +475,11 @@ public class DatabaseManager {
public synchronized void clearSearchhistory() {
mDb.delete(SEARCHHISTORY_TABLE_NAME, null, null);
}
/**
* Empty the database for debugging purposes
*/
public synchronized void emptyDatabase() {
mDb.delete(MEDIA_TABLE_NAME, null, null);
}
}
......@@ -33,6 +33,7 @@ import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.widget.Toast;
public class PreferencesActivity extends PreferenceActivity {
......@@ -114,6 +115,16 @@ public class PreferencesActivity extends PreferenceActivity {
return true;
}
});
Preference clearMediaPref = (Preference)findPreference("clear_media_db");
clearMediaPref.setOnPreferenceClickListener(
new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
DatabaseManager.getInstance(getBaseContext()).emptyDatabase();
Toast.makeText(getBaseContext(), "Media database cleared!", Toast.LENGTH_SHORT);
return true;
}
});
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment