private void updateInterfaceForCurrentMessage(int move) { if (actionBar == null) { return; } currentChat = null; currentUser = null; long dialog_id = currentMessageObject.getDialogId(); chatActivityEnterView.setDialogId(dialog_id); if ((int) dialog_id != 0) { int lower_id = (int) dialog_id; if (lower_id > 0) { currentUser = MessagesController.getInstance().getUser(lower_id); } else { currentChat = MessagesController.getInstance().getChat(-lower_id); currentUser = MessagesController.getInstance().getUser(currentMessageObject.messageOwner.from_id); } } else { TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance().getEncryptedChat((int) (dialog_id >> 32)); currentUser = MessagesController.getInstance().getUser(encryptedChat.user_id); } if (currentChat != null && currentUser != null) { nameTextView.setText(currentChat.title); onlineTextView.setText(UserObject.getUserName(currentUser)); nameTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); nameTextView.setCompoundDrawablePadding(0); } else if (currentUser != null) { nameTextView.setText(UserObject.getUserName(currentUser)); if ((int) dialog_id == 0) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lock_white, 0, 0, 0); nameTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4)); } else { nameTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); nameTextView.setCompoundDrawablePadding(0); } } prepareLayouts(move); updateSubtitle(); checkAndUpdateAvatar(); applyViewsLayoutParams(0); }
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(UserObject.getUserName(currentUser)); } } else { nameTextView.setText(UserObject.getUserName(currentUser)); } 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); } }