aboutsummaryrefslogtreecommitdiff
path: root/NotificationShowcase/src
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2012-05-04 11:55:16 -0400
committerChris Wren <cwren@android.com>2012-05-04 15:25:15 -0400
commitd5fd6efee2f3ec2d9d4986f1b4d4842502111c7e (patch)
tree2ca2d1ae9706cc20c45a388ef5738168ea3263f9 /NotificationShowcase/src
parent2a44008cf0726322ccea418571b921da8ef38c8a (diff)
downloadexperimental-d5fd6efee2f3ec2d9d4986f1b4d4842502111c7e.tar.gz
Add an inbox exmaple to the showcase.
Change-Id: Idd30a36ec2301f04a0e177179e337a474fc77e53
Diffstat (limited to 'NotificationShowcase/src')
-rw-r--r--NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java
index bd6eb2d..5c3a60a 100644
--- a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java
+++ b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java
@@ -13,10 +13,13 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.text.SpannableString;
+import android.text.style.StyleSpan;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
@@ -165,16 +168,30 @@ public class NotificationShowcaseActivity extends Activity {
.setSmallIcon(R.drawable.ic_stat_gplus)
.setLargeIcon(getBitmap(R.drawable.romainguy_hed))
.addAction(R.drawable.add, "Add to Gallery", makeToastIntent("added! (just kidding)"))
+ .setSubText("talk rocks!")
)
.bigPicture(d.getBitmap())
.build());
// Note: this may conflict with real email notifications
- mNotifications.add(new Notification.Builder(this)
- .setContentTitle("24 new messages")
- .setContentText("test.hugo2@gmail.com")
- .setSmallIcon(R.drawable.stat_notify_email)
- .build());
+ StyleSpan bold = new StyleSpan(Typeface.BOLD);
+ SpannableString line1 = new SpannableString("Alice: hey there!");
+ line1.setSpan(bold, 0, 5, 0);
+ SpannableString line2 = new SpannableString("Bob: hi there!");
+ line2.setSpan(bold, 0, 3, 0);
+ SpannableString line3 = new SpannableString("Charlie: Iz IN UR EMAILZ!!");
+ line3.setSpan(bold, 0, 7, 0);
+ mNotifications.add(new Notification.InboxStyle(
+ new Notification.Builder(this)
+ .setContentTitle("24 new messages")
+ .setContentText("You have mail!")
+ .setSubText("test.hugo2@gmail.com")
+ .setSmallIcon(R.drawable.stat_notify_email))
+ .setSummaryText("+21 more")
+ .addLine(line1)
+ .addLine(line2)
+ .addLine(line3)
+ .build());
// No idea what this would really look like since the app is in flux
mNotifications.add(new Notification.Builder(this)