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