コード例 #1
0
  public void buildGroupMembers(short[] contactId, boolean isAlive) {
    memberList.clear();

    if (isAlive) {
      NmsContact selfPerson = new NmsContact();
      selfPerson.setName(
          this.getResources().getText(R.string.STR_NMS_GROUP_MEMEBER_YOU).toString());
      selfPerson.setId(
          NmsContactApi.getInstance(mContext)
              .getMyselfEngineContactIdViaSimId(
                  (int) NmsPlatformAdapter.getInstance(mContext).getCurrentSimId()));

      memberList.add(selfPerson);
    }

    if (contactId != null) {
      for (short id : contactId) {
        NmsContact contact = NmsIpMessageApiNative.nmsGetContactInfoViaEngineId(id);
        if (contact != null) {
          memberList.add(contact);
        } else {
          NmsLog.error(Tag, "can't get contact info. engineContactId:" + id);
        }
      }
    }
  }
コード例 #2
0
  private void updateUI() {

    setContentView(R.layout.quick_contact);
    ImageView ivAvatar = (ImageView) this.findViewById(R.id.iv_avatar);

    if (contact != null) {
      Bitmap bitmap =
          NmsContactApi.getInstance(mContext).getAvatarViaEngineContactId(contact.getId());
      if (bitmap != null) {
        ivAvatar.setImageBitmap(bitmap);
      }
    }

    TextView tvName = (TextView) this.findViewById(R.id.tv_name);
    tvName.setText(nativeContact.name);

    ListView lvPhone = (ListView) this.findViewById(R.id.lv_phonelist);

    LayoutParams lp = (LayoutParams) lvPhone.getLayoutParams();
    if (nativeContact.numbers.size() > 2) {
      lp.height = this.getResources().getDimensionPixelOffset(R.dimen.phone_list_quick);
    }

    lvPhone.setLayoutParams(lp);

    PhoneListAdapter adapter = new PhoneListAdapter(this);
    lvPhone.setAdapter(adapter);

    lvPhone.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
            call(nativeContact.numbers.get(arg2).number);
          }
        });
  }