Option to rename playlists

This commit is contained in:
Karim Abou Zeid 2015-03-19 16:06:26 +01:00
commit 90cc5eb4e3
21 changed files with 165 additions and 68 deletions

View file

@ -165,6 +165,16 @@ public class PlaylistsUtil {
playlistId, from, to);
}
public static void renamePlaylist(final Context context, final int id, final String newName) {
ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.Audio.PlaylistsColumns.NAME, newName);
context.getContentResolver().update(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
contentValues,
MediaStore.Audio.Playlists._ID + "=?",
new String[]{ String.valueOf(id) });
App.bus.post(new DataBaseChangedEvent(DataBaseChangedEvent.PLAYLISTS_CHANGED));
}
public static String getNameForPlaylist(final Context context, final int id) {
Cursor cursor = context.getContentResolver().query(
MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,