Java Code Examples for org.telegram.messenger.ContactsController#Contact
The following examples show how to use
org.telegram.messenger.ContactsController#Contact .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhonebookAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(int section, int position, RecyclerView.ViewHolder holder) { switch (holder.getItemViewType()) { case 0: UserCell userCell = (UserCell) holder.itemView; Object object = getItem(section, position); TLRPC.User user = null; if (object instanceof ContactsController.Contact) { ContactsController.Contact contact = (ContactsController.Contact) object; if (contact.user != null) { user = contact.user; } else { userCell.setCurrentId(contact.contact_id); userCell.setData(null, ContactsController.formatName(contact.first_name, contact.last_name), contact.phones.isEmpty() ? "" : PhoneFormat.getInstance().format(contact.phones.get(0)), 0); } } else { user = (TLRPC.User) object; } if (user != null) { userCell.setData(user, null, PhoneFormat.getInstance().format("+" + user.phone), 0); } break; } }
Example 2
Source File: ChatAttachAlertContactsLayout.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(int section, int position, RecyclerView.ViewHolder holder) { if (holder.getItemViewType() == 0) { UserCell userCell = (UserCell) holder.itemView; Object object = getItem(section, position); TLRPC.User user = null; boolean divider = section != getSectionCount() - 2 || position != getCountForSection(section) - 1; if (object instanceof ContactsController.Contact) { ContactsController.Contact contact = (ContactsController.Contact) object; if (contact.user != null) { user = contact.user; } else { userCell.setCurrentId(contact.contact_id); userCell.setData(null, ContactsController.formatName(contact.first_name, contact.last_name), contact.phones.isEmpty() ? "" : PhoneFormat.getInstance().format(contact.phones.get(0)), divider); } } else { user = (TLRPC.User) object; } if (user != null) { userCell.setData(user, null, PhoneFormat.getInstance().format("+" + user.phone), divider); } } }
Example 3
Source File: InviteContactsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: { InviteUserCell cell = (InviteUserCell) holder.itemView; ContactsController.Contact contact; CharSequence name; if (searching) { contact = searchResult.get(position); name = searchResultNames.get(position); } else { contact = phoneBookContacts.get(position - 1); name = null; } cell.setUser(contact, name); cell.setChecked(selectedContacts.containsKey(contact.key), false); break; } } }
Example 4
Source File: ChatAttachAlertContactsLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(int section, int position, RecyclerView.ViewHolder holder) { if (holder.getItemViewType() == 0) { UserCell userCell = (UserCell) holder.itemView; Object object = getItem(section, position); TLRPC.User user = null; boolean divider = section != getSectionCount() - 2 || position != getCountForSection(section) - 1; if (object instanceof ContactsController.Contact) { ContactsController.Contact contact = (ContactsController.Contact) object; if (contact.user != null) { user = contact.user; } else { userCell.setCurrentId(contact.contact_id); userCell.setData(null, ContactsController.formatName(contact.first_name, contact.last_name), contact.phones.isEmpty() ? "" : PhoneFormat.getInstance().format(contact.phones.get(0)), divider); } } else { user = (TLRPC.User) object; } if (user != null) { userCell.setData(user, null, PhoneFormat.getInstance().format("+" + user.phone), divider); } } }
Example 5
Source File: ChatAttachAlertContactsLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder.getItemViewType() == 0) { UserCell userCell = (UserCell) holder.itemView; boolean divider = position != getItemCount() - 2; Object object = getItem(position); TLRPC.User user = null; if (object instanceof ContactsController.Contact) { ContactsController.Contact contact = (ContactsController.Contact) object; if (contact.user != null) { user = contact.user; } else { userCell.setCurrentId(contact.contact_id); userCell.setData(null, searchResultNames.get(position - 1), contact.phones.isEmpty() ? "" : PhoneFormat.getInstance().format(contact.phones.get(0)), divider); } } else { user = (TLRPC.User) object; } if (user != null) { userCell.setData(user, searchResultNames.get(position - 1), PhoneFormat.getInstance().format("+" + user.phone), divider); } } }
Example 6
Source File: PhonebookSearchAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder.getItemViewType() == 0) { UserCell userCell = (UserCell) holder.itemView; Object object = getItem(position); TLRPC.User user = null; if (object instanceof ContactsController.Contact) { ContactsController.Contact contact = (ContactsController.Contact) object; if (contact.user != null) { user = contact.user; } else { userCell.setCurrentId(contact.contact_id); userCell.setData(null, searchResultNames.get(position), contact.phones.isEmpty() ? "" : PhoneFormat.getInstance().format(contact.phones.get(0)), 0); } } else { user = (TLRPC.User) object; } if (user != null) { userCell.setData(user, searchResultNames.get(position), PhoneFormat.getInstance().format("+" + user.phone), 0); } } }
Example 7
Source File: InviteContactsActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void updateSearchResults(final ArrayList<ContactsController.Contact> users, final ArrayList<CharSequence> names) { AndroidUtilities.runOnUIThread(() -> { if (!searching) { return; } searchResult = users; searchResultNames = names; notifyDataSetChanged(); }); }
Example 8
Source File: InviteContactsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void updateSearchResults(final ArrayList<ContactsController.Contact> users, final ArrayList<CharSequence> names) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { searchResult = users; searchResultNames = names; notifyDataSetChanged(); } }); }
Example 9
Source File: InviteContactsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void checkVisibleRows() { int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View child = listView.getChildAt(a); if (child instanceof InviteUserCell) { InviteUserCell cell = (InviteUserCell) child; ContactsController.Contact contact = cell.getContact(); if (contact != null) { cell.setChecked(selectedContacts.containsKey(contact.key), true); } } } }
Example 10
Source File: GroupCreateSpan.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public GroupCreateSpan(Context context, ContactsController.Contact contact) { this(context, null, contact); }
Example 11
Source File: InviteUserCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public void setUser(ContactsController.Contact contact, CharSequence name) { currentContact = contact; currentName = name; update(0); }
Example 12
Source File: GroupCreateSpan.java From Telegram with GNU General Public License v2.0 | 4 votes |
public ContactsController.Contact getContact() { return currentContact; }
Example 13
Source File: InviteUserCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public ContactsController.Contact getContact() { return currentContact; }
Example 14
Source File: InviteUserCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public ContactsController.Contact getContact() { return currentContact; }
Example 15
Source File: ContactsAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(int section, int position, RecyclerView.ViewHolder holder) { switch (holder.getItemViewType()) { case 0: UserCell userCell = (UserCell) holder.itemView; HashMap<String, ArrayList<TLRPC.TL_contact>> usersSectionsDict = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).usersMutualSectionsDict : ContactsController.getInstance(currentAccount).usersSectionsDict; ArrayList<String> sortedUsersSectionsArray = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).sortedUsersMutualSectionsArray : ContactsController.getInstance(currentAccount).sortedUsersSectionsArray; ArrayList<TLRPC.TL_contact> arr = usersSectionsDict.get(sortedUsersSectionsArray.get(section - (onlyUsers != 0 && !isAdmin ? 0 : 1))); TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(arr.get(position).user_id); userCell.setData(user, null, null, 0); if (checkedMap != null) { userCell.setChecked(checkedMap.indexOfKey(user.id) >= 0, !scrolling); } if (ignoreUsers != null) { if (ignoreUsers.indexOfKey(user.id) >= 0) { userCell.setAlpha(0.5f); } else { userCell.setAlpha(1.0f); } } break; case 1: TextCell textCell = (TextCell) holder.itemView; if (section == 0) { if (needPhonebook) { textCell.setTextAndIcon(LocaleController.getString("InviteFriends", R.string.InviteFriends), R.drawable.menu_invite); } else if (isAdmin) { textCell.setTextAndIcon(LocaleController.getString("InviteToGroupByLink", R.string.InviteToGroupByLink), R.drawable.menu_invite); } else { if (position == 0) { textCell.setTextAndIcon(LocaleController.getString("NewGroup", R.string.NewGroup), R.drawable.menu_newgroup); } else if (position == 1) { textCell.setTextAndIcon(LocaleController.getString("NewSecretChat", R.string.NewSecretChat), R.drawable.menu_secret); } else if (position == 2) { textCell.setTextAndIcon(LocaleController.getString("NewChannel", R.string.NewChannel), R.drawable.menu_broadcast); } } } else { ContactsController.Contact contact = ContactsController.getInstance(currentAccount).phoneBookContacts.get(position); if (contact.first_name != null && contact.last_name != null) { textCell.setText(contact.first_name + " " + contact.last_name); } else if (contact.first_name != null && contact.last_name == null) { textCell.setText(contact.first_name); } else { textCell.setText(contact.last_name); } } break; } }
Example 16
Source File: InviteUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public void setUser(ContactsController.Contact contact, CharSequence name) { currentContact = contact; currentName = name; update(0); }
Example 17
Source File: InviteUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public ContactsController.Contact getContact() { return currentContact; }
Example 18
Source File: GroupCreateSpan.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public GroupCreateSpan(Context context, ContactsController.Contact contact) { this(context, null, contact); }
Example 19
Source File: GroupCreateSpan.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public GroupCreateSpan(Context context, ContactsController.Contact contact) { this(context, null, contact); }
Example 20
Source File: GroupCreateSpan.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public ContactsController.Contact getContact() { return currentContact; }