public ContactHeaderWidget(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mContentResolver = this.getContext().getContentResolver();

    LayoutInflater inflater =
        (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.contact_header, this);
    // inflater.inflate(R.id.contact_header, this);

    mDisplayNameView = (TextView) findViewById(R.id.name);
    mAggregateBadge = findViewById(R.id.aggregate_badge);
    mAggregateBadge.setVisibility(View.GONE);

    mPhoneticNameView = (TextView) findViewById(R.id.phonetic_name);

    mStarredView = (CheckBox) findViewById(R.id.star);
    mStarredView.setOnClickListener(this);

    mPhotoView = (QuickContactBadge) findViewById(R.id.photo);

    mPresenceView = (ImageView) findViewById(R.id.presence);

    mStatusView = (TextView) findViewById(R.id.status);
    mStatusAttributionView = (TextView) findViewById(R.id.status_date);

    // Set the photo with a random "no contact" image
    long now = SystemClock.elapsedRealtime();
    int num = (int) now & 0xf;
    if (num < 9) {
      // Leaning in from right, common
      mNoPhotoResource = R.drawable.ic_contact_picture;
    } else if (num < 14) {
      // Leaning in from left uncommon
      mNoPhotoResource = InternalResource.getDrawable("ic_contact_picture_2");
    } else {
      // Coming in from the top, rare
      mNoPhotoResource = InternalResource.getDrawable("ic_contact_picture_3");
    }

    resetAsyncQueryHandler();
  }
  /** Bind the contact details provided by the given {@link Cursor}. */
  protected void bindContactInfo(Cursor c) {
    // TODO: Bring back phonetic name
    final String displayName = c.getString(ContactQuery.DISPLAY_NAME);
    final String phoneticName = null;
    this.setDisplayName(displayName, null);

    final boolean starred = c.getInt(ContactQuery.STARRED) != 0;
    mStarredView.setChecked(starred);

    // Set the presence status
    if (!c.isNull(ContactQuery.CONTACT_PRESENCE_STATUS)) {
      int presence = c.getInt(ContactQuery.CONTACT_PRESENCE_STATUS);
      mPresenceView.setImageResource(StatusUpdates.getPresenceIconResourceId(presence));
      mPresenceView.setVisibility(View.VISIBLE);
    } else {
      mPresenceView.setVisibility(View.GONE);
    }

    // Set the status update
    String status = c.getString(ContactQuery.CONTACT_STATUS);
    if (!TextUtils.isEmpty(status)) {
      mStatusView.setText(status);
      mStatusView.setVisibility(View.VISIBLE);

      CharSequence timestamp = null;

      if (!c.isNull(ContactQuery.CONTACT_STATUS_TIMESTAMP)) {
        long date = c.getLong(ContactQuery.CONTACT_STATUS_TIMESTAMP);

        // Set the date/time field by mixing relative and absolute
        // times.
        int flags = DateUtils.FORMAT_ABBREV_RELATIVE;

        timestamp =
            DateUtils.getRelativeTimeSpanString(
                date, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, flags);
      }

      String label = null;

      if (!c.isNull(ContactQuery.CONTACT_STATUS_LABEL)) {
        String resPackage = c.getString(ContactQuery.CONTACT_STATUS_RES_PACKAGE);
        int labelResource = c.getInt(ContactQuery.CONTACT_STATUS_LABEL);
        Resources resources;
        if (TextUtils.isEmpty(resPackage)) {
          resources = getResources();
        } else {
          PackageManager pm = getContext().getPackageManager();
          try {
            resources = pm.getResourcesForApplication(resPackage);
          } catch (NameNotFoundException e) {
            Log.w(TAG, "Contact status update resource package not found: " + resPackage);
            resources = null;
          }
        }

        if (resources != null) {
          try {
            label = resources.getString(labelResource);
          } catch (NotFoundException e) {
            Log.w(
                TAG,
                "Contact status update resource not found: " + resPackage + "@" + labelResource);
          }
        }
      }

      CharSequence attribution;
      if (timestamp != null && label != null) {
        attribution =
            getContext()
                .getString(
                    InternalResource.getString("contact_status_update_attribution_with_date"),
                    timestamp,
                    label);
      } else if (timestamp == null && label != null) {
        attribution =
            getContext()
                .getString(InternalResource.getString("contact_status_update_attribution"), label);
      } else if (timestamp != null) {
        attribution = timestamp;
      } else {
        attribution = null;
      }
      if (attribution != null) {
        mStatusAttributionView.setText(attribution);
        mStatusAttributionView.setVisibility(View.VISIBLE);
      } else {
        mStatusAttributionView.setVisibility(View.GONE);
      }
    } else {
      mStatusView.setVisibility(View.GONE);
      mStatusAttributionView.setVisibility(View.GONE);
    }
  }