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