Skip to content

Commit

Permalink
IRCService: Extracting constants and reordering class members.
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo committed Oct 4, 2012
1 parent 89ff98b commit 35a8d93
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions application/src/org/yaaic/irc/IRCService.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@
*/
public class IRCService extends Service
{
private final IRCBinder binder;
private final HashMap<Integer, IRCConnection> connections;
private boolean foreground = false;
private final ArrayList<String> connectedServerTitles;
private final LinkedHashMap<String, Conversation> mentions;
private int newMentions = 0;
public static final String ACTION_FOREGROUND = "org.yaaic.service.foreground";
public static final String ACTION_BACKGROUND = "org.yaaic.service.background";
public static final String ACTION_ACK_NEW_MENTIONS = "org.yaaic.service.ack_new_mentions";
public static final String EXTRA_ACK_SERVERID = "org.yaaic.service.ack_serverid";
public static final String EXTRA_ACK_CONVTITLE = "org.yaaic.service.ack_convtitle";

private static final int FOREGROUND_NOTIFICATION = 1;
private static final int NOTIFICATION_LED_OFF_MS = 1000;
private static final int NOTIFICATION_LED_ON_MS = 300;
private static final int NOTIFICATION_LED_COLOR = 0xff00ff00;

@SuppressWarnings("rawtypes")
private static final Class[] mStartForegroundSignature = new Class[] { int.class, Notification.class };
Expand All @@ -74,11 +76,12 @@ public class IRCService extends Service
@SuppressWarnings("rawtypes")
private static final Class[] mSetForegroudSignaure = new Class[] { boolean.class };

public static final String ACTION_FOREGROUND = "org.yaaic.service.foreground";
public static final String ACTION_BACKGROUND = "org.yaaic.service.background";
public static final String ACTION_ACK_NEW_MENTIONS = "org.yaaic.service.ack_new_mentions";
public static final String EXTRA_ACK_SERVERID = "org.yaaic.service.ack_serverid";
public static final String EXTRA_ACK_CONVTITLE = "org.yaaic.service.ack_convtitle";
private final IRCBinder binder;
private final HashMap<Integer, IRCConnection> connections;
private boolean foreground = false;
private final ArrayList<String> connectedServerTitles;
private final LinkedHashMap<String, Conversation> mentions;
private int newMentions = 0;

private NotificationManager notificationManager;
private Method mStartForeground;
Expand Down Expand Up @@ -257,9 +260,9 @@ private void updateNotification(String text, String contentText, boolean vibrate
}

if (light) {
notification.ledARGB = 0xff00ff00;
notification.ledOnMS = 300;
notification.ledOffMS = 1000;
notification.ledARGB = NOTIFICATION_LED_COLOR;
notification.ledOnMS = NOTIFICATION_LED_ON_MS;
notification.ledOffMS = NOTIFICATION_LED_OFF_MS;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
}

Expand Down

0 comments on commit 35a8d93

Please sign in to comment.