コード例 #1
0
 @Override
 public void playMusic(Object data1, Object data2) {
   // LogUtil.logInfo(TAG, "playMusic:111111 ");
   String songUrl = ((List<Url>) data1).get(0).getFile_link();
   if (songUrl != null) {
     LogUtil.logInfo(TAG, "songUrl: " + songUrl);
     MusicSevice.MusicBinder.playMusic(songUrl);
     intent = new Intent(getActivity(), PlayActivity.class);
     startActivity(intent);
     getActivity().overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
   } else {
     ToastUtil.showToast(getActivity(), "喵~~无此歌曲,抱歉");
   }
 }
コード例 #2
0
  /**
   * 设置点击事件,显示相应数据的列表
   *
   * @param v
   */
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.ll_new_list:
        setIntentType(NEW);
        break;
      case R.id.ll_hot_list:
        setIntentType(HOT);
        break;
      case R.id.ll_billboard_list:
        setIntentType(BILLBOARD);
        break;
      case R.id.ll_ktv_list:
        setIntentType(KTV);
        break;
      case R.id.ibtn_local_music:
        if (MusicApplication.getContext().getPlayer().isPlaying()) {
          intentPlayActivity();
          return;
        } else {
          // ToastUtil(getActivity(), "当前没有播放歌曲");
          intentPlayActivity();
        }
        break;
      case R.id.ibtn_music_search:
        String songName = etSearch.getText().toString().trim();
        if (songName != null) {
          lvSearchMusic.setVisibility(View.VISIBLE);
          animation =
              new TranslateAnimation(
                  0,
                  0,
                  llNetFragment.getHeight(),
                  lvSearchMusic.getHeight() + llNetFragment.getHeight());
          animation.setDuration(300);
          animation.start();
          //                    LogUtil.logInfo(TAG, "songName: " + songName);
          presenterNet.loadSearchMusics(songName);
        } else if ("".equals(songName)) {
          ToastUtil.showToast(getContext(), "请输入想听的歌曲");
        }
        break;
    }
    // LogUtil.logInfo(TAG, "Fragment onClick: " + type);

  }