@Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;

    ApiRequest other = (ApiRequest) obj;

    if (method == null) {
      if (other.method != null) return false;
    } else if (!method.equals(other.method)) {
      return false;
    }

    if (callArguments == null) {
      if (other.callArguments != null) return false;
    } else {
      JSONObject criteriaFilter = (JSONObject) this.getCallArgumentValue("criteria_filter");
      JSONObject criteriaSort = (JSONObject) this.getCallArgumentValue("criteria_filter");
      JSONObject output = (JSONObject) this.getCallArgumentValue("criteria_filter");

      JSONObject otherCriteriaFilter = (JSONObject) other.getCallArgumentValue("criteria_filter");
      JSONObject otherCriteriaSort = (JSONObject) other.getCallArgumentValue("criteria_filter");
      JSONObject otherOutput = (JSONObject) other.getCallArgumentValue("criteria_filter");

      if (!criteriaFilter.equals(otherCriteriaFilter)) return false;
      if (!criteriaSort.equals(otherCriteriaSort)) return false;
      if (!output.equals(otherOutput)) return false;
    }

    return true;
  }
Example #2
0
 /**
  * 在aftertimeline中被初始化,参数data为从服务器返回的result weibo字段包含当前用户最后一条微博。
  *
  * @param data
  * @throws DataInvalidException
  */
 public Follow(JSONObject data) throws DataInvalidException {
   if (data.equals("null")) throw new DataInvalidException();
   try {
     this.initUserInfo(data.getJSONObject("user"));
     if (data.has("id")) this.setFollowId(data.getInt("id"));
     if (data.has("weibo") && !data.getString("weibo").equals("")) {
       this.setLastWeibo(new Weibo(data.getJSONObject("weibo")));
     }
   } catch (JSONException e) {
     throw new UserDataInvalidException();
   }
 }
Example #3
0
 public static boolean hasSameId(JSONObject a, JSONObject b) {
   if (a == null || b == null || !a.has("id") || !b.has("id")) {
     return false;
   }
   if (a.equals(b)) {
     return true;
   }
   String idA = a.optString("id");
   String idB = b.optString("id");
   if (idA == null || idB == null) {
     return false;
   }
   return idA.equals(idB);
 }
Example #4
0
  /**
   * Updates the JavaScript side whenever the connection changes
   *
   * @param info the current active network info
   * @return
   */
  private void updateConnectionInfo(NetworkInfo info) {
    // send update to javascript "navigator.network.connection"
    // Jellybean sends its own info
    JSONObject thisInfo = this.getConnectionInfo(info);
    if (!thisInfo.equals(lastInfo)) {
      String connectionType = "";
      try {
        connectionType = thisInfo.get("type").toString();
      } catch (JSONException e) {
      }

      sendUpdate(connectionType);
      lastInfo = thisInfo;
    }
  }
Example #5
0
  private void getJsonSubmit(String data) {
    list.clear();
    try {
      JSONObject jsonObject = new JSONObject(data);
      int code = jsonObject.getInt("status");
      if (code == 1) {
        JSONObject o = jsonObject.getJSONObject("list");
        if (o.equals("") || o.equals(null) || o.equals("null") || o.length() < 1) {
          rl_gssat.setVisibility(View.VISIBLE);
          listview.setVisibility(View.GONE);
        } else {
          rl_gssat.setVisibility(View.GONE);
          listview.setVisibility(View.VISIBLE);

          JSONArray jo = o.getJSONArray("orderlist");
          for (int i = 0; i < jo.length(); i++) {
            JSONObject ob = jo.getJSONObject(i);
            AllOrderEntity ee = new AllOrderEntity();
            ee.setState(ob.getString("state"));
            ee.setId(ob.getString("id"));
            ee.setTotal_price(ob.getString("total_price"));
            ee.setPay_price(ob.getString("pay_price"));
            ee.setFlgs(false);
            JSONArray ja = ob.getJSONArray("_child");
            itemlist = new ArrayList<>();
            for (int j = 0; j < ja.length(); j++) {
              JSONObject jt = ja.getJSONObject(j);
              AllOrderEntity.ChildEntity ce = new AllOrderEntity.ChildEntity();
              ce.setOrderid(jt.getString("orderid"));
              ce.setTitle(jt.getString("title"));
              ce.setSpec_1(jt.getString("spec_1"));
              ce.setSpec_2(jt.getString("spec_2"));
              ce.setPrice(jt.getString("price"));
              ce.setNewprice(jt.getString("newprice"));
              ce.setNum(jt.getString("num"));
              ce.setPicurl(jt.getString("picurl"));
              itemlist.add(ce);
            }
            ee.set_child(itemlist);
            list.add(ee);
          }

          adapter = new AllOrderAdapter(Fragment_back_money.this, list);
          listview.setAdapter(adapter);
        }
      } else {

        T.ss(jsonObject.getString("info").toString());
        //                String longs=jsonObject.getString("info");
        //                if(longs.equals("请先登录")){
        //                    LSharePreference.getInstance(getActivity()).setBoolean("login",
        // false);
        //                    Intent intent = new Intent(getActivity(), LoginMain.class);
        //                    startActivity(intent);
        //                }
      }
    } catch (JSONException e) {
      e.printStackTrace();
      rl_gssat.setVisibility(View.VISIBLE);
      listview.setVisibility(View.GONE);
    }
  }