Fix show number of unread messages when >0
@@ -49,7 +49,6 @@ public class DefaultTabHandler extends SparkTabHandler {
boolean isTyping = SparkManager.getChatManager().containsTypingNotification((ChatRoom) component);
-
// Check if is typing.
if (isTyping) {
tab.setIcon(SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_EDIT_IMAGE));
@@ -66,23 +65,20 @@ public class DefaultTabHandler extends SparkTabHandler {
}
if (!chatFrameFocused || !isSelectedTab) {
- if (room.getUnreadMessageCount() > 0) {
+ // Handle unread message count.
+ int unreadMessageCount = room.getUnreadMessageCount();
+
+ if (unreadMessageCount > 0) {
// Make tab red.
tab.setTitleColor((Color) UIManager.get("Chat.unreadMessageColor"));
tab.setTabBold(true);
tab.setShowUnreadMessageIcon(true, SparkManager.getChatManager().getChatContainer().getTotalNumberOfUnreadMessages());
- }
-
- // Handle unread message count.
- int unreadMessageCount = room.getUnreadMessageCount();
String appendedMessage = "";
- if (unreadMessageCount > 1) {
appendedMessage = " (" + unreadMessageCount + ")";
- }
tab.setTabTitle(room.getTabTitle() + appendedMessage);
}
-
+ }
if (chatFrameFocused && isSelectedTab) {
tab.setTitleColor(Color.black);
