@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Activity activity = getActivity(); mContactsManager = ContactsManager.getInstance(activity); mContactsManager.registerListener(mContactListener); mLabelManager = UserLabelManager.getInstance(activity); loadContact(); mDetailHelper = new UserDetailHelper(activity, mHelperListener); if (mContact != null) { mDetailHelper.setDetail(new UserDetailHelper.Detail(mContact)); mLabelIdMap = buildLabelIdMap(mContact.getLabels()); } mMyLabelIdList = buildLabelIdList(mLabelManager.getAllLabels()); setHasOptionsMenu(true); final ActionBar actionBar = activity.getActionBar(); if (actionBar != null) { if (mContact != null) { actionBar.setTitle(mContact.getShowName()); } else { actionBar.setTitle(R.string.friend_detail); } } mContactQueried = false; mLabelPraiseLoaded = false; if (mContact != null) { queryContactInfo(); loadLabelPraise(); } }
private void loadLabelPraise() { mLabelManager.queryLabelPraise( mContact.getUserId(), new UserLabelManager.LabelPraiseQueryObserver() { @Override public void onQueryResult(int result, LabelPraise[] labelPraises) { Message msg = mHandler.obtainMessage(MSG_LOAD_LABEL_PRAISE_RESULT, result, 0, labelPraises); mHandler.sendMessage(msg); } }); }
private void recommendLabel(BaseLabel[] labels) { mProgressHelper.show(); mLabelManager.recommendLabel( mContact.getUserId(), labels, new FunctionCallListener() { @Override public void onCallResult(int result, int errorCode, String errorDesc) { mHandler.sendMessage( mHandler.obtainMessage(MSG_RECOMMEND_LABEL_RESULT, result, errorCode)); } }); }