예제 #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);
 }