Skip to content

Commit

Permalink
IRCService: Code cleanup and suppress warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo committed Jun 8, 2011
1 parent 2350e97 commit 14ed6f7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions application/src/org/yaaic/irc/IRCService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ public class IRCService extends Service
private final IRCBinder binder;
private final HashMap<Integer, IRCConnection> connections;
private boolean foreground = false;
private ArrayList<String> connectedServerTitles;
private LinkedHashMap<String, Conversation> mentions;
private final ArrayList<String> connectedServerTitles;
private final LinkedHashMap<String, Conversation> mentions;
private int newMentions = 0;

private static final int FOREGROUND_NOTIFICATION = 1;

@SuppressWarnings("rawtypes")
@SuppressWarnings("unchecked")
private static final Class[] mStartForegroundSignature = new Class[] { int.class, Notification.class };
@SuppressWarnings("rawtypes")
@SuppressWarnings("unchecked")
private static final Class[] mStopForegroundSignature = new Class[] { boolean.class };

public static final String ACTION_FOREGROUND = "org.yaaic.service.foreground";
Expand Down Expand Up @@ -263,8 +263,9 @@ public String getConversationId(int serverId, String title) {
*/
public synchronized void addNewMention(int serverId, Conversation conversation, String msg, boolean vibrate, boolean sound)
{
if (conversation == null)
if (conversation == null) {
return;
}

conversation.addNewMention();
++newMentions;
Expand All @@ -287,16 +288,19 @@ public synchronized void addNewMention(int serverId, Conversation conversation,
*/
public synchronized void ackNewMentions(int serverId, String convTitle)
{
if (convTitle == null)
if (convTitle == null) {
return;
}

Conversation conversation = mentions.remove(getConversationId(serverId, convTitle));
if (conversation == null)
if (conversation == null) {
return;
}
newMentions -= conversation.getNewMentions();
conversation.clearNewMentions();
if (newMentions < 0)
if (newMentions < 0) {
newMentions = 0;
}

updateNotification(null, null, false, false);
}
Expand Down

0 comments on commit 14ed6f7

Please sign in to comment.