summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2010-06-01 07:46:41 -0700
committerJoe Onorato <joeo@android.com>2010-06-02 14:48:46 -0700
commitf55105405578bfd8315584e69faa655800edef77 (patch)
treef43d6cce54c3085613c7ad0ff3fffe756d7b8fee /packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
parent9834d534696c2db66a42d9c3b8208fcce1dbdc16 (diff)
downloadframeworks_base-f55105405578bfd8315584e69faa655800edef77.zip
frameworks_base-f55105405578bfd8315584e69faa655800edef77.tar.gz
frameworks_base-f55105405578bfd8315584e69faa655800edef77.tar.bz2
Get the ticker working again.
Change-Id: Idb7e456bc302578c3866448334eb0ebf0ba235d4
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java38
1 files changed, 27 insertions, 11 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
index 1dc16b0..2657ea1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
@@ -16,7 +16,6 @@
package com.android.systemui.statusbar;
-import com.android.internal.util.CharSequences;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
@@ -334,7 +333,7 @@ public class PhoneStatusBarService extends StatusBarService {
addNotificationViews(key, notification);
// show the ticker
- // TODO
+ tick(notification);
// Recalculate the position of the sliding windows and the titles.
setAreThereNotifications();
@@ -400,7 +399,7 @@ public class PhoneStatusBarService extends StatusBarService {
}
// Restart the ticker if it's still running
- // TODO
+ tick(notification);
// Recalculate the position of the sliding windows and the titles.
setAreThereNotifications();
@@ -409,14 +408,16 @@ public class PhoneStatusBarService extends StatusBarService {
public void removeNotification(IBinder key) {
Slog.d(TAG, "removeNotification key=" + key);
- removeNotificationViews(key);
+ StatusBarNotification old = removeNotificationViews(key);
- // Cancel the ticker if it's still running
- // TODO
+ if (old != null) {
+ // Cancel the ticker if it's still running
+ mTicker.removeEntry(old);
- // Recalculate the position of the sliding windows and the titles.
- setAreThereNotifications();
- updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
+ // Recalculate the position of the sliding windows and the titles.
+ setAreThereNotifications();
+ updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
+ }
}
private int chooseIconIndex(boolean isOngoing, int viewIndex) {
@@ -499,19 +500,21 @@ public class PhoneStatusBarService extends StatusBarService {
new LinearLayout.LayoutParams(mIconWidth, mHeight));
}
- void removeNotificationViews(IBinder key) {
+ StatusBarNotification removeNotificationViews(IBinder key) {
NotificationData.Entry entry = mOngoing.remove(key);
if (entry == null) {
entry = mLatest.remove(key);
if (entry == null) {
Slog.w(TAG, "removeNotification for unknown key: " + key);
- return;
+ return null;
}
}
// Remove the expanded view.
((ViewGroup)entry.row.getParent()).removeView(entry.row);
// Remove the icon.
((ViewGroup)entry.icon.getParent()).removeView(entry.icon);
+
+ return entry.notification;
}
private void setAreThereNotifications() {
@@ -960,6 +963,19 @@ public class PhoneStatusBarService extends StatusBarService {
}
}
+ private void tick(StatusBarNotification n) {
+ // Show the ticker if one is requested. Also don't do this
+ // until status bar window is attached to the window manager,
+ // because... well, what's the point otherwise? And trying to
+ // run a ticker without being attached will crash!
+ if (n.notification.tickerText != null && mStatusBarView.getWindowToken() != null) {
+ if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
+ | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
+ mTicker.addEntry(n);
+ }
+ }
+ }
+
private class MyTicker extends Ticker {
MyTicker(Context context, StatusBarView sb) {
super(context, sb);