Esempio n. 1
0
 // 设置是否歌曲收藏状态
 private void setFavoriteDefault() {
   if (helperFavorite.getMP3Info(fileInfos.get(listPosition))) {
     btn_love.setSelected(true);
   } else {
     btn_love.setSelected(false);
   }
 }
Esempio n. 2
0
 // 歌曲收藏与取消收藏
 private void songFavorite() {
   if (helperFavorite.getMP3Info(fileInfos.get(listPosition))) {
     helperFavorite.deleteMP3InfoDB(fileInfos.get(listPosition));
     for (int i = 0; i < fileInfos.size(); i++) {
       if (fileInfos.get(i).getTitle().equals(fileInfos.get(listPosition).getTitle())) {
         fileInfos.get(i).setFavorite(false);
       }
     }
     btn_love.setSelected(false);
     Toast.makeText(LocalActivity.this, "取消收藏", Toast.LENGTH_SHORT).show();
   } else {
     helperFavorite.addMP3InfoDB(fileInfos.get(listPosition));
     fileInfos.get(listPosition).setFavorite(true);
     btn_love.setSelected(true);
     Toast.makeText(LocalActivity.this, "收藏成功", Toast.LENGTH_SHORT).show();
   }
 }