public OutgoingMediaMessage( Context context, Recipients recipients, PduBody body, String message, int distributionType) { this.recipients = recipients; this.body = body; this.distributionType = distributionType; if (!Util.isEmpty(message)) { this.body.addPart(new TextSlide(context, message).getPart()); } }
private List<Draft> getDraftsForCurrentState() { List<Draft> drafts = new LinkedList<Draft>(); if (!Util.isEmpty(composeText)) { drafts.add(new Draft(Draft.TEXT, composeText.getText().toString())); } for (Slide slide : attachmentManager.getSlideDeck().getSlides()) { if (slide.hasImage()) drafts.add(new Draft(Draft.IMAGE, slide.getUri().toString())); else if (slide.hasAudio()) drafts.add(new Draft(Draft.AUDIO, slide.getUri().toString())); else if (slide.hasVideo()) drafts.add(new Draft(Draft.VIDEO, slide.getUri().toString())); } return drafts; }
public static Recipients getRecipientsFromMessage( Context context, IncomingPushMessage message, boolean asynchronous) { Set<String> recipients = new HashSet<String>(); recipients.add(message.getSource()); recipients.addAll(message.getDestinations()); try { return getRecipientsFromString(context, Util.join(recipients, ","), asynchronous); } catch (RecipientFormattingException e) { Log.w("RecipientFactory", e); return new Recipients( new Recipient( "Unknown", "Unknown", null, ContactPhotoFactory.getDefaultContactPhoto(context))); } }
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(); }