private void searchNextPage() { isLoading = true; final FlightOrderListActivity actitivty = (FlightOrderListActivity) getActivity(); if (actitivty.request.pageIndex < actitivty.pageCount) { actitivty.request.pageIndex++; } else { isLoading = false; footerContent.setVisibility(View.GONE); mContentView.removeFooterView(footerView); return; } AsyncHttpClient client = AsyncHttpClient.getInstance(); client.excuteRequest( actitivty, actitivty.request, new ResponseHandler() { public void onSuccess() { GetFlightOrderListResponse reponse = (GetFlightOrderListResponse) BusinessCacheManager.getInstance() .getBeanByName(GetFlightOrderListResponse.class.getName()); for (FlightOrderModel model : reponse.flightOrders) { actitivty.adapter.add(model); } isLoading = false; footerContent.setVisibility(View.GONE); } public void onFailed(String error) { actitivty.request.pageIndex--; isLoading = false; footerContent.setVisibility(View.GONE); } public void onCanceled() {} }); }
private void getOrderList() { UserInfoResponse response = (UserInfoResponse) BusinessCacheManager.getInstance().getBeanByName(UserInfoResponse.class.getName()); request.uId = response.uid; request.corpId = response.corpID; request.pageIndex = 1; request.pageCount = 20; request.isNotTravel = false; AsyncHttpClient.getInstance() .excuteRequest( this, request, new ResponseHandler() { @Override public void onSuccess() { GetFlightOrderListResponse reponse = (GetFlightOrderListResponse) BusinessCacheManager.getInstance() .getBeanByName(GetFlightOrderListResponse.class.getName()); pageCount = reponse.pages; adapter.clear(); for (FlightOrderModel model : reponse.flightOrders) { adapter.add(model); } fragment.setContentShown(true); } @Override public void onFailed(String error) { fragment.setError( error, new Runnable() { @Override public void run() { getOrderList(); } }); } @Override public void onCanceled() {} }); }
public void cancelOrder(FlightOrderModel model) { showProgressDialog("取消订单中...", false); CancelFlightOrderRequest cancelRequest = new CancelFlightOrderRequest(this); cancelRequest.OTAOrderID = model.supOrderId; cancelRequest.selfOrderID = model.id; if ("TongCheng".equals(model.orderSource)) { cancelRequest.oTAType = 3; } else if ("YeeXing".equals(model.orderSource)) { cancelRequest.oTAType = 5; } else if ("Ealove".equals(model.orderSource)) { cancelRequest.oTAType = 4; } AsyncHttpClient.getInstance() .excuteRequest( this, cancelRequest, new ResponseHandler() { @Override public void onSuccess() { CancelFlightOrderResponse response = (CancelFlightOrderResponse) BusinessCacheManager.getInstance() .getBeanByName(CancelFlightOrderResponse.class.getName()); dismissProgressDialog(); if (response.isSuccess == 1) { Toast.makeText(FlightOrderListActivity.this, "取消订单成功", Toast.LENGTH_SHORT).show(); fragment.setContentShown(false); getOrderList(); } else { showErrorDialog("取消订单失败!"); } } @Override public void onFailed(String error) { dismissProgressDialog(); } @Override public void onCanceled() {} }); }