public ContactSelectionListAdapter(Context context, Cursor cursor, boolean multiSelect) {
   super(context, cursor, 0);
   this.context = context;
   this.li = LayoutInflater.from(context);
   this.drawables = context.obtainStyledAttributes(STYLE_ATTRIBUTES);
   this.multiSelect = multiSelect;
   this.defaultPhoto = ContactPhotoFactory.getDefaultContactPhoto(context);
   this.scaledPhotoSize =
       context.getResources().getDimensionPixelSize(R.dimen.contact_selection_photo_size);
   this.defaultCroppedPhoto =
       BitmapUtil.getScaledCircleCroppedBitmap(defaultPhoto, scaledPhotoSize);
 }
  private void initializeTitleBar() {
    String title = null;
    String subtitle = null;

    if (isSingleConversation()) {
      title = getRecipients().getPrimaryRecipient().getName();

      if (title == null || title.trim().length() == 0) {
        title = getRecipients().getPrimaryRecipient().getNumber();
      } else {
        subtitle = getRecipients().getPrimaryRecipient().getNumber();
      }
    } else if (isGroupConversation()) {
      if (isPushGroupConversation()) {
        final String groupName = getRecipients().getPrimaryRecipient().getName();
        title =
            (!TextUtils.isEmpty(groupName))
                ? groupName
                : getString(R.string.ConversationActivity_unnamed_group);
        final Bitmap avatar = getRecipients().getPrimaryRecipient().getContactPhoto();
        if (avatar != null) {
          getSupportActionBar()
              .setIcon(
                  new BitmapDrawable(getResources(), BitmapUtil.getCircleCroppedBitmap(avatar)));
        }
      } else {
        title = getString(R.string.ConversationActivity_group_conversation);
        int size = getRecipients().getRecipientsList().size();
        subtitle =
            (size == 1)
                ? getString(R.string.ConversationActivity_d_recipients_in_group_singular)
                : String.format(
                    getString(R.string.ConversationActivity_d_recipients_in_group), size);
      }
    } else {
      title = getString(R.string.ConversationActivity_compose_message);
      subtitle = "";
    }

    this.getSupportActionBar().setTitle(title);

    if (subtitle != null && !Util.isEmpty(subtitle))
      this.getSupportActionBar().setSubtitle(PhoneNumberUtils.formatNumber(subtitle));

    this.invalidateOptionsMenu();
  }