Commit e84b8ed1 authored by Geoffrey Métais's avatar Geoffrey Métais

Thread playlist saving in DB

parent 455a98c5
......@@ -114,16 +114,20 @@ public class SavePlaylist extends DialogFragment implements AdapterView.OnItemCl
}
private void savePlaylist() {
final MediaDatabase db = MediaDatabase.getInstance();
final String name = mEditText.getText().toString().trim();
if (db.playlistExists(name))
db.playlistDelete(name);
db.playlistAdd(name);
MediaWrapper mw;
for (int i = 0 ; i< mTracks.size() ; ++i){
mw = mTracks.get(i);
db.playlistInsertItem(name, i, mw.getLocation());
}
new Thread(new Runnable() {
public void run() {
final MediaDatabase db = MediaDatabase.getInstance();
final String name = mEditText.getText().toString().trim();
if (db.playlistExists(name))
db.playlistDelete(name);
db.playlistAdd(name);
MediaWrapper mw;
for (int i = 0 ; i< mTracks.size() ; ++i){
mw = mTracks.get(i);
db.playlistInsertItem(name, i, mw.getLocation());
}
}
}).start();
dismiss();
}
}
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