コード例 #1
0
  private void goodMusicOrCancel() {
    progress.show();
    if (currMusicInfo != null && currMusicInfo.is_isCollected()) {
      mWifiCRUDForMusic.delete(
          currMusicInfo.getMusicId() + "",
          new ResultForMusicListener() {
            public void onResult(String errorCode, List<WifiMusicInfo> infos) {
              mHandler.post(dismissDialog);
              if (!WifiCRUDUtil.isSuccessAll(errorCode)) {
                ToastUtils.show(context, R.string.ba_config_box_info_error_toast);
              } else {
                runOnUiThread(
                    new Runnable() {
                      public void run() {
                        collectTime = System.currentTimeMillis();
                        goodMusicBtn.setImageResource(R.drawable.player_good_music_selector);
                      }
                    });
              }
            }
          });
    } else {
      mWifiCRUDForMusic.goodMusic(
          new ResultForMusicListener() {
            public void onResult(String errorCode, List<WifiMusicInfo> infos) {
              mHandler.post(dismissDialog);
              if (!WifiCRUDUtil.isSuccessAll(errorCode)) {
                ToastUtils.show(context, R.string.ba_config_box_info_error_toast);
              } else {
                runOnUiThread(
                    new Runnable() {

                      @Override
                      public void run() {
                        collectTime = System.currentTimeMillis();
                        goodMusicBtn.setImageResource(R.drawable.player_good_music_pressed);
                      }
                    });
              }
            }
          });
    }
  }
コード例 #2
0
 protected void updateView(WifiMusicInfo info) {
   currMusicInfo = info;
   if (System.currentTimeMillis() - collectTime > changeButtonStateDelayed) {
     if (currMusicInfo.is_isCollected()) {
       goodMusicBtn.setImageResource(R.drawable.player_good_music_pressed);
     } else {
       goodMusicBtn.setImageResource(R.drawable.player_good_music_selector);
     }
   }
   String currState = info.getPlayStatus();
   if (MUSIC_STATE_DLAN.equals(currState)) {
     isDlanPlay = true;
     music_player_dlan.setVisibility(View.VISIBLE);
     music_player_normal.setVisibility(View.GONE);
   } else {
     isDlanPlay = false;
     music_player_dlan.setVisibility(View.GONE);
     music_player_normal.setVisibility(View.VISIBLE);
     String currMusicName = info.getName() != null ? info.getName() : "";
     String currSinger = info.getAuthor() != null ? info.getAuthor() : "";
     int currVolume = info.getMusicCurrVolume() - 1;
     int maxVolume = info.getMusicMaxVolume() - 1;
     LogManager.e("volume :" + currVolume + "," + maxVolume);
     if (maxVolume != seekBar.getMax()) {
       seekBar.setMax(maxVolume);
     }
     if (System.currentTimeMillis() - volumeChangeTime > changeButtonStateDelayed) {
       if (currVolume != seekBar.getProgress()) {
         seekBar.setTag("unchange");
         seekBar.setProgress(currVolume);
       }
     }
     if (!isOperateButton) {
       if (MUSIC_STATE_STOP.equals(currState) || MUSIC_STATE_PAUSE.equals(currState)) {
         if (!"".equals(getPrefString(KeyList.PKEY_SELECT_MUSIC_ID))) {
           setPrefString(KeyList.PKEY_SELECT_MUSIC_ID, "");
         }
         playerRoundIv.pauseRound();
         playerOperate.release();
         playOrPause.setBackgroundResource(R.drawable.player_play_btn_selector);
       } else if (MUSIC_STATE_PLAYING.equals(currState)) {
         if (info.getMusicId() != null
             && !info.getMusicId().equals(getPrefString(KeyList.PKEY_SELECT_MUSIC_ID))) {
           setPrefString(KeyList.PKEY_SELECT_MUSIC_ID, info.getMusicId());
         }
         playerOperate.startRound();
         playerRoundIv.startRound();
         playOrPause.setBackgroundResource(R.drawable.player_pause_btn_selector);
       }
     }
     // }
     if (!currMusicName.equals(musicName)) {
       playerMainLayout.setBackgroundDrawable(getBgRandom(playerMainLayout));
       songTv.setText(currMusicName);
     }
     if (!currSinger.equals(singer)) {
       singerTv.setText(currSinger);
     }
     musicName = currMusicName;
     singer = currSinger;
   }
 }