diff options
author | Daniel Sandler <dsandler@android.com> | 2012-03-30 16:38:09 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2012-03-30 16:38:38 -0400 |
commit | a4038f6dabd4c6389a4b02ca10c06b63cfe848a2 (patch) | |
tree | 29c57675e1389497c9b5e287ed23da573b000204 /NotificationShowcase/src | |
parent | 312907aca51db48999a6dd88eb7f4b0e07d8f6a3 (diff) | |
download | experimental-a4038f6dabd4c6389a4b02ca10c06b63cfe848a2.tar.gz |
Testing Actions.
Change-Id: I365d635012754d5cd01b96d7cf8a07f6e7111702
Diffstat (limited to 'NotificationShowcase/src')
-rw-r--r-- | NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java index 88ce645..d54f05e 100644 --- a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java +++ b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java @@ -50,6 +50,14 @@ public class NotificationShowcaseActivity extends Activity { return b; } + private PendingIntent makeToastIntent(String s) { + Intent toastIntent = new Intent(this, ToastFeedbackActivity.class); + toastIntent.putExtra("text", s); + PendingIntent pi = PendingIntent.getActivity( + this, 0, toastIntent, PendingIntent.FLAG_CANCEL_CURRENT); + return pi; + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -94,11 +102,6 @@ public class NotificationShowcaseActivity extends Activity { .setSmallIcon(R.drawable.stat_notify_talk_text)) .bigText(longSmsText) .build()); - - Intent toastIntent = new Intent(this, ToastFeedbackActivity.class); - toastIntent.putExtra("text", "Clicked on Matias"); - PendingIntent contentIntent = PendingIntent.getActivity( - this, 0, toastIntent, PendingIntent.FLAG_CANCEL_CURRENT); mNotifications.add(new Notification.Builder(this) .setContentTitle("Incoming call") @@ -106,9 +109,9 @@ public class NotificationShowcaseActivity extends Activity { .setLargeIcon(getBitmap(R.drawable.matias_hed)) .setSmallIcon(R.drawable.stat_sys_phone_call) .setPriority(Notification.PRIORITY_MAX) - .setContentIntent(contentIntent) - .addAction(R.drawable.ic_dial_action_call, "Answer", null) - .addAction(R.drawable.ic_end_call, "Ignore", null) + .setContentIntent(makeToastIntent("Clicked on Matias")) + .addAction(R.drawable.ic_dial_action_call, "Answer", makeToastIntent("call answered")) + .addAction(R.drawable.ic_end_call, "Ignore", makeToastIntent("call ignored")) .setUsesIntruderAlert(true) .setIntruderActionsShowText(true) .setAutoCancel(true) @@ -132,7 +135,9 @@ public class NotificationShowcaseActivity extends Activity { + "and I was finally able to see what my new camera feels like when shooting " + "landscapes.") .setSmallIcon(R.drawable.ic_stat_gplus) - .setLargeIcon(getBitmap(R.drawable.romainguy_hed))) + .setLargeIcon(getBitmap(R.drawable.romainguy_hed)) + .addAction(R.drawable.add, "Add to Gallery", makeToastIntent("added! (just kidding)")) + ) .bigPicture(d.getBitmap()) .build()); |