summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2011-01-15 16:22:24 -0800
committerJoe Onorato <joeo@google.com>2011-01-15 16:22:24 -0800
commit80a44401a22344f7eabce6976372ab144ef22893 (patch)
treeb13a229ef7c79e0d98feeb337359f1d060ad0e79
parenta47aa87a19c733e28d9d2db1c4eb7f29d668db7b (diff)
downloadframeworks_base-80a44401a22344f7eabce6976372ab144ef22893.zip
frameworks_base-80a44401a22344f7eabce6976372ab144ef22893.tar.gz
frameworks_base-80a44401a22344f7eabce6976372ab144ef22893.tar.bz2
Need to update the largeIcon for notifications when we're reapplying the views.
Bug: 3298062 Change-Id: I6bb72c0b93e00a9de8cc2633ac07add0a572a20f
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java17
-rw-r--r--tests/StatusBar/res/drawable-mdpi/pineapple2.pngbin0 -> 11577 bytes
-rw-r--r--tests/StatusBar/res/layout/notification_builder_test.xml7
-rw-r--r--tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java13
5 files changed, 33 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 7e8a5c1..004174e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -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;
@@ -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;
@@ -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);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index af730fe..d8e3053 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -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);
@@ -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
@@ -1286,6 +1292,7 @@ public class TabletStatusBar extends StatusBar implements
entry.row = row;
entry.content = content;
entry.expanded = expanded;
+ entry.largeIcon = largeIcon;
return true;
}
diff --git a/tests/StatusBar/res/drawable-mdpi/pineapple2.png b/tests/StatusBar/res/drawable-mdpi/pineapple2.png
new file mode 100644
index 0000000..ddc1038
--- /dev/null
+++ b/tests/StatusBar/res/drawable-mdpi/pineapple2.png
Binary files differ
diff --git a/tests/StatusBar/res/layout/notification_builder_test.xml b/tests/StatusBar/res/layout/notification_builder_test.xml
index 1b27e97..3c37a73 100644
--- a/tests/StatusBar/res/layout/notification_builder_test.xml
+++ b/tests/StatusBar/res/layout/notification_builder_test.xml
@@ -238,7 +238,7 @@
/>
<RadioButton
android:id="@+id/when_midnight"
- style="@style/FieldContents.Disabled"
+ style="@style/FieldContents"
android:text="midnight"
/>
<RadioButton
@@ -604,6 +604,11 @@
style="@style/FieldContents"
android:text="pineapple"
/>
+ <RadioButton
+ android:id="@+id/large_icon_pineapple2"
+ style="@style/FieldContents"
+ android:text="pineapple2"
+ />
</RadioGroup>
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
index e9a3513..5a2ebac 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationBuilderTest.java
@@ -16,6 +16,8 @@
package com.android.statusbartest;
+import java.util.GregorianCalendar;
+
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
@@ -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;
@@ -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