Java Code Examples for com.android.volley.Response.Listener#onResponse()
The following examples show how to use
com.android.volley.Response.Listener#onResponse() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrderService.java From tgen with Apache License 2.0 | 6 votes |
public static RpcRequest UserAddToCartByOrderId(final int orderId, final Listener<Void> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Order/UserAddToCartByOrderId", new Response.Listener<String>() { @Override public void onResponse(String response) {if (listener != null) { listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { HashMap<String, Object> msg = new HashMap<String, Object>(); msg.put("orderId", orderId); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 2
Source File: ShipfForMeService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest UserGetShipForMeHomeSummary(final Listener<TShipForMeOrderHomeSummary> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "ShipfForMe/UserGetShipForMeHomeSummary", new Response.Listener<String>() { @Override public void onResponse(String response) { try { TShipForMeOrderHomeSummary result; result = BaseModule.doFromJSON(response, TShipForMeOrderHomeSummary.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { return "".getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 3
Source File: OrderService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest UserChangeEZShipping(final boolean ezShipping, final Listener<TEzShipping> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { TEzShipping result; result = BaseModule.fromJSON(response, TEzShipping.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(ezShipping); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Order.UserChangeEZShipping"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 4
Source File: ShipfForMeService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest UserSendToTelephone(final String phoneNumber, final Listener<Boolean> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { Boolean result; result = BaseModule.fromJSON(response, Boolean.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(phoneNumber); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "ShipfForMe.UserSendToTelephone"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 5
Source File: OrderService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest UserGetEZShippingStatus(final Listener<TEzShipping> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Order/UserGetEZShippingStatus", new Response.Listener<String>() { @Override public void onResponse(String response) { try { TEzShipping result; result = BaseModule.doFromJSON(response, TEzShipping.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { return "".getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 6
Source File: OrderService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest CancelOrder(final int orderId, final Listener<Void> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) {if (listener != null) { listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(orderId); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Order.CancelOrder"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 7
Source File: PaymentService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest GetTopUpDescription(final Listener<ArrayList<String>> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Payment/GetTopUpDescription", new Response.Listener<String>() { @Override public void onResponse(String response) { try { ArrayList<String> result; result = BaseModule.doFromJSONArray(response, String.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { return "".getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 8
Source File: ShipfForMeService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest UserUpdateShipForMeOrder(final int orderId, final String warehouseCode, final String shipperName, final String wayBill, final String alternative, final boolean takePhoto, final String repack, final Listener<Void> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "ShipfForMe/UserUpdateShipForMeOrder", new Response.Listener<String>() { @Override public void onResponse(String response) {if (listener != null) { listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { HashMap<String, Object> msg = new HashMap<String, Object>(); msg.put("orderId", orderId); msg.put("warehouseCode", warehouseCode); msg.put("shipperName", shipperName); msg.put("wayBill", wayBill); msg.put("alternative", alternative); msg.put("takePhoto", takePhoto); msg.put("repack", repack); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 9
Source File: PaymentService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest UserPayParcelPayment(final ArrayList<Integer> paymentBillIds, final Listener<TPayParcelPaymentResult> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { TPayParcelPaymentResult result; result = BaseModule.fromJSON(response, TPayParcelPaymentResult.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(paymentBillIds); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Payment.UserPayParcelPayment"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 10
Source File: PaymentService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest GetPaymentListByStatus(final String status, final int offset, final int limit, final Listener<ArrayList<TPaymentBillSummary>> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Payment/GetPaymentListByStatus", new Response.Listener<String>() { @Override public void onResponse(String response) { try { ArrayList<TPaymentBillSummary> result; result = BaseModule.doFromJSONArray(response, TPaymentBillSummary.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { HashMap<String, Object> msg = new HashMap<String, Object>(); msg.put("status", status); msg.put("offset", offset); msg.put("limit", limit); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 11
Source File: PaymentService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest GetWithdrawBanks(final Listener<ArrayList<String>> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { ArrayList<String> result; result = BaseModule.fromJSONArray(response, String.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Payment.GetWithdrawBanks"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 12
Source File: PackageService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest GetAcknowledgePackages(final Listener<ArrayList<TPackage>> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Package/GetAcknowledgePackages", new Response.Listener<String>() { @Override public void onResponse(String response) { try { ArrayList<TPackage> result; result = BaseModule.doFromJSONArray(response, TPackage.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { return "".getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 13
Source File: PaymentService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest GetPrepayBalance(final Listener<Double> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { Double result; result = BaseModule.fromJSON(response, Double.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Payment.GetPrepayBalance"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 14
Source File: PaymentService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest ConfirmPayments(final ArrayList<Integer> paymentIds, final Listener<Double> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Payment/ConfirmPayments", new Response.Listener<String>() { @Override public void onResponse(String response) { try { Double result; result = BaseModule.doFromJSON(response, Double.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { HashMap<String, Object> msg = new HashMap<String, Object>(); msg.put("paymentIds", paymentIds); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 15
Source File: OrderService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest ReplyOrderRemark(final int orderId, final int orderRemarkParentId, final String remark, final String pictures, final Listener<Void> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Order/ReplyOrderRemark", new Response.Listener<String>() { @Override public void onResponse(String response) {if (listener != null) { listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { HashMap<String, Object> msg = new HashMap<String, Object>(); msg.put("orderId", orderId); msg.put("orderRemarkParentId", orderRemarkParentId); msg.put("remark", remark); msg.put("pictures", pictures); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 16
Source File: PackageService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest GetProductsByPackageId(final int packageId, final Listener<ArrayList<TProductComment>> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getWebApiUrl() + "Package/GetProductsByPackageId", new Response.Listener<String>() { @Override public void onResponse(String response) { try { ArrayList<TProductComment> result; result = BaseModule.doFromJSONArray(response, TProductComment.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { HashMap<String, Object> msg = new HashMap<String, Object>(); msg.put("packageId", packageId); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 17
Source File: PackageService.java From tgen with Apache License 2.0 | 5 votes |
public static RpcRequest CommentAgentProducts(final TProductComment productComment, final Listener<Integer> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { Integer result; result = BaseModule.fromJSON(response, Integer.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(productComment); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Package.CommentAgentProducts"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 18
Source File: PaymentService.java From tgen with Apache License 2.0 | 4 votes |
public static RpcRequest AddWithdrawReqeust(final String bankName, final String account, final double amount, final String reason, final Listener<String> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { String result; result = BaseModule.fromJSON(response, String.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(bankName); params.add(account); params.add(amount); params.add(reason); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Payment.AddWithdrawReqeust"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 19
Source File: PaymentService.java From tgen with Apache License 2.0 | 4 votes |
public static RpcRequest TopUp(final String transactionNumber, final String bankName, final String telephone, final double amount, final String paymentMethod, final ArrayList<Integer> paymentIds, final String payDate, final Listener<String> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { String result; result = BaseModule.fromJSON(response, String.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(transactionNumber); params.add(bankName); params.add(telephone); params.add(amount); params.add(paymentMethod); params.add(paymentIds); params.add(payDate); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "Payment.TopUp"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }
Example 20
Source File: ShipfForMeService.java From tgen with Apache License 2.0 | 4 votes |
public static RpcRequest UserGetShipForMeOrderFeeByOrderIds(final ArrayList<String> orderIds, final boolean insured, final String deliveryMethod, final String shipmentTypeCode, final int customerAddressId, final String originCode, final String warehouseCode, final String couponCode, final Listener<TShipformeOrderBill> listener) { RpcRequest req = new RpcRequest(Request.Method.POST, TRpc.getJsonRpcUrl(), new Response.Listener<String>() { @Override public void onResponse(String response) { try { TShipformeOrderBill result; result = BaseModule.fromJSON(response, TShipformeOrderBill.class); listener.onResponse(result); } catch (Exception ex) { // Log.d("ex", ex.toString()); // Log.d("jsonObject", response); listener.onResponse(null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onResponse(null); } }) { @Override public byte[] getBody() { final ArrayList<Object> params = new ArrayList<>(); params.add(orderIds); params.add(insured); params.add(deliveryMethod); params.add(shipmentTypeCode); params.add(customerAddressId); params.add(originCode); params.add(warehouseCode); params.add(couponCode); HashMap<String, Object> msg = new HashMap<>(); msg.put("id", getMsgID()); msg.put("method", "ShipfForMe.UserGetShipForMeOrderFeeByOrderIds"); msg.put("params", params); return gson.toJson(msg).getBytes(Charset.forName("UTF-8")); } }; TRpc.getQueue().add(req); return req; }