public void processUserDetails(UserDetail[] userDetails) { if (userDetails != null && userDetails.length > 0) { for (UserDetail userDetail : userDetails) { Contact contact = new Contact(); contact.setUserId(userDetail.getUserId()); contact.setContactNumber(userDetail.getPhoneNumber()); contact.setConnected(userDetail.isConnected()); if (!TextUtils.isEmpty(userDetail.getDisplayName())) { contact.setFullName(userDetail.getDisplayName()); } contact.setLastSeenAt(userDetail.getLastSeenAtTime()); contact.setStatus(userDetail.getStatusMessage()); contact.setUnreadCount(userDetail.getUnreadCount()); contact.setUserTypeId(userDetail.getUserTypeId()); contact.setImageURL(userDetail.getImageLink()); contact.setDeletedAtTime(userDetail.getDeletedAtTime()); contact.setLastMessageAtTime(userDetail.getLastMessageAtTime()); contact.setMetadata(userDetail.getMetadata()); contact.setRoleType(userDetail.getRoleType()); baseContactService.upsert(contact); } } }
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(); } } }
if (contact.getDeviceContactType() != null) { contentValues.put(MobiComDatabaseHelper.DEVICE_CONTACT_TYPE, contact.getDeviceContactType()); contentValues.put(MobiComDatabaseHelper.APPLOZIC_TYPE, contact.isApplozicType() ? 1 : 0); if (!TextUtils.isEmpty(contact.getFormattedContactNumber())) { contentValues.put(MobiComDatabaseHelper.CONTACT_NO, contact.getFormattedContactNumber()); if (!TextUtils.isEmpty(contact.getPhoneDisplayName())) { contentValues.put(MobiComDatabaseHelper.PHONE_CONTACT_DISPLAY_NAME, contact.getPhoneDisplayName()); if (!TextUtils.isEmpty(contact.getContactNumber())) { contentValues.put(MobiComDatabaseHelper.CONTACT_NO, contact.getContactNumber()); if (!TextUtils.isEmpty(contact.getImageURL())) { contentValues.put(MobiComDatabaseHelper.CONTACT_IMAGE_URL, contact.getImageURL()); contactImage = getContactById(contact.getUserId()); if (contactImage != null && !TextUtils.isEmpty(contactImage.getImageURL()) && !TextUtils.isEmpty(contact.getImageURL()) && !contact.getImageURL().equals(contactImage.getImageURL())) { updateContactLocalImageURIToNull(contact.getUserId()); if (!TextUtils.isEmpty(contact.getLocalImageUrl())) { contentValues.put(MobiComDatabaseHelper.CONTACT_IMAGE_LOCAL_URI, contact.getLocalImageUrl()); contentValues.put(MobiComDatabaseHelper.USERID, contact.getUserId()); if (!TextUtils.isEmpty(contact.getEmailId())) { contentValues.put(MobiComDatabaseHelper.EMAIL, contact.getEmailId()); if (!TextUtils.isEmpty(contact.getApplicationId())) { contentValues.put(MobiComDatabaseHelper.APPLICATION_ID, contact.getApplicationId());
public String getCurrentUserId() { if (contact == null) { return ""; } return contact.getUserId() != null ? contact.getUserId() : contact.getFormattedContactNumber(); }
public String getDisplayName() { if (formattedContactNumber != null) { return TextUtils.isEmpty(phoneDisplayName) ? TextUtils.isEmpty(getFormattedContactNumber()) ? getContactIds() : getFormattedContactNumber() : phoneDisplayName; } return TextUtils.isEmpty(fullName) ? getContactIds() : fullName; }
public Contact getSupportContact() { Contact contact = new Contact(); contact.setFirstName("Support"); contact.setLastName(""); contact.setFullName("Support"); contact.setContactNumber(getSupportNumber()); contact.setFormattedContactNumber(getSupportNumber()); return contact; } }
Contact contact = new Contact(); contact.setFullName(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.FULL_NAME))); contact.setUserId(cursor.getString(cursor.getColumnIndex(primaryKeyAliash == null ? MobiComDatabaseHelper.USERID : primaryKeyAliash))); contact.setLocalImageUrl(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.CONTACT_IMAGE_LOCAL_URI))); contact.setImageURL(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.CONTACT_IMAGE_URL))); contact.setContactNumber(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.CONTACT_NO))); contact.setApplicationId(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.APPLICATION_ID))); Long connected = cursor.getLong(cursor.getColumnIndex(MobiComDatabaseHelper.CONNECTED)); contact.setContactType(cursor.getShort(cursor.getColumnIndex(MobiComDatabaseHelper.CONTACT_TYPE))); contact.setConnected(connected != 0 && connected.intValue() == 1); contact.setLastSeenAt(cursor.getLong(cursor.getColumnIndex(MobiComDatabaseHelper.LAST_SEEN_AT_TIME))); contact.processContactNumbers(context); contact.setUnreadCount(cursor.getInt(cursor.getColumnIndex(MobiComDatabaseHelper.UNREAD_COUNT))); Boolean userBlocked = (cursor.getInt(cursor.getColumnIndex(MobiComDatabaseHelper.BLOCKED)) == 1); contact.setBlocked(userBlocked); Boolean userBlockedBy = (cursor.getInt(cursor.getColumnIndex(MobiComDatabaseHelper.BLOCKED_BY)) == 1); contact.setBlockedBy(userBlockedBy); contact.setStatus(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.STATUS))); contact.setUserTypeId(cursor.getShort(cursor.getColumnIndex(MobiComDatabaseHelper.USER_TYPE_ID))); contact.setDeletedAtTime(cursor.getLong(cursor.getColumnIndex(MobiComDatabaseHelper.DELETED_AT))); contact.setNotificationAfterTime(cursor.getLong(cursor.getColumnIndex(MobiComDatabaseHelper.NOTIFICATION_AFTER_TIME))); contact.setRoleType(cursor.getShort(cursor.getColumnIndex(MobiComDatabaseHelper.USER_ROLE_TYPE))); contact.setLastMessageAtTime(cursor.getLong(cursor.getColumnIndex(MobiComDatabaseHelper.LAST_MESSAGED_AT))); contact.setDeviceContactType(cursor.getShort(cursor.getColumnIndex(MobiComDatabaseHelper.DEVICE_CONTACT_TYPE))); contact.setPhoneDisplayName(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.PHONE_CONTACT_DISPLAY_NAME))); contact.setMetadata((Map<String, String>) GsonUtils.getObjectFromJson(metadata, Map.class));
if (!displayName.equals(contact.getPhoneDisplayName())) { contactDatabase.updatePhoneContactDisplayName(formattedPhoneNumber, displayName, Contact.ContactType.DEVICE_AND_APPLOZIC.getValue()); lookupKey = contact.getUserId(); } else if (contactByLookupKey != null) { Contact newContact = new Contact(); newContact.setContactNumber(formattedPhoneNumber); newContact.setUserId(lookupKey); newContact.setDeviceContactType(Contact.ContactType.DEVICE.getValue()); newContact.setFullName(displayName); newContact.setPhoneDisplayName(displayName); newContact.processContactNumbers(context); return newContact;
if (!TextUtils.isEmpty(displayName)) { if (Applozic.getInstance(context).isDeviceContactSync()) { contact.setPhoneDisplayName(displayName); contact.setFullName(displayName); contact.setImageURL(profileImageLink); contact.setLocalImageUrl(localURL); if (!TextUtils.isEmpty(status)) { contact.setStatus(status); contact.setContactNumber(contactNumber); Map<String, String> existingMetadata = contact.getMetadata(); if (existingMetadata == null) { existingMetadata = new HashMap<>(); contact.setMetadata(existingMetadata); Utils.printLog(context, "UserService", contact1.getImageURL() + ", " + contact1.getDisplayName() + "," + contact1.getStatus() + "," + contact1.getStatus() + "," + contact1.getMetadata());
Applozic.getInstance(context).setCustomNotificationSound(user.getNotificationSoundFilePath()); Contact contact = new Contact(); contact.setUserId(user.getUserId()); contact.setFullName(registrationResponse.getDisplayName()); contact.setImageURL(registrationResponse.getImageLink()); contact.setContactNumber(registrationResponse.getContactNumber()); if (user.getUserTypeId() != null) { contact.setUserTypeId(user.getUserTypeId()); contact.setRoleType(user.getRoleType()); contact.setMetadata(user.getMetadata()); contact.setStatus(registrationResponse.getStatusMessage()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Applozic.getInstance(context).setNotificationChannelVersion(NotificationChannels.NOTIFICATION_CHANNEL_VERSION - 1); new NotificationChannels(context, Applozic.getInstance(context).getCustomNotificationSound()).prepareNotificationChannels(); contact.processContactNumbers(context); new AppContactService(context).upsert(contact);
private void buildSupportContactData() { Context context = getApplicationContext(); AppContactService appContactService = new AppContactService(context); // avoid each time update .... if (!appContactService.isContactExists(getString(R.string.support_contact_userId))) { Contact contact = new Contact(); contact.setUserId(getString(R.string.support_contact_userId)); contact.setFullName(getString(R.string.support_contact_display_name)); contact.setContactNumber(getString(R.string.support_contact_number)); contact.setImageURL(getString(R.string.support_contact_image_url)); contact.setEmailId(getString(R.string.support_contact_emailId)); appContactService.add(contact); } }
public static Contact getContact(Context context, String contactId, String number) { Contact contact = new Contact(); contact.setContactNumber(number); Support support = new Support(context); if (support.isSupportNumber(number)) { return support.getSupportContact(); } else if (TextUtils.isEmpty(contactId) || UNKNOWN_NUMBER.equals(contactId)) { contact.processContactNumbers(context); return contact; contact.setContactId(Long.valueOf(contactId)); lastName = lastName == null ? "" : lastName; suffix = suffix == null ? "" : suffix; contact.setFirstName(TextUtils.isEmpty(prefix) ? firstName : (prefix + " " + firstName)); contact.setMiddleName(middleName); contact.setLastName(TextUtils.isEmpty(suffix) ? lastName : (lastName + " " + suffix)); contact.setFullName(fullName); contact.processContactNumbers(context); return contact;
holder.text1.setText(contact.getDisplayName()); holder.text2.setText(contact.getUserId()); holder.unBlock.setVisibility(View.GONE); holder.invite.setVisibility(View.GONE); if (contact.isDeviceContact()) { holder.invite.setVisibility(View.VISIBLE); } else { if (contact.isBlocked()) { holder.unBlock.setVisibility(View.VISIBLE); } else { if (contact != null && !TextUtils.isEmpty(contact.getDisplayName())) { contactNumber = contact.getDisplayName().toUpperCase(); firstLetter = contact.getDisplayName().toUpperCase().charAt(0); if (firstLetter != '+') { holder.contactIcon.setText(String.valueOf(firstLetter)); holder.icon.setVisibility(View.VISIBLE); if (contact != null) { if (contact.isDrawableResources()) { int drawableResourceId = context.getResources().getIdentifier(contact.getrDrawableName(), "drawable", context.getPackageName()); holder.icon.setImageResource(drawableResourceId); } else { if (!TextUtils.isEmpty(contact.getContactNumber()) || isDeviceContactSync) { holder.contactNumberTextView.setVisibility(View.VISIBLE);
Contact contact = new Contact(); contact.setUserId("adarshk"); contact.setFullName("John"); contact.setImageURL("R.drawable.couple"); contactList.add(contact); Contact contactRaj = new Contact(); contactRaj.setUserId("raj"); contactRaj.setFullName("rajni"); contactRaj.setImageURL("https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p200x200/12049601_556630871166455_1647160929759032778_n.jpg?oh=7ab819fc614f202e144cecaad0eb696b&oe=56EBA555&__gda__=1457202000_85552414c5142830db00c1571cc50641"); contactList.add(contactRaj); Contact contact2 = new Contact(); contact2.setUserId("rathan"); contact2.setFullName("Liz"); contact2.setImageURL("R.drawable.liz"); contactList.add(contact2); Contact contact3 = new Contact(); contact3.setUserId("clem"); contact3.setFullName("Clement"); contact3.setImageURL("R.drawable.shivam"); contactList.add(contact3); Contact contact4 = new Contact(); contact4.setUserId("shanki.gupta"); contact4.setFullName("Bill"); contact4.setImageURL("R.drawable.contact_shanki"); contactList.add(contact4);
if (bundle != null) { contact = (Contact) bundle.getSerializable(ConversationUIService.CONTACT); contact = baseContactService.getContactById(contact.getContactIds()); ((CustomToolbarListener)getActivity()).setToolbarTitle(contact.getDisplayName()); name.setText(contact.getDisplayName()); char firstLetter = contact.getDisplayName().toUpperCase().charAt(0); String contactNumber = contact.getDisplayName().toUpperCase(); if (firstLetter != '+') { alphabeticTextView.setText(String.valueOf(firstLetter)); GradientDrawable bgShape = (GradientDrawable) alphabeticTextView.getBackground(); bgShape.setColor(getActivity().getResources().getColor(AlphaNumberColorUtil.alphabetBackgroundColorMap.get(colorKey))); if (contact.isDrawableResources()) { int drawableResourceId = getResources().getIdentifier(contact.getrDrawableName(), "drawable", getActivity().getPackageName()); contactImage.setImageResource(drawableResourceId); } else { name.setText(contact.getDisplayName()); if (!TextUtils.isEmpty(contact.getEmailId())) { email_cardView.setVisibility(View.VISIBLE); email.setText(contact.getEmailId()); if (!TextUtils.isEmpty(contact.getStatus())) { status_cardView.setVisibility(View.VISIBLE); status.setText(contact.getStatus());
public synchronized void processMuteUserResponse(MuteUserResponse response) { Contact contact = new Contact(); contact.setUserId(response.getUserId()); BroadcastService.sendMuteUserBroadcast(context, BroadcastService.INTENT_ACTIONS.MUTE_USER_CHAT.toString(), true, response.getUserId()); if (!TextUtils.isEmpty(response.getImageLink())) { contact.setImageURL(response.getImageLink()); } contact.setUnreadCount(response.getUnreadCount()); if (response.getNotificationAfterTime() != null && response.getNotificationAfterTime() != 0) { contact.setNotificationAfterTime(response.getNotificationAfterTime()); } contact.setConnected(response.isConnected()); baseContactService.upsert(contact); }
Contact contact = new Contact(); contact.setUserId(keyValue.getKey()); contact.setFullName(keyValue.getValue()); contact.setUnreadCount(0); baseContactService.upsert(contact);
char firstLetter = 0; if (contact != null) { contactNumber = contact.getDisplayName().toUpperCase(); firstLetter = contact.getDisplayName().toUpperCase().charAt(0); } else if (channel != null && contactDisplayName != null) { firstLetter = contactDisplayName.getDisplayName().toUpperCase().charAt(0); contactNumber = contactDisplayName.getDisplayName().toUpperCase(); if (contact != null && contact.isDrawableResources() && contactImage != null) { int drawableResourceId = context.getResources().getIdentifier(contact.getrDrawableName(), "drawable", context.getPackageName()); contactImage.setImageResource(drawableResourceId); contactImage.setVisibility(View.VISIBLE); alphabeticTextView.setVisibility(View.GONE); } else if (contact != null && contactImage != null) { if (TextUtils.isEmpty(contact.getImageURL())) { contactImage.setVisibility(View.GONE); alphabeticTextView.setVisibility(View.VISIBLE); if (contactDisplayName != null && contactDisplayName.isDrawableResources() && contactImage != null) { int drawableResourceId = context.getResources().getIdentifier(contactDisplayName.getrDrawableName(), "drawable", context.getPackageName()); contactImage.setImageResource(drawableResourceId); contactImage.setVisibility(View.VISIBLE); } else if (contactDisplayName != null && contactImage != null) { if (alCustomizationSettings.isGroupUsersOnlineStatus() && onlineTextView != null) { if (contactDisplayName.isConnected()) { onlineTextView.setVisibility(View.VISIBLE); } else {
contact.setContactNumber(items.get(0)); if (userIds != null) { contact.setUserId(userIds.get(0)); displayName = context.getString(R.string.you_string); } else { displayName = contactService.getContactById(msg.getContactIds()).getDisplayName(); displayName = context.getString(R.string.you_string); } else { displayName = contactService.getContactById(msg.getContactIds()).getDisplayName(); String userId = contactDisplayName.getDisplayName(); char firstLetter = contactDisplayName.getDisplayName().charAt(0); if (userId.length() > 0) { myHolder.nameTextView.setText(String.valueOf(userId)); statusIcon = context.getResources().getDrawable(R.drawable.applozic_ic_action_message_read); } else { statusIcon = (message.getDelivered() || (contact != null && new Support(context).isSupportNumber(contact.getFormattedContactNumber())) ? deliveredIcon : (message.getScheduledAt() != null ? scheduledIcon : sentIcon));
@Override public void onClick(View v) { AppCompatCheckBox checkBox = (AppCompatCheckBox) v; if (checkBox.isChecked()) { userIdList.add(contact.getContactIds()); } else if (!checkBox.isChecked()) { userIdList.remove(contact.getContactIds()); } } });