Exemplo n.º 1
0
  private void deleteVideoData(String resumeid, final int position, String musicid) {
    HttpUtils httpUtils = new HttpUtils();
    RequestParams requestParams = new RequestParams();
    requestParams.addBodyParameter("resumeid", resumeid);
    requestParams.addBodyParameter("musicid", musicid);
    httpUtils.send(
        HttpRequest.HttpMethod.POST,
        AppUtilsUrl.getDeleteMusic(),
        requestParams,
        new RequestCallBack<String>() {
          @Override
          public void onSuccess(ResponseInfo<String> responseInfo) {
            if (!TextUtils.isEmpty(responseInfo.result)) {
              MyAppliction.showToast("删除成功");
              data.remove(position);
              notifyDataSetChanged();
            }
          }

          @Override
          public void onFailure(HttpException e, String s) {
            MyAppliction.showToast("网络出错了,删除失败...");
          }
        });
  }
  private void intiData(int offset) {
    SQLhelper sqLhelper = new SQLhelper(getActivity());
    SQLiteDatabase db = sqLhelper.getWritableDatabase();
    Cursor cursor = db.query("user", null, null, null, null, null, null);
    String uid = null;
    while (cursor.moveToNext()) {
      uid = cursor.getString(0);
    }

    httpUtils.send(
        HttpRequest.HttpMethod.GET,
        AppUtilsUrl.getMerchantInvite(uid, "accept", offset),
        new RequestCallBack<String>() {
          @Override
          public void onSuccess(ResponseInfo<String> responseInfo) {
            String result = responseInfo.result;
            // Log.e("inviteintiData", result);
            if (!TextUtils.isEmpty(result)) {

              HttpHelper.baseToUrl(
                  result,
                  new TypeReference<ArtistParme<MerchantInviteValueBean>>() {},
                  merchantInviteValueBeans,
                  inviteMessagelistAdapter);
              if (merchantInviteValueBeans.size() == 0) {
                accpetLayout.setVisibility(View.VISIBLE);
                merchantInviteMessageLv.setVisibility(View.GONE);
                yichanText.setVisibility(View.GONE);
              } else {
                yichanText.setVisibility(View.GONE);
                accpetLayout.setVisibility(View.GONE);
                merchantInviteMessageLv.setVisibility(View.VISIBLE);
              }
              merchantInviteMessageLv.onRefreshComplete();
            }
          }

          @Override
          public void onFailure(HttpException e, String s) {
            accpetLayout.setVisibility(View.GONE);
            merchantInviteMessageLv.setVisibility(View.VISIBLE);
            yichanText.setVisibility(View.VISIBLE);
            showAnim();
            merchantInviteMessageLv.onRefreshComplete();
            Log.e("onFailure", s);
          }
        });
  }