コード例 #1
0
    @Override
    public void bindView(View view) {
      ViewHolder holder = (ViewHolder) view.getTag();
      LayoutInflater inflater = LayoutInflater.from(context);
      Resources res = context.getResources();

      holder.infoContainer.removeAllViews();
      addNewInfoItem(
          contact.getNickname(),
          ConstantCode.getSexImageResource(contact.getSex()),
          inflater,
          holder.infoContainer);
      addNewInfoItem(
          context.getString(R.string.label_code) + contact.getLabelCode(),
          inflater,
          holder.infoContainer);
      if (contact.getAge() > 0) {
        addNewInfoItem(
            MiscUtils.getAgeString(res, contact.getAge()), inflater, holder.infoContainer);
      }
      if (contact.getHeight() > 0) {
        addNewInfoItem(
            MiscUtils.getHeightString(res, contact.getHeight()), inflater, holder.infoContainer);
      }
      if (contact.getConstellation() > 0) {
        addNewInfoItem(
            MiscUtils.getConstellationString(res, contact.getConstellation()),
            inflater,
            holder.infoContainer);
      }
      if (!TextUtils.isEmpty(contact.getSchool())) {
        addNewInfoItem(contact.getSchool(), inflater, holder.infoContainer);
      }
      if (!TextUtils.isEmpty(contact.getJob())) {
        addNewInfoItem(contact.getJob(), inflater, holder.infoContainer);
      }
    }
コード例 #2
0
ファイル: UserContact.java プロジェクト: xxwenxiang/LabelChat
 public static String getAgeString(Resources resources, int age) {
   return MiscUtils.getAgeString(resources, age);
 }