Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +41 −20 Original line number Diff line number Diff line Loading @@ -897,15 +897,15 @@ public abstract class BaseStatusBar extends SystemUI implements protected void onShowSearchPanel() { } public boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) { private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) { return inflateViews(entry, parent, false); } public boolean inflateViewsForHeadsUp(NotificationData.Entry entry, ViewGroup parent) { protected boolean inflateViewsForHeadsUp(NotificationData.Entry entry, ViewGroup parent) { return inflateViews(entry, parent, true); } public boolean inflateViews(NotificationData.Entry entry, ViewGroup parent, boolean isHeadsUp) { private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent, boolean isHeadsUp) { int maxHeight = mRowMaxHeight; StatusBarNotification sbn = entry.notification; RemoteViews contentView = sbn.getNotification().contentView; Loading @@ -927,11 +927,30 @@ public abstract class BaseStatusBar extends SystemUI implements Notification publicNotification = sbn.getNotification().publicVersion; ExpandableNotificationRow row; // Stash away previous user expansion state so we can restore it at // the end. boolean hasUserChangedExpansion = false; boolean userExpanded = false; boolean userLocked = false; if (entry.row != null) { row = entry.row; hasUserChangedExpansion = row.hasUserChangedExpansion(); userExpanded = row.isUserExpanded(); userLocked = row.isUserLocked(); row.reset(); if (hasUserChangedExpansion) { row.setUserExpanded(userExpanded); } } else { // create the row view LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE); ExpandableNotificationRow row = (ExpandableNotificationRow) inflater.inflate( R.layout.status_bar_notification_row, parent, false); row = (ExpandableNotificationRow) inflater.inflate(R.layout.status_bar_notification_row, parent, false); } // for blaming (see SwipeHelper.setLongPressListener) row.setTag(sbn.getPackageName()); Loading Loading @@ -1077,6 +1096,14 @@ public abstract class BaseStatusBar extends SystemUI implements applyLegacyRowBackground(sbn, entry); // Restore previous flags. if (hasUserChangedExpansion) { // Note: setUserExpanded() conveniently ignores calls with // userExpanded=true if !isExpandable(). row.setUserExpanded(userExpanded); } row.setUserLocked(userLocked); return true; } Loading Loading @@ -1317,12 +1344,13 @@ public abstract class BaseStatusBar extends SystemUI implements RankingMap ranking); protected abstract void updateNotificationRanking(RankingMap ranking); public abstract void removeNotification(String key, RankingMap ranking); public void updateNotification(StatusBarNotification notification, RankingMap ranking) { if (DEBUG) Log.d(TAG, "updateNotification(" + notification + ")"); final String key = notification.getKey(); boolean wasHeadsUp = isHeadsUp(key); NotificationData.Entry oldEntry; Entry oldEntry; if (wasHeadsUp) { oldEntry = mHeadsUpNotificationView.getEntry(); } else { Loading Loading @@ -1363,8 +1391,7 @@ public abstract class BaseStatusBar extends SystemUI implements + " publicView=" + publicContentView); } // Can we just reapply the RemoteViews in place? If when didn't change, the order // didn't change. // Can we just reapply the RemoteViews in place? // 1U is never null boolean contentsUnchanged = oldEntry.expanded != null Loading Loading @@ -1477,15 +1504,9 @@ public abstract class BaseStatusBar extends SystemUI implements addNotification(notification, ranking); //this will pop the headsup } else { if (DEBUG) Log.d(TAG, "rebuilding update in place for key: " + key); removeNotificationViews(key, ranking); addNotificationViews(notification, ranking); final NotificationData.Entry newEntry = mNotificationData.findByKey(key); final boolean userChangedExpansion = oldEntry.row.hasUserChangedExpansion(); if (userChangedExpansion) { boolean userExpanded = oldEntry.row.isUserExpanded(); newEntry.row.setUserExpanded(userExpanded); newEntry.row.notifyHeightChanged(); } oldEntry.notification = notification; inflateViews(oldEntry, mStackScroller, wasHeadsUp); updateNotifications(); } } } Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +18 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,23 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { super(context, attrs); } /** * Resets this view so it can be re-used for an updated notification. */ public void reset() { mRowMinHeight = 0; mRowMaxHeight = 0; mExpandable = false; mHasUserChangedExpansion = false; mUserLocked = false; mShowingPublic = false; mIsSystemExpanded = false; mExpansionDisabled = false; mPublicLayout.reset(); mPrivateLayout.reset(); mMaxExpandHeight = 0; } @Override protected void onFinishInflate() { super.onFinishInflate(); Loading Loading @@ -110,6 +127,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { * @param userExpanded whether the user wants this notification to be expanded */ public void setUserExpanded(boolean userExpanded) { if (userExpanded && !mExpandable) return; mHasUserChangedExpansion = true; mUserExpanded = userExpanded; } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +11 −3 Original line number Diff line number Diff line Loading @@ -51,13 +51,12 @@ public class NotificationContentView extends FrameLayout { private boolean mContractedVisible = true; private Paint mFadePaint = new Paint(); private final Paint mFadePaint = new Paint(); public NotificationContentView(Context context, AttributeSet attrs) { super(context, attrs); mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height); mActualHeight = mSmallHeight; mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD)); reset(); } @Override Loading @@ -66,6 +65,15 @@ public class NotificationContentView extends FrameLayout { updateClipping(); } public void reset() { removeAllViews(); mContractedChild = null; mExpandedChild = null; mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height); mActualHeight = mSmallHeight; mContractedVisible = true; } public void setContractedChild(View child) { if (mContractedChild != null) { removeView(mContractedChild); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +41 −20 Original line number Diff line number Diff line Loading @@ -897,15 +897,15 @@ public abstract class BaseStatusBar extends SystemUI implements protected void onShowSearchPanel() { } public boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) { private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) { return inflateViews(entry, parent, false); } public boolean inflateViewsForHeadsUp(NotificationData.Entry entry, ViewGroup parent) { protected boolean inflateViewsForHeadsUp(NotificationData.Entry entry, ViewGroup parent) { return inflateViews(entry, parent, true); } public boolean inflateViews(NotificationData.Entry entry, ViewGroup parent, boolean isHeadsUp) { private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent, boolean isHeadsUp) { int maxHeight = mRowMaxHeight; StatusBarNotification sbn = entry.notification; RemoteViews contentView = sbn.getNotification().contentView; Loading @@ -927,11 +927,30 @@ public abstract class BaseStatusBar extends SystemUI implements Notification publicNotification = sbn.getNotification().publicVersion; ExpandableNotificationRow row; // Stash away previous user expansion state so we can restore it at // the end. boolean hasUserChangedExpansion = false; boolean userExpanded = false; boolean userLocked = false; if (entry.row != null) { row = entry.row; hasUserChangedExpansion = row.hasUserChangedExpansion(); userExpanded = row.isUserExpanded(); userLocked = row.isUserLocked(); row.reset(); if (hasUserChangedExpansion) { row.setUserExpanded(userExpanded); } } else { // create the row view LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE); ExpandableNotificationRow row = (ExpandableNotificationRow) inflater.inflate( R.layout.status_bar_notification_row, parent, false); row = (ExpandableNotificationRow) inflater.inflate(R.layout.status_bar_notification_row, parent, false); } // for blaming (see SwipeHelper.setLongPressListener) row.setTag(sbn.getPackageName()); Loading Loading @@ -1077,6 +1096,14 @@ public abstract class BaseStatusBar extends SystemUI implements applyLegacyRowBackground(sbn, entry); // Restore previous flags. if (hasUserChangedExpansion) { // Note: setUserExpanded() conveniently ignores calls with // userExpanded=true if !isExpandable(). row.setUserExpanded(userExpanded); } row.setUserLocked(userLocked); return true; } Loading Loading @@ -1317,12 +1344,13 @@ public abstract class BaseStatusBar extends SystemUI implements RankingMap ranking); protected abstract void updateNotificationRanking(RankingMap ranking); public abstract void removeNotification(String key, RankingMap ranking); public void updateNotification(StatusBarNotification notification, RankingMap ranking) { if (DEBUG) Log.d(TAG, "updateNotification(" + notification + ")"); final String key = notification.getKey(); boolean wasHeadsUp = isHeadsUp(key); NotificationData.Entry oldEntry; Entry oldEntry; if (wasHeadsUp) { oldEntry = mHeadsUpNotificationView.getEntry(); } else { Loading Loading @@ -1363,8 +1391,7 @@ public abstract class BaseStatusBar extends SystemUI implements + " publicView=" + publicContentView); } // Can we just reapply the RemoteViews in place? If when didn't change, the order // didn't change. // Can we just reapply the RemoteViews in place? // 1U is never null boolean contentsUnchanged = oldEntry.expanded != null Loading Loading @@ -1477,15 +1504,9 @@ public abstract class BaseStatusBar extends SystemUI implements addNotification(notification, ranking); //this will pop the headsup } else { if (DEBUG) Log.d(TAG, "rebuilding update in place for key: " + key); removeNotificationViews(key, ranking); addNotificationViews(notification, ranking); final NotificationData.Entry newEntry = mNotificationData.findByKey(key); final boolean userChangedExpansion = oldEntry.row.hasUserChangedExpansion(); if (userChangedExpansion) { boolean userExpanded = oldEntry.row.isUserExpanded(); newEntry.row.setUserExpanded(userExpanded); newEntry.row.notifyHeightChanged(); } oldEntry.notification = notification; inflateViews(oldEntry, mStackScroller, wasHeadsUp); updateNotifications(); } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +18 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,23 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { super(context, attrs); } /** * Resets this view so it can be re-used for an updated notification. */ public void reset() { mRowMinHeight = 0; mRowMaxHeight = 0; mExpandable = false; mHasUserChangedExpansion = false; mUserLocked = false; mShowingPublic = false; mIsSystemExpanded = false; mExpansionDisabled = false; mPublicLayout.reset(); mPrivateLayout.reset(); mMaxExpandHeight = 0; } @Override protected void onFinishInflate() { super.onFinishInflate(); Loading Loading @@ -110,6 +127,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { * @param userExpanded whether the user wants this notification to be expanded */ public void setUserExpanded(boolean userExpanded) { if (userExpanded && !mExpandable) return; mHasUserChangedExpansion = true; mUserExpanded = userExpanded; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +11 −3 Original line number Diff line number Diff line Loading @@ -51,13 +51,12 @@ public class NotificationContentView extends FrameLayout { private boolean mContractedVisible = true; private Paint mFadePaint = new Paint(); private final Paint mFadePaint = new Paint(); public NotificationContentView(Context context, AttributeSet attrs) { super(context, attrs); mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height); mActualHeight = mSmallHeight; mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD)); reset(); } @Override Loading @@ -66,6 +65,15 @@ public class NotificationContentView extends FrameLayout { updateClipping(); } public void reset() { removeAllViews(); mContractedChild = null; mExpandedChild = null; mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height); mActualHeight = mSmallHeight; mContractedVisible = true; } public void setContractedChild(View child) { if (mContractedChild != null) { removeView(mContractedChild); Loading