handle updates to the notification in the heads up
Bug: 10226356 Change-Id: I5bc9aecc3849617092e863868a6df610c615048b
This commit is contained in:
@@ -437,7 +437,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onHeadsUpDismissed() {
|
public void onHeadsUpDismissed() {
|
||||||
// pass
|
mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -958,20 +958,20 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
if (DEBUG) Log.d(TAG, "reusing notification for key: " + key);
|
if (DEBUG) Log.d(TAG, "reusing notification for key: " + key);
|
||||||
oldEntry.notification = notification;
|
oldEntry.notification = notification;
|
||||||
try {
|
try {
|
||||||
// Reapply the RemoteViews
|
updateNotificationViews(oldEntry, notification);
|
||||||
contentView.reapply(mContext, oldEntry.expanded, mOnClickHandler);
|
|
||||||
if (bigContentView != null && oldEntry.getBigContentView() != null) {
|
if (ENABLE_HEADS_UP && mInterruptingNotificationEntry != null
|
||||||
bigContentView.reapply(mContext, oldEntry.getBigContentView(), mOnClickHandler);
|
&& oldNotification == mInterruptingNotificationEntry.notification) {
|
||||||
}
|
if (!shouldInterrupt(notification)) {
|
||||||
// update the contentIntent
|
if (DEBUG) Log.d(TAG, "no longer interrupts!");
|
||||||
final PendingIntent contentIntent = notification.getNotification().contentIntent;
|
mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
|
||||||
if (contentIntent != null) {
|
} else {
|
||||||
final View.OnClickListener listener = makeClicker(contentIntent,
|
if (DEBUG) Log.d(TAG, "updating the current heads up:" + notification);
|
||||||
notification.getPackageName(), notification.getTag(), notification.getId());
|
mInterruptingNotificationEntry.notification = notification;
|
||||||
oldEntry.content.setOnClickListener(listener);
|
updateNotificationViews(mInterruptingNotificationEntry, notification);
|
||||||
} else {
|
}
|
||||||
oldEntry.content.setOnClickListener(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the icon.
|
// Update the icon.
|
||||||
final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(),
|
final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(),
|
||||||
notification.getUser(),
|
notification.getUser(),
|
||||||
@@ -997,7 +997,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
if (DEBUG) Log.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top"));
|
if (DEBUG) Log.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top"));
|
||||||
final boolean wasExpanded = oldEntry.row.isUserExpanded();
|
final boolean wasExpanded = oldEntry.row.isUserExpanded();
|
||||||
removeNotificationViews(key);
|
removeNotificationViews(key);
|
||||||
addNotificationViews(key, notification);
|
addNotificationViews(key, notification); // will also replace the heads up
|
||||||
if (wasExpanded) {
|
if (wasExpanded) {
|
||||||
final NotificationData.Entry newEntry = mNotificationData.findByKey(key);
|
final NotificationData.Entry newEntry = mNotificationData.findByKey(key);
|
||||||
newEntry.row.setExpanded(true);
|
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.
|
// Recalculate the position of the sliding windows and the titles.
|
||||||
setAreThereNotifications();
|
setAreThereNotifications();
|
||||||
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
|
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
|
||||||
|
}
|
||||||
|
|
||||||
// See if we need to update the heads up.
|
private void updateNotificationViews(NotificationData.Entry entry,
|
||||||
if (ENABLE_HEADS_UP && mInterruptingNotificationEntry != null
|
StatusBarNotification notification) {
|
||||||
&& oldNotification == mInterruptingNotificationEntry.notification) {
|
final RemoteViews contentView = notification.getNotification().contentView;
|
||||||
if (DEBUG) Log.d(TAG, "updating the current heads up:" + notification);
|
final RemoteViews bigContentView = notification.getNotification().bigContentView;
|
||||||
// XXX: this is a hack for Alarms. The real implementation will need to *update*
|
// Reapply the RemoteViews
|
||||||
// the heads up.
|
contentView.reapply(mContext, entry.expanded, mOnClickHandler);
|
||||||
if (!shouldInterrupt(notification)) {
|
if (bigContentView != null && entry.getBigContentView() != null) {
|
||||||
if (DEBUG) Log.d(TAG, "no longer interrupts!");
|
bigContentView.reapply(mContext, entry.getBigContentView(), mOnClickHandler);
|
||||||
mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
|
}
|
||||||
}
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1319,12 +1319,10 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
break;
|
break;
|
||||||
case MSG_HIDE_HEADS_UP:
|
case MSG_HIDE_HEADS_UP:
|
||||||
setHeadsUpVisibility(false);
|
setHeadsUpVisibility(false);
|
||||||
mInterruptingNotificationEntry = null;
|
|
||||||
break;
|
break;
|
||||||
case MSG_ESCALATE_HEADS_UP:
|
case MSG_ESCALATE_HEADS_UP:
|
||||||
escalateHeadsUp();
|
escalateHeadsUp();
|
||||||
setHeadsUpVisibility(false);
|
setHeadsUpVisibility(false);
|
||||||
mInterruptingNotificationEntry = null;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2507,6 +2505,10 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
if (!ENABLE_HEADS_UP) return;
|
if (!ENABLE_HEADS_UP) return;
|
||||||
if (DEBUG) Log.v(TAG, (vis ? "showing" : "hiding") + " heads up window");
|
if (DEBUG) Log.v(TAG, (vis ? "showing" : "hiding") + " heads up window");
|
||||||
mHeadsUpNotificationView.setVisibility(vis ? View.VISIBLE : View.GONE);
|
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) {
|
public void animateHeadsUp(boolean animateInto, float frac) {
|
||||||
|
|||||||
Reference in New Issue
Block a user