private void onLoaded(
     Collection<SavedStatus> savedStatuses, Collection<AccountItem> accountItems) {
   this.savedStatuses.addAll(savedStatuses);
   for (AccountItem accountItem : accountItems) addAccount(accountItem);
   NotificationManager.getInstance().registerNotificationProvider(authorizationErrorProvider);
   NotificationManager.getInstance().registerNotificationProvider(passwordRequestProvider);
 }
 private void onLoaded(Collection<RoomChat> roomChats, Collection<RoomChat> needJoins) {
   for (RoomChat roomChat : roomChats) {
     AbstractChat abstractChat =
         MessageManager.getInstance().getChat(roomChat.getAccount(), roomChat.getUser());
     if (abstractChat != null) MessageManager.getInstance().removeChat(abstractChat);
     MessageManager.getInstance().addChat(roomChat);
     if (needJoins.contains(roomChat)) roomChat.setState(RoomState.waiting);
   }
   NotificationManager.getInstance().registerNotificationProvider(inviteProvider);
   NotificationManager.getInstance().registerNotificationProvider(authorizationErrorProvider);
 }
 private void closeAllChats() {
   for (AbstractChat chat : MessageManager.getInstance().getActiveChats()) {
     MessageManager.getInstance().closeChat(chat.getAccount(), chat.getUser());
     NotificationManager.getInstance()
         .removeMessageNotification(chat.getAccount(), chat.getUser());
   }
   getContactListFragment().getAdapter().onChange();
 }
 private void closeChat(String account, String user) {
   MessageManager.getInstance().closeChat(account, user);
   NotificationManager.getInstance().removeMessageNotification(account, user);
   listener.onCloseChat();
 }
 public void changeForeground() {
   if (SettingsManager.eventsPersistent() && Application.getInstance().isInitialized())
     startForegroundWrapper(NotificationManager.getInstance().getPersistentNotification());
   else stopForegroundWrapper();
 }