Пример #1
0
 @Subscribe
 public void conversationMarkedAsRead(ReadEvent event) {
   for (Conversation conversation : this.conversations) {
     if (conversation.getId().equals(event.getConversationId())) {
       this.conversations.remove(conversation);
       this.unreadCount--;
       break;
     }
   }
   if (this.conversations.size() == 1 && this.unreadCount > this.conversations.size()) {
     getUnreadConversations();
   }
 }
Пример #2
0
 private void checkConversations() {
   if (PreviewStateHolder.getInstance().getPreviewVisibility() != 0) {
     hideChathead();
   } else if (this.conversations.isEmpty()) {
     hideChathead();
   } else {
     Conversation conversation = (Conversation) this.conversations.get(0);
     String messageStyle = conversation.getLastPart().getMessageStyle();
     if (Part.ANNOUNCEMENT_MESSAGE_STYLE.equals(messageStyle)
         || Part.SMALL_ANNOUNCEMENT_MESSAGE_STYLE.equals(messageStyle)) {
       Intent intent = new Intent(this, MainActivity.class);
       intent.putExtra(Constants.CREATE_CONVERSATION, conversation);
       intent.addFlags(268435456);
       startActivity(intent);
     } else if (Part.CHAT_MESSAGE_STYLE.equals(messageStyle)) {
       updateChatHeadUI(conversation);
     }
   }
 }
Пример #3
0
 private void updateChatHeadUI(Conversation conversation) {
   boolean shouldFadeIn = this.rootView.getVisibility() != 0;
   AvatarUtils.createAvatar(
       conversation.getLastAdmin().getAvatar(), this.notificationAvatar, this);
   String lastAdminText = conversation.getLastAdminPart().getSummary();
   if (lastAdminText.isEmpty()) {
     this.notificationText.setText(C0901R.string.intercomsdk_image_attached);
   } else {
     this.notificationText.setText(lastAdminText);
   }
   this.indicatorText.setText(String.valueOf(this.unreadCount));
   showChathead();
   if (shouldFadeIn) {
     fadeInChatHead();
   }
   if (!this.currentlyDisplayedConversation.equals(conversation)) {
     animateTextBubble();
     playSound();
   }
   this.currentlyDisplayedConversation = conversation;
 }