aboutsummaryrefslogtreecommitdiff
path: root/NotificationShowcase/src
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-04-19 16:05:31 -0400
committerDaniel Sandler <dsandler@android.com>2012-04-19 16:05:31 -0400
commit2c223ee3c280612fcf4d9536b94ad08c9f5f7431 (patch)
treede54b0289602a99a8332874a978c694091880082 /NotificationShowcase/src
parent1aeccc4004e4c86e33df614a36cd394d2d532d8c (diff)
downloadexperimental-2c223ee3c280612fcf4d9536b94ad08c9f5f7431.tar.gz
Testing actions a little more.
Change-Id: Ia7088a04b96dfa10550f98c85a0458ced9878817
Diffstat (limited to 'NotificationShowcase/src')
-rw-r--r--NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java44
1 files changed, 32 insertions, 12 deletions
diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java
index e8a2af8..fa7f50f 100644
--- a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java
+++ b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java
@@ -15,27 +15,38 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Bundle;
+import android.util.Log;
import android.view.View;
import android.widget.Toast;
public class NotificationShowcaseActivity extends Activity {
- public static class ToastFeedbackActivity extends Activity {
- @Override
- public void onStart() {
- Intent i = getIntent();
- if (i.hasExtra("text")) {
- final String text = i.getStringExtra("text");
- Toast.makeText(this, text, Toast.LENGTH_LONG).show();
- }
- finish();
- }
- }
+ private static final String TAG = "NotificationShowcase";
private static final int NOTIFICATION_ID = 31338;
private static final boolean FIRE_AND_FORGET = true;
+ public static class ToastFeedbackActivity extends Activity {
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ Intent i = getIntent();
+ Log.v(TAG, "clicked a thing! intent=" + i.toString());
+ if (i.hasExtra("text")) {
+ final String text = i.getStringExtra("text");
+ Toast.makeText(this, text, Toast.LENGTH_LONG).show();
+ }
+ finish();
+ }
+ }
+
private ArrayList<Notification> mNotifications = new ArrayList<Notification>();
NotificationManager mNoMa;
@@ -52,12 +63,20 @@ public class NotificationShowcaseActivity extends Activity {
private PendingIntent makeToastIntent(String s) {
Intent toastIntent = new Intent(this, ToastFeedbackActivity.class);
+ toastIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
toastIntent.putExtra("text", s);
PendingIntent pi = PendingIntent.getActivity(
- this, 0, toastIntent, PendingIntent.FLAG_CANCEL_CURRENT);
+ this, 58, toastIntent, PendingIntent.FLAG_CANCEL_CURRENT);
return pi;
}
+ private PendingIntent makeEmailIntent(String who) {
+ final Intent intent = new Intent(android.content.Intent.ACTION_SENDTO, Uri.parse("mailto:" + who));
+ return PendingIntent.getActivity(
+ this, 0, intent,
+ PendingIntent.FLAG_CANCEL_CURRENT);
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -99,6 +118,7 @@ public class NotificationShowcaseActivity extends Activity {
.setTicker("Mike Cleron: " + longSmsText)
.setLargeIcon(getBitmap(R.drawable.bucket))
.setPriority(Notification.PRIORITY_HIGH)
+ .addAction(R.drawable.stat_notify_email, "Email mcleron@test.com", makeEmailIntent("mcleron@test.com"))
.setSmallIcon(R.drawable.stat_notify_talk_text))
.bigText(longSmsText)
.build());