private Map<String, UserLabel> buildLabelIdMap(UserLabel[] labels) { Map<String, UserLabel> labelMap = new HashMap<String, UserLabel>(); if (labels != null && labels.length > 0) { for (UserLabel label : labels) { labelMap.put(label.getId(), label); } } return labelMap; }
private List<String> buildLabelIdList(UserLabel[] labels) { List<String> idList = new ArrayList<String>(); if (labels != null && labels.length > 0) { for (UserLabel label : labels) { idList.add(label.getId()); } } return idList; }
private void updateContactLabelPraise() { if (!mContactQueried || !mLabelPraiseLoaded) { return; } if (mLabelPraises != null && mLabelPraises.length > 0) { final String userId = mContact.getUserId(); for (LabelPraise labelPraise : mLabelPraises) { UserLabel userLabel = mLabelIdMap.get(labelPraise.getLabelId()); if (userLabel != null && userId.equals(labelPraise.getUserId())) { userLabel.setPraiseCount(labelPraise.getPraiseCount()); } } } // update list view and contact mDetailHelper.setDetail(new UserDetailHelper.Detail(mContact)); mDetailHelper.bindInfo(); mDetailHelper.bindLabels(); mContactsManager.updateContact(mContact); }
@Override public void onLabelLongClick(UserLabel label) { if (!(mMyLabelIdList.contains(label.getId()))) { UILauncher.launchLabelOptionUI(getFragmentManager(), label.toBaseLabel()); } }