diff options
author | Daniel Sandler <dsandler@google.com> | 2010-11-30 12:03:59 -0500 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2010-11-30 15:32:55 -0500 |
commit | 373a9983742b3d2370c36183aca3cde4614e6185 (patch) | |
tree | 4582c14e6833fb227bb62b8d5941582b26eb0289 /tests/StatusBar | |
parent | fefc0743f8b0e8a936f0d138de20eca025ffe8c7 (diff) | |
download | frameworks_base-373a9983742b3d2370c36183aca3cde4614e6185.zip frameworks_base-373a9983742b3d2370c36183aca3cde4614e6185.tar.gz frameworks_base-373a9983742b3d2370c36183aca3cde4614e6185.tar.bz2 |
When updating notifications, always reuse the last row.
Ordinarily, changing the "when" slot when updating a
Notification will move its expanded payload to the bottom of
the notification panel's list. But if it's already at the
bottom, this causes an unsightly out-then-in animation
sequence. We now check for that exact situation.
Bug: 3222274
Bug: 3162218
Change-Id: I8b643b3f8bce64e57a22bdbb06d92c196c2484c2
Diffstat (limited to 'tests/StatusBar')
-rw-r--r-- | tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java index 0f0637f..90c2a1a 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java @@ -31,6 +31,8 @@ import android.util.Log; import android.net.Uri; import android.os.SystemClock; import android.widget.RemoteViews; +import android.widget.TextView; +import android.widget.ProgressBar; import android.os.PowerManager; public class NotificationTestList extends TestActivity @@ -44,6 +46,8 @@ public class NotificationTestList extends TestActivity long mActivityCreateTime = System.currentTimeMillis(); long mChronometerBase = 0; + boolean mProgressDone = true; + final int[] kNumberedIconResIDs = { R.drawable.notification0, R.drawable.notification1, @@ -289,6 +293,50 @@ public class NotificationTestList extends TestActivity } }, + new Test("Progress #1") { + public void run() { + final boolean PROGRESS_UPDATES_WHEN = true; + if (!mProgressDone) return; + mProgressDone = false; + Thread t = new Thread() { + public void run() { + int x = 0; + while (!mProgressDone) { + Notification n = new Notification(R.drawable.icon1, null, + PROGRESS_UPDATES_WHEN + ? System.currentTimeMillis() + : mActivityCreateTime); + RemoteViews v = new RemoteViews(getPackageName(), + R.layout.progress_notification); + + v.setProgressBar(R.id.progress_bar, 100, x, false); + v.setTextViewText(R.id.status_text, "Progress: " + x + "%"); + + n.contentView = v; + n.flags |= Notification.FLAG_ONGOING_EVENT; + + mNM.notify(500, n); + x = (x + 7) % 100; + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + break; + } + } + } + }; + t.start(); + } + }, + + new Test("Stop Progress") { + public void run() { + mProgressDone = true; + mNM.cancel(500); + } + }, + new Test("Blue Lights") { public void run() { |