void reload() { StringBuffer stringBufferTitle = new StringBuffer(); if (contact != null) { Contact updatedInfoContact = baseContactService.getContactById(contact.getContactIds()); if (updatedInfoContact != null && (!TextUtils.isEmpty(contact.getDisplayName())) && (!contact.getDisplayName().equals(updatedInfoContact.getDisplayName()))) { stringBufferTitle.append(updatedInfoContact.getDisplayName()); } } if (stringBufferTitle != null) { ((CustomToolbarListener)getActivity()).setToolbarTitle(contact.getDisplayName()); } }
public void userUnBlockDialog(final Contact contact) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()). setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { blockUserProcess(contact, false); } }); alertDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); String name = contact.getDisplayName(); alertDialog.setMessage(getString(R.string.user_un_block_info).replace("[name]", name)); alertDialog.setCancelable(true); alertDialog.create().show(); }
public void userBlockDialog(final boolean block, final Contact withUserContact, final boolean isFromChannel) { if (withUserContact == null) { return; } AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()). setPositiveButton(R.string.ok_alert, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { blockUserProcess(withUserContact.getUserId(), block, isFromChannel); } }); alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); String name = withUserContact.getDisplayName(); alertDialog.setMessage(getString(block ? R.string.user_block_info : R.string.user_un_block_info).replace("[name]", name)); alertDialog.setCancelable(true); alertDialog.create().show(); }
@Override protected void onPostExecute(File file) { super.onPostExecute(file); if (contextWeakReference != null) { Context context = contextWeakReference.get(); if (file != null && file.exists() && context != null) { Uri fileUri = Uri.parse(file.getAbsolutePath()); Intent sendAttachmentIntent = new Intent(context, MobiComAttachmentSelectorActivity.class); if (channel != null) { sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.GROUP_ID, channel.getKey()); sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.GROUP_NAME, channel.getName()); } else if (contact != null) { sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.USER_ID, contact.getUserId()); sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.DISPLAY_NAME, contact.getDisplayName()); } if (fileUri != null) { sendAttachmentIntent.putExtra(MobiComAttachmentSelectorActivity.URI_LIST, fileUri); } context.startActivity(sendAttachmentIntent); } } } }
private void processContactImage(Contact contact, TextView textView, TextView alphabeticTextView, CircleImageView contactImage) { try { String contactNumber = ""; char firstLetter = 0; contactNumber = contact.getDisplayName().toUpperCase(); firstLetter = contact.getDisplayName().toUpperCase().charAt(0); if (contact != null) { if (firstLetter != '+') { alphabeticTextView.setText(String.valueOf(firstLetter)); } else if (contactNumber.length() >= 2) { alphabeticTextView.setText(String.valueOf(contactNumber.charAt(1))); } Character colorKey = AlphaNumberColorUtil.alphabetBackgroundColorMap.containsKey(firstLetter) ? firstLetter : null; GradientDrawable bgShape = (GradientDrawable) alphabeticTextView.getBackground(); bgShape.setColor(context.getResources().getColor(AlphaNumberColorUtil.alphabetBackgroundColorMap.get(colorKey))); } alphabeticTextView.setVisibility(View.GONE); contactImage.setVisibility(View.VISIBLE); if (contact != null) { if (contact.isDrawableResources()) { int drawableResourceId = context.getResources().getIdentifier(contact.getrDrawableName(), "drawable", context.getPackageName()); contactImage.setImageResource(drawableResourceId); } else { contactImageLoader.loadImage(contact, contactImage, alphabeticTextView); } } textView.setVisibility(contact != null && contact.isOnline() ? View.VISIBLE : View.GONE); } catch (Exception e) { } }
/** * This method is always called whenever the typing status change is received from the subscribed userId or Group * Be careful to instantiate your views here. */ public void createView() { Contact contact = new AppContactService(getContext()).getContactById(typerUserId); removeAllViews(); if (typingText == null) { typingText = new TextView(getContext()); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); typingText.setLayoutParams(params); typingText.setTextSize(14); typingText.setTextColor(getContext().getResources().getColor(R.color.apploizc_black_color)); } addView(typingText); if (isTyping) { typingText.setText((contact != null ? contact.getDisplayName() : "") + " is Typing..."); } else { typingText.setText((contact != null ? contact.getDisplayName() : "") + " is not Typing..."); } }
public void addChannelUser(final String userId, final Channel channel) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this). setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ChannelMemberAdd(channel, userId, ChannelInfoActivity.this).execute(); } }); alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); String name = ""; String channelName = ""; Contact contact; if (channel != null) { contact = baseContactService.getContactById(userId); name = contact.getDisplayName(); channelName = channel.getName(); } alertDialog.setMessage(getString(R.string.dialog_add_group_user).replace(getString(R.string.user_name_info), name).replace(getString(R.string.group_name_info), channelName)); alertDialog.setCancelable(true); alertDialog.create().show(); }
public void refreshContactData() { if (contact != null) { Contact updateContact = baseContactService.getContactById(contact.getContactIds()); if (updateContact != null && (!TextUtils.isEmpty(contact.getImageURL())) && (!contact.getImageURL().equals(updateContact.getImageURL()))) { contactImageLoader.loadImage(updateContact, contactImage); } if (!TextUtils.isEmpty(updateContact.getStatus())) { status_cardView.setVisibility(View.VISIBLE); status.setText(updateContact.getStatus()); } if (!TextUtils.isEmpty(updateContact.getContactNumber())) { phone_cardView.setVisibility(View.VISIBLE); phone.setText(updateContact.getContactNumber()); } if (updateContact != null && (!TextUtils.isEmpty(contact.getDisplayName())) && (!contact.getDisplayName().equals(updateContact.getDisplayName()))) { name_cardView.setVisibility(View.VISIBLE); name.setText(updateContact.getDisplayName()); reload(); } } }
public static void buildVideoCallNotification(Context context, Message message, int index) { Map<String, String> metaDataMap = message.getMetadata(); Contact contact = new AppContactService(context).getContactById(message.getContactIds()); String audioORVideoCallPrefix = Boolean.valueOf(metaDataMap.get(CALL_AUDIO_ONLY)) ? "audio call " : "video call "; if (metaDataMap.get(VideoCallNotificationHelper.MSG_TYPE).equals(VideoCallNotificationHelper.CALL_MISSED)) { Message message1 = new Message(message); message1.setMessage("You missed " + audioORVideoCallPrefix + " from " + contact.getDisplayName()); BroadcastService.sendNotificationBroadcast(context, message1, index); } }
char firstLetter; Contact contact = contactService.getContactById(messageInfo.getUserId()); holder.displayName.setText(contact.getDisplayName()); long timeStamp = messageInfo.isRead() ? messageInfo.getReadAtTime() : (messageInfo.getDeliveredAtTime() == null ? 0 : messageInfo.getDeliveredAtTime()); if (contact != null && !TextUtils.isEmpty(contact.getDisplayName())) { contactNumber = contact.getDisplayName().toUpperCase(); firstLetter = contact.getDisplayName().toUpperCase().charAt(0); if (firstLetter != '+') { holder.alphabeticImage.setText(String.valueOf(firstLetter));
public void removeChannelUser(final Channel channel, final ChannelUserMapper channelUserMapper) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this). setPositiveButton(R.string.remove_member, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ChannelMember(channelUserMapper, channel, ChannelInfoActivity.this).execute(); } }); alertDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); String name = ""; String channelName = ""; Contact contact; if (!TextUtils.isEmpty(channelUserMapper.getUserKey())) { contact = baseContactService.getContactById(channelUserMapper.getUserKey()); name = contact.getDisplayName(); channelName = channel.getName(); } alertDialog.setMessage(getString(R.string.dialog_remove_group_user).replace(getString(R.string.user_name_info), name).replace(getString(R.string.group_name_info), channelName)); alertDialog.setCancelable(true); alertDialog.create().show(); }
@Override public void run() { try { Message message = latestMessageForEachContact.get(userId); if (message != null) { int index = messageList.indexOf(message); View view = recyclerView.getChildAt(index - linearLayoutManager.findFirstVisibleItemPosition()); Contact contact = baseContactService.getContactById(userId); if (view != null && contact != null) { ImageView contactImage = (ImageView) view.findViewById(R.id.contactImage); TextView displayNameTextView = (TextView) view.findViewById(R.id.smReceivers); displayNameTextView.setText(contact.getDisplayName()); recyclerAdapter.contactImageLoader.loadImage(contact, contactImage); recyclerAdapter.notifyDataSetChanged(); } } } catch (Exception ex) { Utils.printLog(getActivity(), "AL", "Exception while updating view ."); } } });
/** * This method will return full name of contact to be updated. * This is require to avoid updating full name back to userId in case fullname is not set while updating contact. * * @param contact * @return */ private String getFullNameForUpdate(Contact contact) { String fullName = contact.getDisplayName(); if (TextUtils.isEmpty(contact.getFullName())) { Contact contactFromDB = getContactById(contact.getUserId()); if (contactFromDB != null) { fullName = contactFromDB.getFullName(); } } return fullName; }
if (!TextUtils.isEmpty(userId)) { Contact withUserContact = baseContactService.getContactById(userId); name = withUserContact.getDisplayName(); name = contact.getDisplayName();
public void updateTitle() { StringBuffer stringBufferTitle = new StringBuffer(); if (contact != null) { stringBufferTitle.append(contact.getDisplayName()); } else if (channel != null) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) { String userId = ChannelService.getInstance(getActivity()).getGroupOfTwoReceiverUserId(channel.getKey()); if (!TextUtils.isEmpty(userId)) { Contact withUserContact = appContactService.getContactById(userId); stringBufferTitle.append(withUserContact.getDisplayName()); } } else { stringBufferTitle.append(ChannelUtils.getChannelTitleName(channel, MobiComUserPreference.getInstance(getActivity()).getUserId())); } } if (stringBufferTitle != null && getActivity() != null) { setToolbarTitle(stringBufferTitle.toString()); } }
public String getNameForInviteDialog() { if (contact != null) { return contact.getDisplayName(); } else if (channel != null) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) { String userId = ChannelService.getInstance(getActivity()).getGroupOfTwoReceiverUserId(channel.getKey()); if (!TextUtils.isEmpty(userId)) { Contact withUserContact = appContactService.getContactById(userId); return withUserContact.getDisplayName(); } } else { return ChannelUtils.getChannelTitleName(channel, MobiComUserPreference.getInstance(getActivity()).getUserId()); } } return ""; }
Contact receiverContact = appContactService.getContactById(userId); if (receiverContact != null) { notificationTitle = receiverContact.getDisplayName(); Contact receiverContact = appContactService.getContactById(userId); if (receiverContact != null) { notificationTitle = receiverContact.getDisplayName(); notificationTitle = contact.getDisplayName().trim();
menu.add(Menu.NONE, i, i, menuItems[i]); } else { menu.add(Menu.NONE, i, i, menuItems[i] + " " + contact.getDisplayName());
/** * This method returns the receiver's name from the message object that this instance holds currently. * * @return If the message belongs to group it will return group's name and if it belongs to user, the display name of the user will be returned. */ public String getReceiver() { if (message.getGroupId() == null) { return contact.getDisplayName(); } else { if (channel != null) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) { Contact withUserContact = contactService.getContactById(ChannelService.getInstance(context).getGroupOfTwoReceiverUserId(channel.getKey())); if (withUserContact != null) { return withUserContact.getDisplayName(); } } else { return ChannelUtils.getChannelTitleName(channel, MobiComUserPreference.getInstance(context).getUserId()); } } } return null; }
public CharSequence getMessageBody(Message message, int count, Channel channel, Contact contact) { String notificationText; if (message.getContentType() == Message.ContentType.LOCATION.getValue()) { notificationText = getText(0); } else if (message.getContentType() == Message.ContentType.AUDIO_MSG.getValue()) { notificationText = getText(1); } else if (message.getContentType() == Message.ContentType.VIDEO_MSG.getValue()) { notificationText = getText(2); } else if (message.hasAttachment() && TextUtils.isEmpty(message.getMessage())) { notificationText = getText(3); } else { notificationText = message.getMessage(); } CharSequence messageBody; Contact messageContactDisplayName = contact != null ? contact : appContactService.getContactById(message.getTo()); if (message.getGroupId() != null) { if (Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType()) || Channel.GroupType.SUPPORT_GROUP.getValue().equals(channel.getType())) { messageBody = Utils.getStyleStringForMessage(notificationText); } else { messageBody = Utils.getStyledStringForChannel(messageContactDisplayName.getDisplayName(), channel.getName(), notificationText); } } else { if (count < 2) { messageBody = Utils.getStyleStringForMessage(notificationText); } else { messageBody = Utils.getStyledStringForContact(messageContactDisplayName.getDisplayName(), notificationText); } } return messageBody; }