Esempio n. 1
0
  public static Group updateFromJSON(Group group, JSONObject json) {
    try {
      if (json.has("groupId")) {
        group = Group.fromJSON(json);
        assert (group != null);
      }
      group.owner = Contact.fromJSON(json.getJSONObject("owner"));
      List<Contact> list = Contact.getContactsFromJSON(json, "members");
      if (list != null && group.owner != null) {
        list.add(0, group.owner);
      }
      group.contactList = list;

    } catch (JSONException e) {
      Logger.e(TAG, e.getMessage());
    }
    return group;
  }
Esempio n. 2
0
 public static Group fromJSON(JSONObject json) {
   try {
     Group g = new Group();
     g.id = json.getInt("groupId");
     g.imId = json.getString("chatGroupId");
     g.name = json.getString("groupName");
     g.img = json.getString("logo");
     g.userNum = json.getInt("userNum");
     g.mFirstPinYin = "*";
     g.owner = null;
     g.contactList = null;
     g.apps = null;
     return g;
   } catch (Exception e) {
     if (Logger.DEBUG) {
       e.printStackTrace();
     }
   }
   return null;
 }