diff options
author | Chris Wren <cwren@android.com> | 2013-08-08 16:48:48 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2013-08-22 10:45:31 -0400 |
commit | e03f4e1fae518cff08ffcf51a3435cefe4fed1c8 (patch) | |
tree | d77a0b272b0dcafeea9f5f3b628bbf6c5ca91d46 /packages/SystemUI | |
parent | 83208e34f6a0381d5627886dbf98ff8f313e590f (diff) | |
download | frameworks_base-e03f4e1fae518cff08ffcf51a3435cefe4fed1c8.zip frameworks_base-e03f4e1fae518cff08ffcf51a3435cefe4fed1c8.tar.gz frameworks_base-e03f4e1fae518cff08ffcf51a3435cefe4fed1c8.tar.bz2 |
handle updates to the notification in the heads up
Bug: 10226356
Change-Id: I5bc9aecc3849617092e863868a6df610c615048b
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 58 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 6 |
2 files changed, 37 insertions, 27 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 2786867..b8427f3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -437,7 +437,7 @@ public abstract class BaseStatusBar extends SystemUI implements } public void onHeadsUpDismissed() { - // pass + mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP); } @Override @@ -958,20 +958,20 @@ public abstract class BaseStatusBar extends SystemUI implements if (DEBUG) Log.d(TAG, "reusing notification for key: " + key); oldEntry.notification = notification; try { - // Reapply the RemoteViews - contentView.reapply(mContext, oldEntry.expanded, mOnClickHandler); - if (bigContentView != null && oldEntry.getBigContentView() != null) { - bigContentView.reapply(mContext, oldEntry.getBigContentView(), mOnClickHandler); - } - // update the contentIntent - final PendingIntent contentIntent = notification.getNotification().contentIntent; - if (contentIntent != null) { - final View.OnClickListener listener = makeClicker(contentIntent, - notification.getPackageName(), notification.getTag(), notification.getId()); - oldEntry.content.setOnClickListener(listener); - } else { - oldEntry.content.setOnClickListener(null); + updateNotificationViews(oldEntry, notification); + + if (ENABLE_HEADS_UP && mInterruptingNotificationEntry != null + && oldNotification == mInterruptingNotificationEntry.notification) { + if (!shouldInterrupt(notification)) { + if (DEBUG) Log.d(TAG, "no longer interrupts!"); + mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP); + } else { + if (DEBUG) Log.d(TAG, "updating the current heads up:" + notification); + mInterruptingNotificationEntry.notification = notification; + updateNotificationViews(mInterruptingNotificationEntry, notification); + } } + // Update the icon. final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(), notification.getUser(), @@ -997,7 +997,7 @@ public abstract class BaseStatusBar extends SystemUI implements if (DEBUG) Log.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top")); final boolean wasExpanded = oldEntry.row.isUserExpanded(); removeNotificationViews(key); - addNotificationViews(key, notification); + addNotificationViews(key, notification); // will also replace the heads up if (wasExpanded) { final NotificationData.Entry newEntry = mNotificationData.findByKey(key); newEntry.row.setExpanded(true); @@ -1022,17 +1022,25 @@ public abstract class BaseStatusBar extends SystemUI implements // Recalculate the position of the sliding windows and the titles. setAreThereNotifications(); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); + } - // See if we need to update the heads up. - if (ENABLE_HEADS_UP && mInterruptingNotificationEntry != null - && oldNotification == mInterruptingNotificationEntry.notification) { - if (DEBUG) Log.d(TAG, "updating the current heads up:" + notification); - // XXX: this is a hack for Alarms. The real implementation will need to *update* - // the heads up. - if (!shouldInterrupt(notification)) { - if (DEBUG) Log.d(TAG, "no longer interrupts!"); - mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP); - } + private void updateNotificationViews(NotificationData.Entry entry, + StatusBarNotification notification) { + final RemoteViews contentView = notification.getNotification().contentView; + final RemoteViews bigContentView = notification.getNotification().bigContentView; + // Reapply the RemoteViews + contentView.reapply(mContext, entry.expanded, mOnClickHandler); + if (bigContentView != null && entry.getBigContentView() != null) { + bigContentView.reapply(mContext, entry.getBigContentView(), mOnClickHandler); + } + // update the contentIntent + final PendingIntent contentIntent = notification.getNotification().contentIntent; + if (contentIntent != null) { + final View.OnClickListener listener = makeClicker(contentIntent, + notification.getPackageName(), notification.getTag(), notification.getId()); + entry.content.setOnClickListener(listener); + } else { + entry.content.setOnClickListener(null); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index b36bedd..6256721 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1319,12 +1319,10 @@ public class PhoneStatusBar extends BaseStatusBar { break; case MSG_HIDE_HEADS_UP: setHeadsUpVisibility(false); - mInterruptingNotificationEntry = null; break; case MSG_ESCALATE_HEADS_UP: escalateHeadsUp(); setHeadsUpVisibility(false); - mInterruptingNotificationEntry = null; break; } } @@ -2507,6 +2505,10 @@ public class PhoneStatusBar extends BaseStatusBar { if (!ENABLE_HEADS_UP) return; if (DEBUG) Log.v(TAG, (vis ? "showing" : "hiding") + " heads up window"); mHeadsUpNotificationView.setVisibility(vis ? View.VISIBLE : View.GONE); + if (!vis) { + if (DEBUG) Log.d(TAG, "setting heads up entry to null"); + mInterruptingNotificationEntry = null; + } } public void animateHeadsUp(boolean animateInto, float frac) { |