コード例 #1
0
ファイル: NetMusicEntry.java プロジェクト: JcMan/DreamMusic
 public static void setNetHitoMusicList(ResponseInfo<String> info, List<NetMusicEntry> mList) {
   try {
     JSONObject object = new JSONObject(info.result);
     JSONArray array = object.getJSONArray(NetMusicEntry.SONG_LIST);
     for (int i = 0; i < array.length(); i++) {
       JSONObject obj = array.getJSONObject(i);
       NetMusicEntry entry = new NetMusicEntry();
       try {
         entry.setAuthor(obj.getString(NetMusicEntry.AUTHOR));
       } catch (Exception e) {
       }
       try {
         entry.setTitle(obj.getString(NetMusicEntry.TITLE));
       } catch (Exception e) {
       }
       try {
         entry.setSong_id(obj.getString(NetMusicEntry.SONG_ID));
       } catch (Exception e) {
       }
       try {
         entry.setPic_small(obj.getString(NetMusicEntry.PIC_SMALL));
       } catch (Exception e) {
       }
       mList.add(entry);
     }
   } catch (JSONException e) {
     e.printStackTrace();
   }
 }
コード例 #2
0
ファイル: NetMusicEntry.java プロジェクト: JcMan/DreamMusic
 public static void setNetChannelList(ResponseInfo<String> info, List<NetMusicEntry> mList) {
   try {
     JSONObject object = new JSONObject(info.result);
     JSONArray array1 = object.getJSONArray("result");
     JSONObject object1 = array1.getJSONObject(0);
     JSONArray array = object1.getJSONArray(NetMusicEntry.CHANNELLIST);
     for (int i = 0; i < array.length(); i++) {
       JSONObject obj = array.getJSONObject(i);
       NetMusicEntry entry = new NetMusicEntry();
       try {
         entry.setName(obj.getString(NetMusicEntry.NAME));
       } catch (Exception e) {
       }
       try {
         entry.setThumb(obj.getString(NetMusicEntry.THUMB));
       } catch (Exception e) {
       }
       try {
         entry.setCh_name(obj.getString(NetMusicEntry.CH_NAME));
       } catch (Exception e) {
       }
       mList.add(entry);
     }
   } catch (JSONException e) {
     e.printStackTrace();
   }
 }
コード例 #3
0
ファイル: NetMusicEntry.java プロジェクト: JcMan/DreamMusic
 public static void setNetSingerList(ResponseInfo<String> info, List<NetMusicEntry> mList) {
   try {
     JSONObject object = new JSONObject(info.result);
     JSONArray array = object.getJSONArray("artist");
     for (int i = 0; i < array.length(); i++) {
       JSONObject obj = array.getJSONObject(i);
       NetMusicEntry entry = new NetMusicEntry();
       try {
         entry.setName(obj.getString(NetMusicEntry.NAME));
       } catch (Exception e) {
       }
       try {
         entry.setTing_uid(obj.getString(NetMusicEntry.TING_UID));
       } catch (Exception e) {
       }
       try {
         entry.setAvatar_middle(obj.getString(NetMusicEntry.AVATAR_MIDDLE));
       } catch (Exception e) {
       }
       try {
         entry.setAvatar_big(obj.getString(NetMusicEntry.AVATAR_BIG));
       } catch (Exception e) {
       }
       mList.add(entry);
     }
   } catch (JSONException e) {
     e.printStackTrace();
   }
 }
コード例 #4
0
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    final NetMusicEntry entry = (NetMusicEntry) mHotMusicListView.getItemAtPosition(position);
    String songId = entry.getSong_id();
    loadingDialog.show();
    MyHttpUtil.getDefaultHttpUtil()
        .send(
            HttpRequest.HttpMethod.GET,
            NetAPIEntry.getUrlBySongId(songId),
            new RequestCallBack<String>() {

              @Override
              public void onSuccess(ResponseInfo<String> stringResponseInfo) {
                loadingDialog.cancel();
                entry.setFile_link(NetMusicEntry.getFileLink(stringResponseInfo.result));
                mPopupWindow =
                    PopupWindowUtil.createPopupWindow(
                        getActivity(), R.layout.layout_popupwindow_download);
                mPopupWindow.showAtLocation(
                    getActivity().getWindow().getDecorView(),
                    Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,
                    0,
                    0);
                initPopBtnViewAndListener(entry);
              }

              @Override
              public void onFailure(HttpException e, String s) {
                loadingDialog.cancel();
              }
            });
  }