Loading packages/SystemUI/res/values/ids.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,4 +17,5 @@ <resources> <item type="id" name="expandable_tag" /> <item type="id" name="user_expanded_tag" /> </resources> packages/SystemUI/src/com/android/systemui/ExpandHelper.java +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { View getChildAtPosition(MotionEvent ev); View getChildAtPosition(float x, float y); boolean canChildBeExpanded(View v); boolean setUserExpandedChild(View v, boolean userxpanded); } private static final String TAG = "ExpandHelper"; Loading Loading @@ -272,6 +273,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mScaleAnimation.start(); mStretching = false; setGlow(0f); mCallback.setUserExpandedChild(mCurrView, h == mNaturalHeight); if (DEBUG) Log.d(TAG, "scale was finished on view: " + mCurrView); clearView(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +44 −11 Original line number Diff line number Diff line Loading @@ -486,17 +486,7 @@ public abstract class BaseStatusBar extends SystemUI implements // for blaming (see SwipeHelper.setLongPressListener) row.setTag(sbn.pkg); // XXX: temporary: while testing big notifications, auto-expand all of them ViewGroup.LayoutParams lp = row.getLayoutParams(); Boolean expandable = Boolean.FALSE; if (large != null) { lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; expandable = Boolean.TRUE; } else { lp.height = rowHeight; } row.setLayoutParams(lp); row.setTag(R.id.expandable_tag, expandable); workAroundBadLayerDrawableOpacity(row); View vetoButton = updateNotificationVetoButton(row, sbn); vetoButton.setContentDescription(mContext.getString( Loading Loading @@ -562,10 +552,11 @@ public abstract class BaseStatusBar extends SystemUI implements applyLegacyRowBackground(sbn, content); row.setTag(R.id.expandable_tag, Boolean.valueOf(large != null)); entry.row = row; entry.content = content; entry.expanded = expandedOneU; entry.expandedLarge = expandedOneU; entry.setLargeView(expandedLarge); return true; } Loading Loading @@ -674,6 +665,7 @@ public abstract class BaseStatusBar extends SystemUI implements // Remove the expanded view. ViewGroup rowParent = (ViewGroup)entry.row.getParent(); if (rowParent != null) rowParent.removeView(entry.row); updateExpansionStates(); updateNotificationIcons(); return entry.notification; Loading Loading @@ -712,16 +704,53 @@ public abstract class BaseStatusBar extends SystemUI implements if (DEBUG) { Slog.d(TAG, "addNotificationViews: added at " + pos); } updateExpansionStates(); updateNotificationIcons(); return iconView; } protected boolean expandView(NotificationData.Entry entry, boolean expand) { if (entry.expandable()) { int rowHeight = mContext.getResources().getDimensionPixelSize(R.dimen.notification_height); ViewGroup.LayoutParams lp = entry.row.getLayoutParams(); if (expand) { lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; } else { lp.height = rowHeight; } entry.row.setLayoutParams(lp); return expand; } else { return false; } } protected void updateExpansionStates() { int N = mNotificationData.size(); for (int i = 0; i < N; i++) { NotificationData.Entry entry = mNotificationData.get(i); if (i == (N-1)) { if (DEBUG) Slog.d(TAG, "expanding top notification at " + i); expandView(entry, true); } else { if (!entry.userExpanded()) { if (DEBUG) Slog.d(TAG, "collapsing notification at " + i); expandView(entry, false); } else { if (DEBUG) Slog.d(TAG, "ignoring user-modified notification at " + i); } } } } protected abstract void haltTicker(); protected abstract void setAreThereNotifications(); protected abstract void updateNotificationIcons(); protected abstract void tick(IBinder key, StatusBarNotification n, boolean firstTime); protected abstract void updateExpandedViewPos(int expandedPosition); protected abstract int getExpandedViewMaxHeight(); protected boolean isTopNotification(ViewGroup parent, NotificationData.Entry entry) { return parent.indexOfChild(entry.row) == 0; Loading Loading @@ -798,6 +827,7 @@ public abstract class BaseStatusBar extends SystemUI implements handleNotificationError(key, notification, "Couldn't update icon: " + ic); return; } updateExpansionStates(); } catch (RuntimeException e) { // It failed to add cleanly. Log, and remove the view from the panel. Loading @@ -807,6 +837,9 @@ public abstract class BaseStatusBar extends SystemUI implements } } else { if (DEBUG) Slog.d(TAG, "not reusing notification for key: " + key); if (DEBUG) Slog.d(TAG, "contents was " + (contentsUnchanged ? "unchanged" : "changed")); if (DEBUG) Slog.d(TAG, "order was " + (orderUnchanged ? "unchanged" : "changed")); if (DEBUG) Slog.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top")); removeNotificationViews(key); addNotificationViews(key, notification); } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +58 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.view.View; import android.widget.ImageView; import com.android.internal.statusbar.StatusBarNotification; import com.android.systemui.R; import java.util.Comparator; import java.util.ArrayList; Loading @@ -38,13 +39,32 @@ public class NotificationData { public View content; // takes the click events and sends the PendingIntent public View expanded; // the inflated RemoteViews public ImageView largeIcon; public View expandedLarge; protected View expandedLarge; public Entry() {} public Entry(IBinder key, StatusBarNotification n, StatusBarIconView ic) { this.key = key; this.notification = n; this.icon = ic; } public void setLargeView(View expandedLarge) { this.expandedLarge = expandedLarge; writeBooleanTag(row, R.id.expandable_tag, expandedLarge != null); } public View getLargeView() { return expandedLarge; } /** * Return whether the entry can be expanded. */ public boolean expandable() { return NotificationData.getIsExpandable(row); } /** * Return whether the entry has been manually expanded by the user. */ public boolean userExpanded() { return NotificationData.getUserExpanded(row); } } private final ArrayList<Entry> mEntries = new ArrayList<Entry>(); private final Comparator<Entry> mEntryCmp = new Comparator<Entry>() { Loading Loading @@ -134,4 +154,41 @@ public class NotificationData { } return false; } protected static boolean readBooleanTag(View view, int id) { if (view != null) { Object value = view.getTag(id); return value != null && value instanceof Boolean && ((Boolean) value).booleanValue(); } return false; } protected static boolean writeBooleanTag(View view, int id, boolean value) { if (view != null) { view.setTag(id, Boolean.valueOf(value)); return value; } return false; } /** * Return whether the entry can be expanded. */ public static boolean getIsExpandable(View row) { return readBooleanTag(row, R.id.expandable_tag); } /** * Return whether the entry has been manually expanded by the user. */ public static boolean getUserExpanded(View row) { return readBooleanTag(row, R.id.user_expanded_tag); } /** * Set whether the entry has been manually expanded by the user. */ public static boolean setUserExpanded(View row, boolean userExpanded) { return writeBooleanTag(row, R.id.user_expanded_tag, userExpanded); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +2 −1 Original line number Diff line number Diff line Loading @@ -1771,7 +1771,8 @@ public class PhoneStatusBar extends BaseStatusBar { return a < 0f ? 0f : (a > 1f ? 1f : a); } int getExpandedViewMaxHeight() { @Override protected int getExpandedViewMaxHeight() { return mDisplayMetrics.heightPixels - mNotificationPanelMarginBottomPx; } Loading Loading
packages/SystemUI/res/values/ids.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,4 +17,5 @@ <resources> <item type="id" name="expandable_tag" /> <item type="id" name="user_expanded_tag" /> </resources>
packages/SystemUI/src/com/android/systemui/ExpandHelper.java +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { View getChildAtPosition(MotionEvent ev); View getChildAtPosition(float x, float y); boolean canChildBeExpanded(View v); boolean setUserExpandedChild(View v, boolean userxpanded); } private static final String TAG = "ExpandHelper"; Loading Loading @@ -272,6 +273,7 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener { mScaleAnimation.start(); mStretching = false; setGlow(0f); mCallback.setUserExpandedChild(mCurrView, h == mNaturalHeight); if (DEBUG) Log.d(TAG, "scale was finished on view: " + mCurrView); clearView(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +44 −11 Original line number Diff line number Diff line Loading @@ -486,17 +486,7 @@ public abstract class BaseStatusBar extends SystemUI implements // for blaming (see SwipeHelper.setLongPressListener) row.setTag(sbn.pkg); // XXX: temporary: while testing big notifications, auto-expand all of them ViewGroup.LayoutParams lp = row.getLayoutParams(); Boolean expandable = Boolean.FALSE; if (large != null) { lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; expandable = Boolean.TRUE; } else { lp.height = rowHeight; } row.setLayoutParams(lp); row.setTag(R.id.expandable_tag, expandable); workAroundBadLayerDrawableOpacity(row); View vetoButton = updateNotificationVetoButton(row, sbn); vetoButton.setContentDescription(mContext.getString( Loading Loading @@ -562,10 +552,11 @@ public abstract class BaseStatusBar extends SystemUI implements applyLegacyRowBackground(sbn, content); row.setTag(R.id.expandable_tag, Boolean.valueOf(large != null)); entry.row = row; entry.content = content; entry.expanded = expandedOneU; entry.expandedLarge = expandedOneU; entry.setLargeView(expandedLarge); return true; } Loading Loading @@ -674,6 +665,7 @@ public abstract class BaseStatusBar extends SystemUI implements // Remove the expanded view. ViewGroup rowParent = (ViewGroup)entry.row.getParent(); if (rowParent != null) rowParent.removeView(entry.row); updateExpansionStates(); updateNotificationIcons(); return entry.notification; Loading Loading @@ -712,16 +704,53 @@ public abstract class BaseStatusBar extends SystemUI implements if (DEBUG) { Slog.d(TAG, "addNotificationViews: added at " + pos); } updateExpansionStates(); updateNotificationIcons(); return iconView; } protected boolean expandView(NotificationData.Entry entry, boolean expand) { if (entry.expandable()) { int rowHeight = mContext.getResources().getDimensionPixelSize(R.dimen.notification_height); ViewGroup.LayoutParams lp = entry.row.getLayoutParams(); if (expand) { lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; } else { lp.height = rowHeight; } entry.row.setLayoutParams(lp); return expand; } else { return false; } } protected void updateExpansionStates() { int N = mNotificationData.size(); for (int i = 0; i < N; i++) { NotificationData.Entry entry = mNotificationData.get(i); if (i == (N-1)) { if (DEBUG) Slog.d(TAG, "expanding top notification at " + i); expandView(entry, true); } else { if (!entry.userExpanded()) { if (DEBUG) Slog.d(TAG, "collapsing notification at " + i); expandView(entry, false); } else { if (DEBUG) Slog.d(TAG, "ignoring user-modified notification at " + i); } } } } protected abstract void haltTicker(); protected abstract void setAreThereNotifications(); protected abstract void updateNotificationIcons(); protected abstract void tick(IBinder key, StatusBarNotification n, boolean firstTime); protected abstract void updateExpandedViewPos(int expandedPosition); protected abstract int getExpandedViewMaxHeight(); protected boolean isTopNotification(ViewGroup parent, NotificationData.Entry entry) { return parent.indexOfChild(entry.row) == 0; Loading Loading @@ -798,6 +827,7 @@ public abstract class BaseStatusBar extends SystemUI implements handleNotificationError(key, notification, "Couldn't update icon: " + ic); return; } updateExpansionStates(); } catch (RuntimeException e) { // It failed to add cleanly. Log, and remove the view from the panel. Loading @@ -807,6 +837,9 @@ public abstract class BaseStatusBar extends SystemUI implements } } else { if (DEBUG) Slog.d(TAG, "not reusing notification for key: " + key); if (DEBUG) Slog.d(TAG, "contents was " + (contentsUnchanged ? "unchanged" : "changed")); if (DEBUG) Slog.d(TAG, "order was " + (orderUnchanged ? "unchanged" : "changed")); if (DEBUG) Slog.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top")); removeNotificationViews(key); addNotificationViews(key, notification); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +58 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.view.View; import android.widget.ImageView; import com.android.internal.statusbar.StatusBarNotification; import com.android.systemui.R; import java.util.Comparator; import java.util.ArrayList; Loading @@ -38,13 +39,32 @@ public class NotificationData { public View content; // takes the click events and sends the PendingIntent public View expanded; // the inflated RemoteViews public ImageView largeIcon; public View expandedLarge; protected View expandedLarge; public Entry() {} public Entry(IBinder key, StatusBarNotification n, StatusBarIconView ic) { this.key = key; this.notification = n; this.icon = ic; } public void setLargeView(View expandedLarge) { this.expandedLarge = expandedLarge; writeBooleanTag(row, R.id.expandable_tag, expandedLarge != null); } public View getLargeView() { return expandedLarge; } /** * Return whether the entry can be expanded. */ public boolean expandable() { return NotificationData.getIsExpandable(row); } /** * Return whether the entry has been manually expanded by the user. */ public boolean userExpanded() { return NotificationData.getUserExpanded(row); } } private final ArrayList<Entry> mEntries = new ArrayList<Entry>(); private final Comparator<Entry> mEntryCmp = new Comparator<Entry>() { Loading Loading @@ -134,4 +154,41 @@ public class NotificationData { } return false; } protected static boolean readBooleanTag(View view, int id) { if (view != null) { Object value = view.getTag(id); return value != null && value instanceof Boolean && ((Boolean) value).booleanValue(); } return false; } protected static boolean writeBooleanTag(View view, int id, boolean value) { if (view != null) { view.setTag(id, Boolean.valueOf(value)); return value; } return false; } /** * Return whether the entry can be expanded. */ public static boolean getIsExpandable(View row) { return readBooleanTag(row, R.id.expandable_tag); } /** * Return whether the entry has been manually expanded by the user. */ public static boolean getUserExpanded(View row) { return readBooleanTag(row, R.id.user_expanded_tag); } /** * Set whether the entry has been manually expanded by the user. */ public static boolean setUserExpanded(View row, boolean userExpanded) { return writeBooleanTag(row, R.id.user_expanded_tag, userExpanded); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +2 −1 Original line number Diff line number Diff line Loading @@ -1771,7 +1771,8 @@ public class PhoneStatusBar extends BaseStatusBar { return a < 0f ? 0f : (a > 1f ? 1f : a); } int getExpandedViewMaxHeight() { @Override protected int getExpandedViewMaxHeight() { return mDisplayMetrics.heightPixels - mNotificationPanelMarginBottomPx; } Loading