org.telegram.messenger.ContactsController Java Examples
The following examples show how to use
org.telegram.messenger.ContactsController.
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: DialogOrContactPickerActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void showBlockAlert(TLRPC.User user) { if (user == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("BlockUser", R.string.BlockUser)); builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AreYouSureBlockContact2", R.string.AreYouSureBlockContact2, ContactsController.formatName(user.first_name, user.last_name)))); builder.setPositiveButton(LocaleController.getString("BlockContact", R.string.BlockContact), (dialogInterface, i) -> { if (MessagesController.isSupportUser(user)) { AlertsCreator.showSimpleToast(DialogOrContactPickerActivity.this, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred)); } else { MessagesController.getInstance(currentAccount).blockUser(user.id); AlertsCreator.showSimpleToast(DialogOrContactPickerActivity.this, LocaleController.getString("UserBlocked", R.string.UserBlocked)); } finishFragment(); }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); AlertDialog dialog = builder.create(); showDialog(dialog); TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE); if (button != null) { button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); } }
Example #2
Source File: ContactsActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) { if (requestCode == 1) { for (int a = 0; a < permissions.length; a++) { if (grantResults.length <= a) { continue; } if (Manifest.permission.READ_CONTACTS.equals(permissions[a])) { if (grantResults[a] == PackageManager.PERMISSION_GRANTED) { ContactsController.getInstance(currentAccount).forceImportContacts(); } else { MessagesController.getGlobalNotificationsSettings().edit().putBoolean("askAboutContacts", askAboutContacts = false).commit(); } } } } }
Example #3
Source File: ChannelAdminLogActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
private String getMessageContent(MessageObject messageObject, int previousUid, boolean name) { String str = ""; if (name) { if (previousUid != messageObject.messageOwner.from_id) { if (messageObject.messageOwner.from_id > 0) { TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(messageObject.messageOwner.from_id); if (user != null) { str = ContactsController.formatName(user.first_name, user.last_name) + ":\n"; } } else if (messageObject.messageOwner.from_id < 0) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-messageObject.messageOwner.from_id); if (chat != null) { str = chat.title + ":\n"; } } } } if (messageObject.type == 0 && messageObject.messageOwner.message != null) { str += messageObject.messageOwner.message; } else if (messageObject.messageOwner.media != null && messageObject.messageOwner.message != null) { str += messageObject.messageOwner.message; } else { str += messageObject.messageText; } return str; }
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: LoginActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void onAuthSuccess(TLRPC.TL_auth_authorization res) { ConnectionsManager.getInstance(currentAccount).setUserId(res.user.id); UserConfig.getInstance(currentAccount).clearConfig(); MessagesController.getInstance(currentAccount).cleanup(); UserConfig.getInstance(currentAccount).syncContacts = syncContacts; UserConfig.getInstance(currentAccount).setCurrentUser(res.user); UserConfig.getInstance(currentAccount).saveConfig(true); MessagesStorage.getInstance(currentAccount).cleanup(true); ArrayList<TLRPC.User> users = new ArrayList<>(); users.add(res.user); MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, true, true); MessagesController.getInstance(currentAccount).putUser(res.user, false); ContactsController.getInstance(currentAccount).checkAppAccount(); MessagesController.getInstance(currentAccount).getBlockedUsers(true); MessagesController.getInstance(currentAccount).checkProxyInfo(true); ConnectionsManager.getInstance(currentAccount).updateDcSettings(); needFinishActivity(); }
Example #6
Source File: InviteContactsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void fetchContacts() { phoneBookContacts = new ArrayList<>(ContactsController.getInstance(currentAccount).phoneBookContacts); Collections.sort(phoneBookContacts, new Comparator<ContactsController.Contact>() { @Override public int compare(ContactsController.Contact o1, ContactsController.Contact o2) { if (o1.imported > o2.imported) { return -1; } else if (o1.imported < o2.imported) { return 1; } return 0; } }); if (emptyView != null) { emptyView.showTextView(); } if (adapter != null) { adapter.notifyDataSetChanged(); } }
Example #7
Source File: ContactsActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) { if (requestCode == 1) { for (int a = 0; a < permissions.length; a++) { if (grantResults.length <= a) { continue; } if (Manifest.permission.READ_CONTACTS.equals(permissions[a])) { if (grantResults[a] == PackageManager.PERMISSION_GRANTED) { ContactsController.getInstance(currentAccount).forceImportContacts(); } else { MessagesController.getGlobalNotificationsSettings().edit().putBoolean("askAboutContacts", askAboutContacts = false).commit(); } } } } }
Example #8
Source File: InviteContactsActivity.java From Telegram-FOSS 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 #9
Source File: VoIPService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.O) @Override public CallConnection getConnectionAndStartCall(){ if(systemCallConnection==null){ if(BuildVars.LOGS_ENABLED) FileLog.d("creating call connection"); systemCallConnection=new CallConnection(); systemCallConnection.setInitializing(); if(isOutgoing){ delayedStartOutgoingCall=new Runnable(){ @Override public void run(){ delayedStartOutgoingCall=null; startOutgoingCall(); } }; AndroidUtilities.runOnUIThread(delayedStartOutgoingCall, 2000); } systemCallConnection.setCallerDisplayName(ContactsController.formatName(user.first_name, user.last_name), TelecomManager.PRESENTATION_ALLOWED); } return systemCallConnection; }
Example #10
Source File: DrawerUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setAccount(int account) { accountNumber = account; TLRPC.User user = UserConfig.getInstance(accountNumber).getCurrentUser(); if (user == null) { return; } avatarDrawable.setInfo(user); textView.setText(ContactsController.formatName(user.first_name, user.last_name)); TLRPC.FileLocation avatar; if (user.photo != null && user.photo.photo_small != null && user.photo.photo_small.volume_id != 0 && user.photo.photo_small.local_id != 0) { avatar = user.photo.photo_small; } else { avatar = null; } imageView.getImageReceiver().setCurrentAccount(account); imageView.setImage(avatar, "50_50", avatarDrawable); checkBox.setVisibility(account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE); }
Example #11
Source File: InviteUserCell.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void update(int mask) { if (currentContact == null) { return; } String newName = null; avatarDrawable.setInfo(currentContact.contact_id, currentContact.first_name, currentContact.last_name); if (currentName != null) { nameTextView.setText(currentName, true); } else { nameTextView.setText(ContactsController.formatName(currentContact.first_name, currentContact.last_name)); } statusTextView.setTag(Theme.key_windowBackgroundWhiteGrayText); statusTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); if (currentContact.imported > 0) { statusTextView.setText(LocaleController.formatPluralString("TelegramContacts", currentContact.imported)); } else { statusTextView.setText(currentContact.phones.get(0)); } avatarImageView.setImageDrawable(avatarDrawable); }
Example #12
Source File: ContactsAdapter.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public int getSectionCount() { int count; if (sortType == 2) { count = 1; } else { ArrayList<String> sortedUsersSectionsArray = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).sortedUsersMutualSectionsArray : ContactsController.getInstance(currentAccount).sortedUsersSectionsArray; count = sortedUsersSectionsArray.size(); } if (onlyUsers == 0) { count++; } if (isAdmin) { count++; } if (needPhonebook) { //count++; } return count; }
Example #13
Source File: ContactsAdapter.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public int getSectionCount() { int count; if (sortType == 2) { count = 1; } else { ArrayList<String> sortedUsersSectionsArray = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).sortedUsersMutualSectionsArray : ContactsController.getInstance(currentAccount).sortedUsersSectionsArray; count = sortedUsersSectionsArray.size(); } if (onlyUsers == 0) { count++; } if (isAdmin) { count++; } if (needPhonebook) { //count++; } return count; }
Example #14
Source File: ContactsAdapter.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public String getLetter(int position) { if (sortType == 2) { return null; } ArrayList<String> sortedUsersSectionsArray = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).sortedUsersMutualSectionsArray : ContactsController.getInstance(currentAccount).sortedUsersSectionsArray; int section = getSectionForPosition(position); if (section == -1) { section = sortedUsersSectionsArray.size() - 1; } if (onlyUsers != 0 && !isAdmin) { if (section >= 0 && section < sortedUsersSectionsArray.size()) { return sortedUsersSectionsArray.get(section); } } else { if (section > 0 && section <= sortedUsersSectionsArray.size()) { return sortedUsersSectionsArray.get(section - 1); } } return null; }
Example #15
Source File: ChatAttachAlertContactsLayout.java From Telegram 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 #16
Source File: ChannelAdminLogActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private String getMessageContent(MessageObject messageObject, int previousUid, boolean name) { String str = ""; if (name) { if (previousUid != messageObject.messageOwner.from_id) { if (messageObject.messageOwner.from_id > 0) { TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(messageObject.messageOwner.from_id); if (user != null) { str = ContactsController.formatName(user.first_name, user.last_name) + ":\n"; } } else if (messageObject.messageOwner.from_id < 0) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-messageObject.messageOwner.from_id); if (chat != null) { str = chat.title + ":\n"; } } } } if (messageObject.type == 0 && messageObject.messageOwner.message != null) { str += messageObject.messageOwner.message; } else if (messageObject.messageOwner.media != null && messageObject.messageOwner.message != null) { str += messageObject.messageOwner.message; } else { str += messageObject.messageText; } return str; }
Example #17
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 #18
Source File: ContactsAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public int getSectionCount() { ArrayList<String> sortedUsersSectionsArray = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).sortedUsersMutualSectionsArray : ContactsController.getInstance(currentAccount).sortedUsersSectionsArray; int count = sortedUsersSectionsArray.size(); if (onlyUsers == 0) { count++; } if (isAdmin) { count++; } if (needPhonebook) { count++; } return count; }
Example #19
Source File: DrawerUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void setAccount(int account) { accountNumber = account; TLRPC.User user = UserConfig.getInstance(accountNumber).getCurrentUser(); if (user == null) { return; } avatarDrawable.setInfo(user); textView.setText(ContactsController.formatName(user.first_name, user.last_name)); TLRPC.FileLocation avatar; if (user.photo != null && user.photo.photo_small != null && user.photo.photo_small.volume_id != 0 && user.photo.photo_small.local_id != 0) { avatar = user.photo.photo_small; } else { avatar = null; } imageView.getImageReceiver().setCurrentAccount(account); imageView.setImage(avatar, "50_50", avatarDrawable); checkBox.setVisibility(account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE); }
Example #20
Source File: InviteUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void update(int mask) { if (currentContact == null) { return; } String newName = null; avatarDrawable.setInfo(currentContact.contact_id, currentContact.first_name, currentContact.last_name, false); if (currentName != null) { nameTextView.setText(currentName, true); } else { nameTextView.setText(ContactsController.formatName(currentContact.first_name, currentContact.last_name)); } statusTextView.setTag(Theme.key_groupcreate_offlineText); statusTextView.setTextColor(Theme.getColor(Theme.key_groupcreate_offlineText)); if (currentContact.imported > 0) { statusTextView.setText(LocaleController.formatPluralString("TelegramContacts", currentContact.imported)); } else { statusTextView.setText(currentContact.phones.get(0)); } avatarImageView.setImageDrawable(avatarDrawable); }
Example #21
Source File: ChatAttachAlertContactsLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public Object getItem(int section, int position) { if (section == 0) { return null; } section--; HashMap<String, ArrayList<Object>> usersSectionsDict = ContactsController.getInstance(currentAccount).phoneBookSectionsDict; ArrayList<String> sortedUsersSectionsArray = ContactsController.getInstance(currentAccount).phoneBookSectionsArray; if (section < sortedUsersSectionsArray.size()) { ArrayList<Object> arr = usersSectionsDict.get(sortedUsersSectionsArray.get(section)); if (position < arr.size()) { return arr.get(position); } } return null; }
Example #22
Source File: PrivacyControlActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
public PrivacyControlActivity(int type, boolean load) { super(); rulesType = type; if (load) { ContactsController.getInstance(currentAccount).loadPrivacySettings(); } }
Example #23
Source File: ShareDialogCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void setDialog(int uid, boolean checked, CharSequence name) { if (uid > 0) { user = MessagesController.getInstance(currentAccount).getUser(uid); avatarDrawable.setInfo(user); if (UserObject.isUserSelf(user)) { nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages)); avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED); imageView.setImage(null, null, avatarDrawable, user); } else { if (name != null) { nameTextView.setText(name); } else if (user != null) { nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name)); } else { nameTextView.setText(""); } imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user); } } else { user = null; TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-uid); if (name != null) { nameTextView.setText(name); } else if (chat != null) { nameTextView.setText(chat.title); } else { nameTextView.setText(""); } avatarDrawable.setInfo(chat); imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat); } checkBox.setChecked(checked, false); }
Example #24
Source File: PhonebookAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public Object getItem(int section, int position) { HashMap<String, ArrayList<Object>> usersSectionsDict = ContactsController.getInstance(currentAccount).phoneBookSectionsDict; ArrayList<String> sortedUsersSectionsArray = ContactsController.getInstance(currentAccount).phoneBookSectionsArray; if (section < sortedUsersSectionsArray.size()) { ArrayList<Object> arr = usersSectionsDict.get(sortedUsersSectionsArray.get(section)); if (position < arr.size()) { return arr.get(position); } } return null; }
Example #25
Source File: CheckBoxUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setUser(TLRPC.User user, boolean checked, boolean divider) { currentUser = user; textView.setText(ContactsController.formatName(user.first_name, user.last_name)); checkBox.setChecked(checked, false); TLRPC.FileLocation photo = null; avatarDrawable.setInfo(user); if (user != null && user.photo != null) { photo = user.photo.photo_small; } imageView.setImage(photo, "50_50", avatarDrawable); needDivider = divider; setWillNotDraw(!divider); }
Example #26
Source File: VoIPHelper.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public static void startCall(TLRPC.User user, final Activity activity, TLRPC.TL_userFull userFull){ if(userFull!=null && userFull.phone_calls_private){ new AlertDialog.Builder(activity) .setTitle(LocaleController.getString("VoipFailed", R.string.VoipFailed)) .setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("CallNotAvailable", R.string.CallNotAvailable, ContactsController.formatName(user.first_name, user.last_name)))) .setPositiveButton(LocaleController.getString("OK", R.string.OK), null) .show(); return; } if (ConnectionsManager.getInstance(UserConfig.selectedAccount).getConnectionState() != ConnectionsManager.ConnectionStateConnected) { boolean isAirplaneMode = Settings.System.getInt(activity.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; AlertDialog.Builder bldr = new AlertDialog.Builder(activity) .setTitle(isAirplaneMode ? LocaleController.getString("VoipOfflineAirplaneTitle", R.string.VoipOfflineAirplaneTitle) : LocaleController.getString("VoipOfflineTitle", R.string.VoipOfflineTitle)) .setMessage(isAirplaneMode ? LocaleController.getString("VoipOfflineAirplane", R.string.VoipOfflineAirplane) : LocaleController.getString("VoipOffline", R.string.VoipOffline)) .setPositiveButton(LocaleController.getString("OK", R.string.OK), null); if (isAirplaneMode) { final Intent settingsIntent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS); if (settingsIntent.resolveActivity(activity.getPackageManager()) != null) { bldr.setNeutralButton(LocaleController.getString("VoipOfflineOpenSettings", R.string.VoipOfflineOpenSettings), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { activity.startActivity(settingsIntent); } }); } } bldr.show(); return; } if (Build.VERSION.SDK_INT >= 23 && activity.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { activity.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, 101); } else { initiateCall(user, activity); } }
Example #27
Source File: InviteContactsActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public boolean onFragmentCreate() { NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.contactsImported); fetchContacts(); if (!UserConfig.getInstance(currentAccount).contactsReimported) { ContactsController.getInstance(currentAccount).forceImportContacts(); UserConfig.getInstance(currentAccount).contactsReimported = true; UserConfig.getInstance(currentAccount).saveConfig(false); } return super.onFragmentCreate(); }
Example #28
Source File: AccountSelectCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void setAccount(int account, boolean check) { accountNumber = account; TLRPC.User user = UserConfig.getInstance(accountNumber).getCurrentUser(); avatarDrawable.setInfo(user); textView.setText(ContactsController.formatName(user.first_name, user.last_name)); imageView.getImageReceiver().setCurrentAccount(account); imageView.setImage(ImageLocation.getForUser(user,false), "50_50", avatarDrawable, user); checkImageView.setVisibility(check && account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE); }
Example #29
Source File: DialogsAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public int getItemCount() { showContacts = false; ArrayList<TLRPC.TL_dialog> array = getDialogsArray(); int dialogsCount = array.size(); if (dialogsCount == 0 && MessagesController.getInstance(currentAccount).loadingDialogs) { return 0; } int count = dialogsCount; if (!MessagesController.getInstance(currentAccount).dialogsEndReached || dialogsCount == 0) { count++; } if (hasHints) { count += 2 + MessagesController.getInstance(currentAccount).hintDialogs.size(); } else if (dialogsType == MessagesController.DialogType.All && dialogsCount == 0) { if (ContactsController.getInstance(currentAccount).contacts.isEmpty() && ContactsController.getInstance(currentAccount).isLoadingContacts()) { return 0; } if (!ContactsController.getInstance(currentAccount).contacts.isEmpty()) { count += ContactsController.getInstance(currentAccount).contacts.size() + 2; showContacts = true; } } currentCount = count; return count; }
Example #30
Source File: AccountSelectCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void setAccount(int account, boolean check) { accountNumber = account; TLRPC.User user = UserConfig.getInstance(accountNumber).getCurrentUser(); avatarDrawable.setInfo(user); textView.setText(ContactsController.formatName(user.first_name, user.last_name)); imageView.getImageReceiver().setCurrentAccount(account); imageView.setImage(ImageLocation.getForUser(user,false), "50_50", avatarDrawable, user); checkImageView.setVisibility(check && account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE); }