Skip to content

Commit

Permalink
New notification icons for c2dm and default astrid
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Su committed Jul 14, 2011
1 parent 06330e4 commit 2cf0de3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ private void handleMessage(Intent intent) {
PendingIntent pendingIntent = PendingIntent.getActivity(context,
notifId, notifyIntent, 0);

int icon = calculateIcon(intent);

// create notification
NotificationManager nm = new AndroidNotificationManager(ContextManager.getContext());
Notification notification = new Notification(R.drawable.notif_pink_alarm,
Notification notification = new Notification(icon,
message, System.currentTimeMillis());
String title;
if(intent.hasExtra("title"))
Expand All @@ -194,6 +196,27 @@ private void handleMessage(Intent intent) {
}
}

private int calculateIcon(Intent intent) {
if(intent.hasExtra("type")) {
String type = intent.getStringExtra("type");
if("f".equals(type))
return R.drawable.notif_c2dm_done;
if("s".equals(type))
return R.drawable.notif_c2dm_assign;
if("l".equals(type))
return R.drawable.notif_c2dm_assign;
} else {
String message = intent.getStringExtra("alert");
if(message.contains(" finished "))
return R.drawable.notif_c2dm_done;
if(message.contains(" invited you to "))
return R.drawable.notif_c2dm_assign;
if(message.contains(" sent you "))
return R.drawable.notif_c2dm_assign;
}
return R.drawable.notif_c2dm_msg;
}

private Intent createTaskIntent(Intent intent) {
TodorooCursor<Task> cursor = taskService.query(
Query.select(Task.PROPERTIES).where(Task.REMOTE_ID.eq(
Expand Down
Binary file modified astrid/res/drawable/notif_astrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added astrid/res/drawable/notif_c2dm_assign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added astrid/res/drawable/notif_c2dm_done.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added astrid/res/drawable/notif_c2dm_msg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2cf0de3

Please sign in to comment.