/**
   * 我的任务(已提交)
   *
   * @param context
   * @param view
   * @param aif
   */
  public MTaskOldPage(Context context, View view, ActivityInterface aif) {

    LogPrint.Print("MTaskOldPage==initView===" + this);
    mContext = context;
    activityInterface = aif;
    expandableListView = (MExpandListView) view.findViewById(R.id.my_task_list_old);
    mExpandListAdatpger = new MExpandListAdatpger(context, arrayListOld);
    mExpandListAdatpger.setOnCheckOPenGroupLisrener(this);
    mExpandListAdatpger.setPageListener(this);
    expandableListView.setAdapter(mExpandListAdatpger);
    expandableListView.setOnGroupClickListener(this);
    expandableListView.setOnChildClickListener(this);
    text = (TextView) view.findViewById(R.id.my_task_text);

    expandableListView.setRefreshListener(
        new RefreshList() {

          @Override
          public void onRefershList() {
            if (arrayListOld.size() >= 20) {

              getCimmitDataFromSerlver(true);
            }
          }
        });
  }
  @Override
  public void onLocationChanged(Location location) {
    super.onLocationChanged(location);
    LogPrint.Print("gps", "MTaskOldPage--onLocationChanged---location=" + location.getProvider());

    if (Configs.LOCATIONTYPE.equals(location.getProvider())) {

      CustomCameraActivity.mlocation = location;
    }
  }
  /**
   * 网络获取已提交任务
   *
   * @param bl false 是刷新 不删除集合
   */
  private void getCimmitDataFromSerlver(boolean bl) {
    activityInterface.showNetWaitDialog(mContext.getResources().getString(R.string.dialog_net));
    if (builder == null) builder = new StringBuilder();
    else builder.delete(0, builder.length());

    TaskDetail taskDe = null;

    if (!bl && arrayListOld.size() > 0) {
      arrayListOld.clear();
      mExpandListAdatpger.notifyDataSetChanged();
    }

    int satrt = arrayListOld.size();
    int end = 20;
    if (arrayListOld.size() > 0) {
      taskDe = arrayListOld.get(arrayListOld.size() - 1);
    }

    builder.append(UrlConfig.getMyTaskCimmit);
    builder.append("token=" + StringUtils.getLoginToken(mContext));
    builder.append("&loginId=" + StringUtils.getLoginId(mContext));
    builder.append("&start=" + satrt);
    builder.append("&max=" + end);

    if (taskDe != null) {
      builder.append("&currentTime=" + taskDe.getCurrentTime());
    }
    LogPrint.Print("getMyTaskCimmit===" + builder.toString());
    httpHandler = new MHttpHandler(mContext);
    httpHandler.setCache(CacheType.NOCACHE);
    httpHandler.setRequest(builder.toString(), HttpRequestType.GET);
    httpHandler.setHttpHandlerListener(
        new HttpHandlerListener() {

          @SuppressWarnings("unused")
          @Override
          public void onResponse(int arg0, String arg1, byte[] data) {
            if (data != null) {
              try {
                String jsonStr = new String(data, "UTF-8");
                JSONObject jsonObject = new JSONObject(jsonStr);

                boolean b = jsonObject.getBoolean("result");
                if (b) {
                  String messageString = jsonObject.getString("message");
                  if (!StringUtils.isNullColums(messageString)) {

                    ArrayList<TaskDetail> waitTaskList = new ArrayList<TaskDetail>();
                    JSONObject dataJson = (JSONObject) jsonObject.get("data");
                    JSONArray jsonRowsArray = (JSONArray) dataJson.get("rows");
                    if (jsonRowsArray.length() > 0) {

                      String curTime = "0";
                      if (jsonObject.getString("id") != null
                          && !jsonObject.getString("id").equals("")) {

                        curTime = jsonObject.getString("id");
                      }
                      TaskDetail task;
                      List<TaskPoint> list;
                      TaskPoint taskPoint;
                      for (int i = 0; i < jsonRowsArray.length(); i++) {
                        task = new TaskDetail();
                        list = new ArrayList<TaskPoint>();
                        // JSONObject json = dataJson.getJSONObject(i);
                        JSONObject jsonTask = jsonRowsArray.getJSONObject(i);
                        task.setStartTime(
                            StringUtils.isNullColums(jsonTask.getString("createTime"))
                                ? ""
                                : jsonTask.getString("createTime"));
                        task.setLostTime(
                            StringUtils.isNullColums(jsonTask.getString("exceedTime"))
                                ? ""
                                : jsonTask.getString("exceedTime"));
                        task.setType(jsonTask.getInt("taskType") + "");
                        task.setCloseTime(
                            StringUtils.isNullColums(jsonTask.getString("clostTime"))
                                ? ""
                                : jsonTask.getString("clostTime"));
                        task.setDescription(
                            StringUtils.isNullColums(jsonTask.getString("description"))
                                ? ""
                                : jsonTask.getString("description"));
                        task.setExecutorTime(
                            StringUtils.isNullColums(jsonTask.getString("executorTime"))
                                ? ""
                                : jsonTask.getString("executorTime"));
                        task.setId(jsonTask.getString("id"));
                        task.setUpdateTime(
                            StringUtils.isNullColums(jsonTask.getString("lastUpdateTime"))
                                ? ""
                                : jsonTask.getString("lastUpdateTime"));
                        task.setName(jsonTask.getString("name"));
                        if (jsonTask.getInt("taskType") == 2) {

                          task.setRice(0.5);
                        } else {

                          task.setRice(
                              StringUtils.isNullColums(jsonTask.getDouble("price") + "")
                                  ? Double.parseDouble("0.0")
                                  : jsonTask.getDouble("price"));
                        }
                        // task.setRice(StringUtils.isNullColums(jsonTask.getDouble("price")+"") ?
                        // Double.parseDouble("0.0"):jsonTask.getDouble("price"));
                        task.setRoadcameraCount(jsonTask.getInt("roadcameraCount"));
                        // task.setVerifyInfo(jsonTask.getString("verifyInfo"));
                        task.setCurrentTime(curTime);
                        // 2014-11-7添加任务状态
                        // task.setStatus(jsonTask.getString("status"));
                        JSONArray jsonArray =
                            jsonRowsArray.getJSONObject(i).getJSONArray("roadcameraInfo");
                        for (int j = 0; j < jsonArray.length(); j++) {
                          taskPoint = new TaskPoint();
                          JSONObject object = jsonArray.getJSONObject(j);
                          // taskPoint.setAngle(StringUtils.isNullColums(object.getString("angle"))?"":object.getString("angle"));
                          taskPoint.setContent(object.getString("description"));
                          taskPoint.setOri(object.getString("direction"));
                          taskPoint.setCameraId(object.getString("id"));
                          // taskPoint.setLastTime(StringUtils.isNullColums(object.getString("lastTime"))?"":object.getString("lastTime"));
                          taskPoint.setLat(object.getDouble("latitude") + "");
                          taskPoint.setLon(object.getDouble("longitude") + "");

                          // 电子眼名称
                          taskPoint.setName(
                              StringUtils.isNullColums(object.getString("name"))
                                  ? ""
                                  : object.getString("name"));
                          // 电子眼图片名称
                          taskPoint.setIname(
                              StringUtils.isNullColums(object.getString("iname"))
                                  ? ""
                                  : object.getString("iname"));
                          // 电子眼单号
                          taskPoint.setOrder(
                              StringUtils.isNullColums(object.getString("order"))
                                  ? ""
                                  : object.getString("order"));

                          // taskPoint.setOrder(object.getString("odd"));
                          taskPoint.setPhotoUrl(object.getString("photoUrl"));
                          // taskPoint.setRefectReason(object.getString("refectReason"));
                          taskPoint.setLspeed(object.getString("speed"));
                          taskPoint.setStatus(object.getString("status"));
                          taskPoint.setCameraTypeText(object.getString("type"));
                          taskPoint.setTid(task.getId());
                          list.add(taskPoint);
                        }
                        task.setList(list);
                        waitTaskList.add(task);
                      }
                      Message message = handler.obtainMessage();
                      message.what = success;
                      message.obj = waitTaskList;
                      handler.sendMessage(message);
                    } else {

                      Message message = handler.obtainMessage();
                      message.what = fail;
                      message.obj = jsonObject.getString("message");
                      handler.sendMessage(message);
                    }
                  }

                } else {
                  Message message = handler.obtainMessage();
                  message.what = fail;
                  message.obj = jsonObject.getString("message");
                  handler.sendMessage(message);
                }

              } catch (Exception e) {
                handler.sendEmptyMessage(netWrong);
                e.printStackTrace();
              }

            } else {
              if (arg0 != 200) handler.sendEmptyMessage(netWrong);
              else handler.sendEmptyMessage(TIMEOUT);
            }
          }
        });
    httpHandler.execute();
  }