private void updateSubtitle() { if (actionBar == null) { return; } if (currentChat != null || currentUser == null) { return; } if (currentUser.id / 1000 != 777 && currentUser.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(currentUser.id) == null && (ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts())) { if (currentUser.phone != null && currentUser.phone.length() != 0) { nameTextView.setText(PhoneFormat.getInstance().format("+" + currentUser.phone)); } else { nameTextView.setText( ContactsController.formatName(currentUser.first_name, currentUser.last_name)); } } else { nameTextView.setText( ContactsController.formatName(currentUser.first_name, currentUser.last_name)); } CharSequence printString = MessagesController.getInstance().printingStrings.get(currentMessageObject.getDialogId()); if (printString == null || printString.length() == 0) { lastPrintString = null; setTypingAnimation(false); TLRPC.User user = MessagesController.getInstance().getUser(currentUser.id); if (user != null) { currentUser = user; } onlineTextView.setText(LocaleController.formatUserStatus(currentUser)); } else { lastPrintString = printString; onlineTextView.setText(printString); setTypingAnimation(true); } }
@Override public View getItemView(int section, int position, View convertView, ViewGroup parent) { TLRPC.User user; int size; if (searchWas && searching) { user = MessagesController.getInstance().getUser(searchResult.get(position).id); size = searchResult.size(); } else { ArrayList<TLRPC.TL_contact> arr = ContactsController.getInstance() .usersSectionsDict .get(ContactsController.getInstance().sortedUsersSectionsArray.get(section)); user = MessagesController.getInstance().getUser(arr.get(position).user_id); size = arr.size(); } if (convertView == null) { LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = li.inflate(R.layout.group_create_row_layout, parent, false); } ContactListRowHolder holder = (ContactListRowHolder) convertView.getTag(); if (holder == null) { holder = new ContactListRowHolder(convertView); convertView.setTag(holder); } ImageView checkButton = (ImageView) convertView.findViewById(R.id.settings_row_check_button); if (selectedContacts.containsKey(user.id)) { checkButton.setImageResource(R.drawable.btn_check_on_holo_light); } else { checkButton.setImageResource(R.drawable.btn_check_off_holo_light); } View divider = convertView.findViewById(R.id.settings_row_divider); if (position == size - 1) { divider.setVisibility(View.INVISIBLE); } else { divider.setVisibility(View.VISIBLE); } if (searchWas && searching) { holder.nameTextView.setText(searchResultNames.get(position)); } else { String name = ContactsController.formatName(user.first_name, user.last_name); if (name.length() == 0) { if (user.phone != null && user.phone.length() != 0) { name = PhoneFormat.getInstance().format("+" + user.phone); } else { name = LocaleController.getString("HiddenName", R.string.HiddenName); } } holder.nameTextView.setText(name); } TLRPC.FileLocation photo = null; if (user.photo != null) { photo = user.photo.photo_small; } int placeHolderId = AndroidUtilities.getUserAvatarForId(user.id); holder.avatarImage.setImage(photo, "50_50", placeHolderId); holder.messageTextView.setText(LocaleController.formatUserStatus(user)); if (user.status != null && user.status.expires > ConnectionsManager.getInstance().getCurrentTime()) { holder.messageTextView.setTextColor(0xff357aa8); } else { holder.messageTextView.setTextColor(0xff808080); } return convertView; }