aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/org/connectbot/service
diff options
context:
space:
mode:
authorJeremy Klein <jlklein@google.com>2015-07-15 17:24:06 -0700
committerJeremy Klein <jlklein@google.com>2015-07-15 17:24:06 -0700
commit8b52ad7be7ce68e7b0050a78e46bfc749db14276 (patch)
treefe3be2ed7a01de677ea4fa952e1e10fe0a428dd1 /app/src/main/java/org/connectbot/service
parentcabd426608f2c6776ecd1ef2ac0053dcc352adbc (diff)
downloadconnectbot-8b52ad7be7ce68e7b0050a78e46bfc749db14276.tar.gz
connectbot-8b52ad7be7ce68e7b0050a78e46bfc749db14276.tar.bz2
connectbot-8b52ad7be7ce68e7b0050a78e46bfc749db14276.zip
Address review comments.
Diffstat (limited to 'app/src/main/java/org/connectbot/service')
-rw-r--r--app/src/main/java/org/connectbot/service/ConnectionNotifier.java35
1 files changed, 17 insertions, 18 deletions
diff --git a/app/src/main/java/org/connectbot/service/ConnectionNotifier.java b/app/src/main/java/org/connectbot/service/ConnectionNotifier.java
index 3d3bf71..c480143 100644
--- a/app/src/main/java/org/connectbot/service/ConnectionNotifier.java
+++ b/app/src/main/java/org/connectbot/service/ConnectionNotifier.java
@@ -44,7 +44,6 @@ import android.support.v4.app.NotificationCompat;
*/
public abstract class ConnectionNotifier {
private static final int ONLINE_NOTIFICATION = 1;
- private static final int ONLINE_NOTIFICATION_DISCONNECT = 1;
private static final int ACTIVITY_NOTIFICATION = 2;
public static ConnectionNotifier getInstance() {
@@ -58,7 +57,7 @@ public abstract class ConnectionNotifier {
return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
}
- protected NotificationCompat.Builder newNotificationBuilder(Context context) {
+ protected NotificationCompat.Builder newNotificationBuilder(Context context) {
NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.notification_icon)
@@ -68,7 +67,7 @@ public abstract class ConnectionNotifier {
}
protected Notification newActivityNotification(Context context, HostBean host) {
- NotificationCompat.Builder notification = newNotificationBuilder(context);
+ NotificationCompat.Builder builder = newNotificationBuilder(context);
Resources res = context.getResources();
@@ -82,42 +81,42 @@ public abstract class ConnectionNotifier {
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
notificationIntent, 0);
- notification.setContentTitle(res.getString(R.string.app_name))
+ builder.setContentTitle(res.getString(R.string.app_name))
.setContentText(contentText)
.setContentIntent(contentIntent);
- notification.setAutoCancel(true);
+ builder.setAutoCancel(true);
int ledOnMS = 300;
int ledOffMS = 1000;
- notification.setDefaults(Notification.DEFAULT_LIGHTS);
+ builder.setDefaults(Notification.DEFAULT_LIGHTS);
if (HostDatabase.COLOR_RED.equals(host.getColor()))
- notification.setLights(Color.RED, ledOnMS, ledOffMS);
+ builder.setLights(Color.RED, ledOnMS, ledOffMS);
else if (HostDatabase.COLOR_GREEN.equals(host.getColor()))
- notification.setLights(Color.GREEN, ledOnMS, ledOffMS);
+ builder.setLights(Color.GREEN, ledOnMS, ledOffMS);
else if (HostDatabase.COLOR_BLUE.equals(host.getColor()))
- notification.setLights(Color.BLUE, ledOnMS, ledOffMS);
+ builder.setLights(Color.BLUE, ledOnMS, ledOffMS);
else
- notification.setLights(Color.WHITE, ledOnMS, ledOffMS);
+ builder.setLights(Color.WHITE, ledOnMS, ledOffMS);
- return notification.build();
+ return builder.build();
}
protected Notification newRunningNotification(Context context) {
- NotificationCompat.Builder notification = newNotificationBuilder(context);
+ NotificationCompat.Builder builder = newNotificationBuilder(context);
- notification.setOngoing(true);
- notification.setWhen(0);
+ builder.setOngoing(true);
+ builder.setWhen(0);
- notification.setContentIntent(PendingIntent.getActivity(context,
+ builder.setContentIntent(PendingIntent.getActivity(context,
ONLINE_NOTIFICATION,
new Intent(context, ConsoleActivity.class), 0));
Resources res = context.getResources();
- notification.setContentTitle(res.getString(R.string.app_name));
- notification.setContentText(res.getString(R.string.app_is_running));
+ builder.setContentTitle(res.getString(R.string.app_name));
+ builder.setContentText(res.getString(R.string.app_is_running));
- return notification.build();
+ return builder.build();
}
public void showActivityNotification(Service context, HostBean host) {