use of com.xabber.android.data.SettingsManager.ChatsShowStatusChange in project xabber-android by redsolution.
the class MessageManager method onSettingsChanged.
/**
* Called on action settings change.
*/
public void onSettingsChanged() {
ChatsShowStatusChange showStatusChange = SettingsManager.chatsShowStatusChange();
Collection<BaseEntity> changedEntities = new ArrayList<>();
for (AbstractChat chat : chats.values()) {
if ((chat instanceof RegularChat && showStatusChange != ChatsShowStatusChange.always) || (chat instanceof RoomChat && showStatusChange == ChatsShowStatusChange.never)) {
// Remove actions with status change.
ArrayList<MessageItem> remove = new ArrayList<>();
for (MessageItem messageItem : chat.getMessages()) {
if (messageItem.getAction() != null && messageItem.getAction().isStatusChage()) {
remove.add(messageItem);
}
}
if (remove.isEmpty()) {
continue;
}
for (MessageItem messageItem : remove) {
chat.removeMessage(messageItem);
}
changedEntities.add(chat);
}
}
RosterManager.getInstance().onContactsChanged(changedEntities);
}
Aggregations