示例#1
0
 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());
   }
 }
示例#2
0
  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();
  }
示例#3
0
 public void fetchSongFromDb() {
   mSongInfos = SongDb.getTotalSongInfo(mContext);
   sort();
   initPlayList();
 }
示例#4
0
 public void saveSongToDb() {
   SongDb.saveSongInfos(mContext, mSongInfoList);
 }