diff options
author | Chris Wren <cwren@android.com> | 2012-05-04 11:55:16 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2012-05-04 15:25:15 -0400 |
commit | 4a583e8e66140034a37c3377388480c4bc7a4e6d (patch) | |
tree | 2ca2d1ae9706cc20c45a388ef5738168ea3263f9 | |
parent | 0544d9a78079b730b255888d5265e6be7e4e93a6 (diff) | |
download | experimental-4a583e8e66140034a37c3377388480c4bc7a4e6d.tar.gz |
Add an inbox exmaple to the showcase.android-cts-4.1_r1android-4.1.1_r4android-4.1.1_r3android-4.1.1_r2android-4.1.1_r1.1android-4.1.1_r1
Change-Id: Idd30a36ec2301f04a0e177179e337a474fc77e53
-rw-r--r-- | NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java | 27 |
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) |