Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar; import android.app.Notification; import android.os.IBinder; import android.view.View; import android.widget.ImageView; import com.android.internal.statusbar.StatusBarNotification; Loading @@ -36,6 +37,7 @@ public class NotificationData { public View row; // the outer expanded view public View content; // takes the click events and sends the PendingIntent public View expanded; // the inflated RemoteViews public ImageView largeIcon; public Entry() {} public Entry(IBinder key, StatusBarNotification n, StatusBarIconView ic) { this.key = key; Loading Loading @@ -88,6 +90,7 @@ public class NotificationData { entry.content = content; entry.expanded = expanded; entry.icon = icon; entry.largeIcon = null; // TODO add support for large icons return add(entry); } Loading packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +12 −5 Original line number Diff line number Diff line Loading @@ -635,16 +635,15 @@ public class TabletStatusBar extends StatusBar implements // Can we just reapply the RemoteViews in place? If when didn't change, the order // didn't change. boolean contentsUnchanged = notification.isOngoing() == oldNotification.isOngoing() && oldEntry.expanded != null && contentView != null && oldContentView != null boolean contentsUnchanged = oldEntry.expanded != null && contentView != null && oldContentView != null && contentView.getPackage() != null && oldContentView.getPackage() != null && oldContentView.getPackage().equals(contentView.getPackage()) && oldContentView.getLayoutId() == contentView.getLayoutId(); ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent(); boolean orderUnchanged = notification.notification.when==oldNotification.notification.when; boolean orderUnchanged = notification.notification.when==oldNotification.notification.when && notification.isOngoing() == oldNotification.isOngoing(); boolean isLastAnyway = rowParent.indexOfChild(oldEntry.row) == rowParent.getChildCount()-1; if (contentsUnchanged && (orderUnchanged || isLastAnyway)) { if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key); Loading @@ -668,6 +667,13 @@ public class TabletStatusBar extends StatusBar implements handleNotificationError(key, notification, "Couldn't update icon: " + ic); return; } // Update the large icon if (notification.notification.largeIcon != null) { oldEntry.largeIcon.setImageBitmap(notification.notification.largeIcon); } else { oldEntry.largeIcon.getLayoutParams().width = 0; oldEntry.largeIcon.setVisibility(View.INVISIBLE); } if (key == mNotificationPeekKey) { // must update the peek window Loading Loading @@ -1286,6 +1292,7 @@ public class TabletStatusBar extends StatusBar implements entry.row = row; entry.content = content; entry.expanded = expanded; entry.largeIcon = largeIcon; return true; } Loading tests/StatusBar/res/drawable-mdpi/pineapple2.png 0 → 100644 +11.3 KiB Loading image diff... tests/StatusBar/res/layout/notification_builder_test.xml +6 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ /> <RadioButton android:id="@+id/when_midnight" style="@style/FieldContents.Disabled" style="@style/FieldContents" android:text="midnight" /> <RadioButton Loading Loading @@ -604,6 +604,11 @@ style="@style/FieldContents" android:text="pineapple" /> <RadioButton android:id="@+id/large_icon_pineapple2" style="@style/FieldContents" android:text="pineapple2" /> </RadioGroup> Loading tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java +12 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.statusbartest; import java.util.GregorianCalendar; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; Loading Loading @@ -190,8 +192,14 @@ public class NotificationBuilderTest extends Activity // when switch (getRadioChecked(R.id.group_when)) { case R.id.when_midnight: case R.id.when_midnight: { GregorianCalendar c = new GregorianCalendar(); c.set(GregorianCalendar.HOUR_OF_DAY, 0); c.set(GregorianCalendar.MINUTE, 0); c.set(GregorianCalendar.SECOND, 0); b.setWhen(c.getTimeInMillis()); break; } case R.id.when_now: b.setWhen(System.currentTimeMillis()); break; Loading Loading @@ -276,6 +284,9 @@ public class NotificationBuilderTest extends Activity case R.id.large_icon_pineapple: b.setLargeIcon(loadBitmap(R.drawable.pineapple)); break; case R.id.large_icon_pineapple2: b.setLargeIcon(loadBitmap(R.drawable.pineapple2)); break; } // sound TODO Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar; import android.app.Notification; import android.os.IBinder; import android.view.View; import android.widget.ImageView; import com.android.internal.statusbar.StatusBarNotification; Loading @@ -36,6 +37,7 @@ public class NotificationData { public View row; // the outer expanded view public View content; // takes the click events and sends the PendingIntent public View expanded; // the inflated RemoteViews public ImageView largeIcon; public Entry() {} public Entry(IBinder key, StatusBarNotification n, StatusBarIconView ic) { this.key = key; Loading Loading @@ -88,6 +90,7 @@ public class NotificationData { entry.content = content; entry.expanded = expanded; entry.icon = icon; entry.largeIcon = null; // TODO add support for large icons return add(entry); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +12 −5 Original line number Diff line number Diff line Loading @@ -635,16 +635,15 @@ public class TabletStatusBar extends StatusBar implements // Can we just reapply the RemoteViews in place? If when didn't change, the order // didn't change. boolean contentsUnchanged = notification.isOngoing() == oldNotification.isOngoing() && oldEntry.expanded != null && contentView != null && oldContentView != null boolean contentsUnchanged = oldEntry.expanded != null && contentView != null && oldContentView != null && contentView.getPackage() != null && oldContentView.getPackage() != null && oldContentView.getPackage().equals(contentView.getPackage()) && oldContentView.getLayoutId() == contentView.getLayoutId(); ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent(); boolean orderUnchanged = notification.notification.when==oldNotification.notification.when; boolean orderUnchanged = notification.notification.when==oldNotification.notification.when && notification.isOngoing() == oldNotification.isOngoing(); boolean isLastAnyway = rowParent.indexOfChild(oldEntry.row) == rowParent.getChildCount()-1; if (contentsUnchanged && (orderUnchanged || isLastAnyway)) { if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key); Loading @@ -668,6 +667,13 @@ public class TabletStatusBar extends StatusBar implements handleNotificationError(key, notification, "Couldn't update icon: " + ic); return; } // Update the large icon if (notification.notification.largeIcon != null) { oldEntry.largeIcon.setImageBitmap(notification.notification.largeIcon); } else { oldEntry.largeIcon.getLayoutParams().width = 0; oldEntry.largeIcon.setVisibility(View.INVISIBLE); } if (key == mNotificationPeekKey) { // must update the peek window Loading Loading @@ -1286,6 +1292,7 @@ public class TabletStatusBar extends StatusBar implements entry.row = row; entry.content = content; entry.expanded = expanded; entry.largeIcon = largeIcon; return true; } Loading
tests/StatusBar/res/layout/notification_builder_test.xml +6 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ /> <RadioButton android:id="@+id/when_midnight" style="@style/FieldContents.Disabled" style="@style/FieldContents" android:text="midnight" /> <RadioButton Loading Loading @@ -604,6 +604,11 @@ style="@style/FieldContents" android:text="pineapple" /> <RadioButton android:id="@+id/large_icon_pineapple2" style="@style/FieldContents" android:text="pineapple2" /> </RadioGroup> Loading
tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java +12 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.statusbartest; import java.util.GregorianCalendar; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; Loading Loading @@ -190,8 +192,14 @@ public class NotificationBuilderTest extends Activity // when switch (getRadioChecked(R.id.group_when)) { case R.id.when_midnight: case R.id.when_midnight: { GregorianCalendar c = new GregorianCalendar(); c.set(GregorianCalendar.HOUR_OF_DAY, 0); c.set(GregorianCalendar.MINUTE, 0); c.set(GregorianCalendar.SECOND, 0); b.setWhen(c.getTimeInMillis()); break; } case R.id.when_now: b.setWhen(System.currentTimeMillis()); break; Loading Loading @@ -276,6 +284,9 @@ public class NotificationBuilderTest extends Activity case R.id.large_icon_pineapple: b.setLargeIcon(loadBitmap(R.drawable.pineapple)); break; case R.id.large_icon_pineapple2: b.setLargeIcon(loadBitmap(R.drawable.pineapple2)); break; } // sound TODO Loading