@Override public void doShare( Context context, HashMap<String, FetalMovement> params, ITaskCallback callBack) { FetalMovement fh = params.get(FetalMovement.class.getName()); String uid = fh.getMeasureUID(); FetalMovement tmp = getMeasureFetalMovement(uid); if (!NetUtil.isConnect(context)) { callBack.onComplete(LocalCode.CODE_18100, null); } else { if (tmp.getRecordID() == null) { callBack.onComplete(LocalCode.CODE_18101, null); mModule = CloudMeasureModuleCentreRoot.getInstance() .obtain(getAccountAttached(), MCloudDevice.FM); mModule.getCacheController().getNewItemsFromServer(null, null, new TaskHost() {}); accurateShare(context, tmp); } else { accurateShare(context, tmp); } } }
@Deprecated public void getNearlyRecord( Account account, final FetalMovement fetalMovement, final ITaskCallback callBack) { GetRecordTask task = new GetRecordTask( account.getAccessToken(), FetalMovement.TAG, "-" + TimeUtils.getYYYYMMDDHHMMSS(fetalMovement.getMeasureTime()), null, null, 3, null, "desc ", null); task.setTaskHost( new TaskHost() { @Override public void onPostExecute(int requestCode, BaseResult result) { super.onPostExecute(requestCode, result); if (callBack == null) return; switch (result.getErrorCode()) { case LocalCode.CODE_SUCCESS: NetworkClientResult temp = (NetworkClientResult) result; JSONObject json = temp.getResponseResult(); List<FetalMovement> list = null; try { JSONArray jsonArray = json.getJSONArray("down"); list = FetalMovement.createFetalMovementList( jsonArray, AccountProxy.getInstance().getCurrentAccount()); } catch (Exception e) { e.printStackTrace(); } callBack.onComplete(result.getErrorCode(), list); break; default: callBack.onComplete(result.getErrorCode(), null); break; } } }); task.execute(); }