diff options
author | Joe Onorato <joeo@google.com> | 2010-09-17 18:38:38 -0400 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-09-20 14:14:02 -0400 |
commit | ef1e7763c2dc5b9bac69cc747efe05c81d9fd9fc (patch) | |
tree | f528a7580bee46ead66e3d5153abb268a22075d6 /tests | |
parent | 4200dcaa7bd8b4efb6b88114dba8b93e6181c252 (diff) | |
download | frameworks_base-ef1e7763c2dc5b9bac69cc747efe05c81d9fd9fc.zip frameworks_base-ef1e7763c2dc5b9bac69cc747efe05c81d9fd9fc.tar.gz frameworks_base-ef1e7763c2dc5b9bac69cc747efe05c81d9fd9fc.tar.bz2 |
Tablet ticker.
Change-Id: Ia3db5cc29eac1703123de3e1c6dc7c22e7d024eb
Diffstat (limited to 'tests')
-rw-r--r-- | tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java | 119 |
1 files changed, 116 insertions, 3 deletions
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java index 16b3001..7b6e2d2 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java @@ -16,12 +16,14 @@ package com.android.statusbartest; +import android.app.Notification; +import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.ContentResolver; import android.content.Intent; -import android.app.Notification; -import android.app.NotificationManager; +import android.graphics.Bitmap; +import android.graphics.drawable.BitmapDrawable; import android.os.Environment; import android.os.Vibrator; import android.os.Handler; @@ -77,6 +79,112 @@ public class NotificationTestList extends TestActivity } }, + new Test("Cancel #1") { + public void run() + { + mNM.cancel(1); + } + }, + + new Test("Ticker 1 line") { + public void run() { + Notification n = new Notification(R.drawable.icon1, "tick tick tick", + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + mNM.notify(1, n); + } + }, + + new Test("Ticker 1 line & icon") { + public void run() { + Notification n = new Notification(R.drawable.icon1, "tick tick tick", + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + n.tickerIcons = new Bitmap[1]; + n.tickerIcons[0] = loadBitmap(R.drawable.icon3); + mNM.notify(1, n); + } + }, + + new Test("Ticker 2 lines") { + public void run() { + Notification n = new Notification(R.drawable.icon1, "tick tick tick\ntock tock", + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + mNM.notify(1, n); + } + }, + + new Test("Ticker title") { + public void run() { + Notification n = new Notification(R.drawable.icon1, null, + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + n.tickerTitle = "This is a title"; + mNM.notify(1, n); + } + }, + + new Test("Ticker subtitle") { + public void run() { + Notification n = new Notification(R.drawable.icon1, null, + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + n.tickerSubtitle = "and a subtitle"; + mNM.notify(1, n); + } + }, + + new Test("Ticker title & subtitle") { + public void run() { + Notification n = new Notification(R.drawable.icon1, null, + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + n.tickerTitle = "This is a title it is really really longggggg long long long long"; + n.tickerSubtitle = "and a subtitle it is really really longggggg long long long long long long long long long long long long long long long long"; + mNM.notify(1, n); + } + }, + + new Test("Ticker text, title & subtitle") { + public void run() { + Notification n = new Notification(R.drawable.icon1, "not visible", + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + n.tickerTitle = "This is a title"; + n.tickerSubtitle = "and a subtitle"; + mNM.notify(1, n); + } + }, + + new Test("Ticker title, subtitle & 2 icons") { + public void run() { + Notification n = new Notification(R.drawable.icon1, null, + mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is a notification!!!", makeIntent()); + n.tickerTitle = "This is a title"; + n.tickerSubtitle = "and a subtitle"; + + n.tickerIcons = new Bitmap[2]; + n.tickerIcons[0] = loadBitmap(R.drawable.icon3); + n.tickerIcons[1] = loadBitmap(R.drawable.app_gmail); + + mNM.notify(1, n); + /* + n.tickerIcons[0].recycle(); + n.tickerIcons[1].recycle(); + */ + } + }, + new Test("No view") { public void run() { Notification n = new Notification(R.drawable.icon1, "No view", @@ -479,7 +587,7 @@ public class NotificationTestList extends TestActivity new Test("Persistent #3") { public void run() { - Notification n = new Notification(R.drawable.icon2, "tock tock tock", + Notification n = new Notification(R.drawable.icon2, "tock tock tock\nmooooo", System.currentTimeMillis()); n.setLatestEventInfo(NotificationTestList.this, "Persistent #3", "Notify me!!!", makeIntent()); @@ -701,5 +809,10 @@ public class NotificationTestList extends TestActivity time, label, "" + new java.util.Date(time), null)); } + + Bitmap loadBitmap(int resId) { + BitmapDrawable bd = (BitmapDrawable)getResources().getDrawable(resId); + return Bitmap.createBitmap(bd.getBitmap()); + } } |