コード例 #1
0
  void requestPushMsg(int pos, String type, String msg) {

    DeviceEntity e = (DeviceEntity) mDataList.get(pos);

    NetAPI.pushMessage(
        e.getDevid(),
        type,
        msg,
        mAppTypeEnt.getAppid(),
        mAppTypeEnt.getAppkey(),
        new Response.Listener() {
          @Override
          public void onResponse(Object response) {
            ResultResponse res = (ResultResponse) response;

            ToastUtil.showShortToast(getApplicationContext(), "" + res.getMsg());
          }
        },
        new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
            ToastUtil.showShortToast(mContext, "error");
          }
        });
  }
コード例 #2
0
  private void requestRefresh(final int pos) {

    DeviceEntity e = (DeviceEntity) mDataList.get(pos);

    showProgressDialog(null, "Loading..");

    NetAPI.refreshDevice(
        e.getDevid(),
        mAppTypeEnt.getAppid(),
        mAppTypeEnt.getAppkey(),
        new Response.Listener() {
          @Override
          public void onResponse(Object response) {
            ResultResponse res = (ResultResponse) response;
            if (res != null) {
              ToastUtil.showShortToast(mContext, res.getStatus());

              if (res.getStatus().equals(Constant.ONLINE_DEVICE)) {

              } else {
                mDataList.remove(pos);
                mAdapter.notifyItemRemoved(pos);
              }
            }
            cancelProgressDialog();
          }
        },
        new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
            ToastUtil.showShortToast(mContext, "error");

            cancelProgressDialog();
          }
        });
  }