From c83bb730ec0333e52990a40edf6d54bb66b1d5ba Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Tue, 19 Jan 2010 16:32:22 -0800 Subject: Add DateTimeView, a widget that shows a time or the date depending on the current time. Use that for notifications instead of a TextView that doesn't ever update. BUG 1563917 --- .../android/statusbartest/NotificationTestList.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/StatusBar') diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java index f2ddd0f..ffc2cbc 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java @@ -121,6 +121,20 @@ public class NotificationTestList extends TestActivity } }, + new Test("Times") { + public void run() + { + long now = System.currentTimeMillis(); + + timeNotification(7, "24 hours from now", now+(1000*60*60*24)); + timeNotification(6, "12:01:00 from now", now+(1000*60*60*12)+(60*1000)); + timeNotification(5, "12 hours from now", now+(1000*60*60*12)); + timeNotification(4, "now", now); + timeNotification(3, "11:59:00 ago", now-((1000*60*60*12)-(60*1000))); + timeNotification(2, "12 hours ago", now-(1000*60*60*12)); + timeNotification(1, "24 hours ago", now-(1000*60*60*24)); + } + }, new StateStress("Stress - Ongoing / Latest", 100, 100, new Runnable[] { new Runnable() { public void run() { @@ -590,5 +604,12 @@ public class NotificationTestList extends TestActivity mHandler.postDelayed(mRunnable, mPause); } } + + void timeNotification(int n, String label, long time) { + mNM.notify(n, new Notification(NotificationTestList.this, + R.drawable.ic_statusbar_missedcall, null, + time, label, "" + new java.util.Date(time), null)); + + } } -- cgit v1.1