@Override public void showOtherPage(int group) { TaskDetail detail = mExpandListAdatpger.getTaskDetail(group); activityInterface.setOldTaskDetail(detail); activityInterface.showPage( Configs.VIEW_POSITION_MY_TASK, this, Configs.VIEW_POSITION_OLD_DETAIL, 0, null, null); }
@Override public boolean onChildClick( ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { TaskPoint taskPoint = mExpandListAdatpger.getTaskPoint(groupPosition, childPosition); activityInterface.setOldTaskPiint(taskPoint); activityInterface.showPage( Configs.VIEW_POSITION_MY_OLD, mTaskPage, Configs.VIEW_POSITION_OLD_ITEM_DETAIL, 0, null, null); return false; }
private void setUpload2() { if (chlid_list.size() == 0) { activityInterface.dismissNetDialog(); handler.sendEmptyMessage(null_null); return; } childPosition = chlid_list.get(0); handler.sendEmptyMessage(delete_next); }
public void handleMessage(android.os.Message msg) { switch (msg.what) { case delete_next: mExpandListAdatpger.notifyDataSetChanged(); if (chlid_list.size() > 0) chlid_list.remove(0); if (chlid_list.size() > 0) { delete(); setUpload2(); break; } else { if (list_group_position.size() > 0) list_group_position.remove(0); if (list_group_position.size() > 0) { delete(); setUpload(); break; } else { delete(); setTaskDetail(0, start + end); activityInterface.dismissNetDialog(); mExpandListAdatpger.notifyDataSetChanged(); mExpandListAdatpger.reStore(); break; } } // delete(); // setUpload2(); // break; case delete_false: setTaskDetail(0, start + end); mExpandListAdatpger.notifyDataSetChanged(); activityInterface.dismissNetDialog(); mExpandListAdatpger.reStore(); break; case wait_pr0bar: expandableListView.closeFooter(); break; case delete_null: activityInterface.dismissNetDialog(); if (mExpandListAdatpger.getDataSize() > 0) Toast.makeText(mContext, "请选择要删除的数据", 0).show(); else Toast.makeText(mContext, "您没有任何任务", 0).show(); break; case null_null: Toast.makeText(mContext, "请选择要删除的点", 0).show(); break; case fail: setTaskSize(0, 0, String.valueOf(0)); expandableListView.closeFooter(); activityInterface.dismissNetDialog(); String str = (String) msg.obj; activityInterface.ShowCodeDialog(Integer.valueOf(str), MTaskOldPage.this); break; case netWrong: setTaskSize(0, 0, String.valueOf(0)); expandableListView.closeFooter(); activityInterface.dismissNetDialog(); Toast.makeText(mContext, "获取内容失败", 0).show(); break; case TIMEOUT: setTaskSize(0, 0, String.valueOf(0)); expandableListView.closeFooter(); activityInterface.dismissNetDialog(); Toast.makeText(mContext, "网络不给力,请检查网络!", 0).show(); break; case success: expandableListView.closeFooter(); ArrayList<TaskDetail> waitTaskList = (ArrayList<TaskDetail>) msg.obj; for (int i = 0; i < waitTaskList.size(); i++) { TaskDetail cimmit = waitTaskList.get(i); arrayListOld.add(cimmit); } if (waitTaskList.size() > 0) { setTaskSize(waitTaskList.size(), 0, String.valueOf(0)); } activityInterface.dismissNetDialog(); // mExpandListAdatpger.setListTaskDetails(arrayListOld); mExpandListAdatpger.notifyDataSetChanged(); break; default: break; } };
/** * 网络获取已提交任务 * * @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("¤tTime=" + 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(); }