// 数据模型转换 private void jsonToPersonData(JSONArray jPersonList) { List<FriendModel> list = new ArrayList<FriendModel>(); for (int index = 0; index < jPersonList.size(); index++) { JSONObject jsonObject = jPersonList.getJSONObject(index); FriendModel friend = new FriendModel(); friend.setUid(JLXCUtils.stringToInt(jsonObject.getString("uid"))); friend.setName(jsonObject.getString("name")); friend.setHead_image(jsonObject.getString("head_image")); friend.setHead_sub_image(jsonObject.getString("head_sub_image")); friend.setSchool(jsonObject.getString("school")); if ("0".equals(jsonObject.getString("isAttent"))) { friend.setOrHasAttent(false); } else { friend.setOrHasAttent(true); } list.add(friend); } if (isPullDown) { dataList = list; friendAdapter.replaceAll(dataList); } else { dataList.addAll(list); friendAdapter.replaceAll(dataList); } if (null != jPersonList) { jPersonList.clear(); } }
// 刷新页面 private void refreshList() { page = 1; List<NewsPushModel> pushModels = NewsPushModel.findWithPage(page, size); newsAdapter.replaceAll(pushModels); // 刷新顶部 refreshTopCover(); // 未读 int unreadNum = IMModel.unReadNewFriendsCount(); if (unreadNum > 0) { unreadTextView.setText("" + unreadNum); unreadTextView.setVisibility(View.VISIBLE); } else { unreadTextView.setText(""); unreadTextView.setVisibility(View.GONE); } }