public void singlePlayList() { mPlayList.clear(); SongInfo song = getCurrentSong(); if (song == null) { LastSong lastSong = SongDb.getLastSong(mContext); if (lastSong != null) { mPlayList.add(lastSong.getId()); } } else { mPlayList.add(song.getId()); } }
public void deleteSong(int id) { SongDb.deleteSongById(mContext, id); SongInfo info = mSongInfos.get(id); if (info != null) { SongInfo currentSong = getCurrentSong(); if (currentSong != null && currentSong.getId() == info.getId()) { mContext.sendBroadcast(new Intent("stop")); } File file = new File(info.getPath()); if (file.exists()) file.delete(); } mSongInfos.delete(id); sort(); }
public void fetchSongFromDb() { mSongInfos = SongDb.getTotalSongInfo(mContext); sort(); initPlayList(); }
public void saveSongToDb() { SongDb.saveSongInfos(mContext, mSongInfoList); }