private void deleteCJXX(String CJID) {
    HashMap<String, String> hashMap = new HashMap<String, String>();
    hashMap.put("SJID", CJID);
    hashMap.put("v_flag", "A");
    String params = ConnectionHelper.setParams("APP.DeleteSJ", "0", hashMap);
    new HttpUtils()
        .send(
            HttpRequest.HttpMethod.POST,
            AppConfig.dataBaseUrl,
            ConnectionHelper.getParas(params),
            new RequestCallBack<String>() {
              @Override
              public void onSuccess(ResponseInfo<String> responseInfo) {
                String a = responseInfo.result;
                Result result = JSON.parseObject(responseInfo.result, Result.class);
                if (result.getResultCode() == 200 && result.getAffectedRows() > 0) // 连接数据库成功
                {
                  Toast.makeText(ShowEventContent.this, "删除成功", Toast.LENGTH_SHORT).show();
                  finish();
                } else {
                  Toast.makeText(ShowEventContent.this, "删除失败", Toast.LENGTH_SHORT).show();
                  return;
                }
              }

              @Override
              public void onFailure(HttpException error, String msg) {
                Toast.makeText(ShowEventContent.this, "删除失败", Toast.LENGTH_SHORT).show();
              }
            });
  }
  private void getVideo(String glid) {
    HashMap<String, String> hashMap = new HashMap<String, String>();
    hashMap.put("GLID", glid);
    hashMap.put("FJLX", "2");
    String params = ConnectionHelper.setParams("APP.SelectFJ_SCFJ", "0", hashMap);
    new HttpUtils()
        .send(
            HttpRequest.HttpMethod.POST,
            AppConfig.dataBaseUrl,
            ConnectionHelper.getParas(params),
            new RequestCallBack<String>() {
              @Override
              public void onSuccess(ResponseInfo<String> responseInfo) {
                String a = responseInfo.result;
                List<FJ_SCFJ> list_fj = null;
                Result result = JSON.parseObject(responseInfo.result, Result.class);
                if (result.getResultCode() == 200) // 连接数据库成功
                {
                  list_fj = JSON.parseArray(ResultDeal.getAllRow(result), FJ_SCFJ.class);
                  if (list_fj == null) {
                    list_fj = new ArrayList<FJ_SCFJ>();
                  }
                } else {
                  AppContext.makeToast(ShowEventContent.this, "error_connectDataBase");
                  return;
                }
                for (int i = 0; i < list_fj.size(); i++) {
                  ProgressBar progressBar =
                      new ProgressBar(
                          ShowEventContent.this, null, android.R.attr.progressBarStyleHorizontal);
                  LinearLayout.LayoutParams lp =
                      new LinearLayout.LayoutParams(400, LayoutParams.MATCH_PARENT, 0);
                  lp.setMargins(25, 4, 0, 4);
                  progressBar.setLayoutParams(lp);
                  ll_video.addView(progressBar);
                  downloadVideo(
                      list_fj.get(i).getFJID(),
                      AppConfig.url + list_fj.get(i).getFJLJ(),
                      AppConfig.DOWNLOADPATH_VIDEO + list_fj.get(i).getFJMC(),
                      progressBar);
                }
              }

              @Override
              public void onFailure(HttpException error, String msg) {
                Toast.makeText(ShowEventContent.this, "获取失败", Toast.LENGTH_SHORT).show();
              }
            });
  }
Esempio n. 3
0
  private void getListData() {
    HashMap<String, String> hashMap = new HashMap<String, String>();
    String params = ConnectionHelper.setParams("APP.getReNewInfo", "0", hashMap);
    new HttpUtils()
        .send(
            HttpRequest.HttpMethod.POST,
            AppConfig.dataBaseUrl,
            ConnectionHelper.getParas(params),
            new RequestCallBack<String>() {
              @Override
              public void onSuccess(ResponseInfo<String> responseInfo) {
                List<Apk> listNewData = null;
                Result result = JSON.parseObject(responseInfo.result, Result.class);
                if (result.getResultCode() == 200) // 连接数据库成功
                {
                  listNewData = JSON.parseArray(ResultDeal.getAllRow(result), Apk.class);
                  if (listNewData == null) {
                    listNewData = new ArrayList<Apk>();
                  } else {
                    Apk apk = listNewData.get(0);
                    PackageInfo packageInfo = null;
                    try {
                      packageInfo =
                          getActivity()
                              .getApplicationContext()
                              .getPackageManager()
                              .getPackageInfo(getActivity().getPackageName(), 0);
                    } catch (NameNotFoundException e) {
                      e.printStackTrace();
                    }
                    String localVersion = packageInfo.versionName;
                    if (localVersion.equals(apk.getVersion())) {
                    } else {
                      fl_new.setVisibility(View.VISIBLE);
                    }
                  }
                } else {
                  AppContext.makeToast(getActivity(), "error_connectDataBase");
                  return;
                }
              }

              @Override
              public void onFailure(HttpException error, String msg) {
                AppContext.makeToast(getActivity(), "error_connectServer");
              }
            });
  }
  private void setImage(String glid) {
    HashMap<String, String> hashMap = new HashMap<String, String>();
    hashMap.put("GLID", glid);
    hashMap.put("FJLX", "1");
    String params = ConnectionHelper.setParams("APP.SelectFJ_SCFJ", "0", hashMap);
    new HttpUtils()
        .send(
            HttpRequest.HttpMethod.POST,
            AppConfig.dataBaseUrl,
            ConnectionHelper.getParas(params),
            new RequestCallBack<String>() {
              @Override
              public void onSuccess(ResponseInfo<String> responseInfo) {

                Result result = JSON.parseObject(responseInfo.result, Result.class);
                if (result.getResultCode() == 200) // 连接数据库成功
                {
                  list_FJ_SCFJ = JSON.parseArray(ResultDeal.getAllRow(result), FJ_SCFJ.class);
                  if (list_FJ_SCFJ == null) {
                    list_FJ_SCFJ = new ArrayList<FJ_SCFJ>();
                  }
                  // for (int i = 0; i < list_FJ_SCFJ.size(); i++)
                  // {
                  // imgUrl.add(list_FJ_SCFJ.get(i).getFJLJ());
                  // }
                } else {
                  AppContext.makeToast(ShowEventContent.this, "error_connectDataBase");
                  return;
                }
                PictureScrollFragment pictureScrollFragment = new PictureScrollFragment();
                Bundle bundle = new Bundle();
                bundle.putParcelableArrayList(
                    "imgurl", (ArrayList<? extends Parcelable>) list_FJ_SCFJ);
                pictureScrollFragment.setArguments(bundle);
                getFragmentManager()
                    .beginTransaction()
                    .replace(R.id.img_container, pictureScrollFragment)
                    .commit();
              }

              @Override
              public void onFailure(HttpException error, String msg) {
                Toast.makeText(ShowEventContent.this, "获取失败", Toast.LENGTH_SHORT).show();
              }
            });
  }