Пример #1
0
 private boolean containsSelf(Chat chat) {
   for (Contact c : chat.getReceivers()) {
     if (c.getNetworkingId().equals(self.getNetworkingId())) {
       return true;
     }
   }
   return false;
 }
Пример #2
0
 @Override
 public void receivedUpdate(Chat chat) {
   if (!containsSelf(chat)) {
     return;
   }
   if (!chat.isGroupChat()) {
     Chat oldChat = chatHelper.getChat(chat.getNetworkChatID());
     if (oldChat == null) {
       Contact self = contactHelper.getSelf();
       for (Contact c : chat.getReceivers()) {
         if (!c.getNetworkingId().equals(self.getNetworkingId())) {
           chat.setTitle(c.getName(context));
         }
       }
     } else {
       chat.setTitle(oldChat.getTitle());
     }
   }
   chatHelper.update(chat);
 }