summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2010-05-28 19:59:51 -0400
committerJoe Onorato <joeo@android.com>2010-06-02 14:48:46 -0700
commitb77f53b21c2185ae3ff7c219c384a6db73f8f4e4 (patch)
tree7937a5f4c2a1b64edc49db8b50c877db75da5a69 /packages
parent87937dbcd1cee800aa6cc9824bfc32b587d893bd (diff)
downloadframeworks_base-b77f53b21c2185ae3ff7c219c384a6db73f8f4e4.zip
frameworks_base-b77f53b21c2185ae3ff7c219c384a6db73f8f4e4.tar.gz
frameworks_base-b77f53b21c2185ae3ff7c219c384a6db73f8f4e4.tar.bz2
Get the IconMerger working again.
Change-Id: I73719f4fd475a39d4c1245de45c6a13c31e6323b
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/IconMerger.java38
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java4
3 files changed, 43 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/IconMerger.java b/packages/SystemUI/src/com/android/systemui/statusbar/IconMerger.java
index 26f5f51..027bed4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/IconMerger.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/IconMerger.java
@@ -19,22 +19,37 @@ package com.android.systemui.statusbar;
import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
+import android.util.Slog;
import android.view.View;
import android.widget.LinearLayout;
+import com.android.systemui.R;
+
+
public class IconMerger extends LinearLayout {
- PhoneStatusBarService service;
+ private static final String TAG = "IconMerger";
+
+ private StatusBarIconView mMoreView;
public IconMerger(Context context, AttributeSet attrs) {
super(context, attrs);
}
+ public void addMoreView(StatusBarIconView v, LinearLayout.LayoutParams lp) {
+ super.addView(v, lp);
+ mMoreView = v;
+ }
+
+ public void addView(StatusBarIconView v, int index, LinearLayout.LayoutParams lp) {
+ if (index == 0) {
+ throw new RuntimeException("Attempt to put view before the more view: " + v);
+ }
+ super.addView(v, index, lp);
+ }
+
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
- if (true) {
- return;
- }
final int maxWidth = r - l;
final int N = getChildCount();
@@ -51,13 +66,12 @@ public class IconMerger extends LinearLayout {
}
// find the first visible one that isn't the more icon
- View moreView = null;
+ final StatusBarIconView moreView = mMoreView;
int fitLeft = -1;
int startIndex = -1;
for (i=0; i<N; i++) {
final View child = getChildAt(i);
- if (com.android.internal.R.drawable.stat_notify_more == child.getId()) {
- moreView = child;
+ if (child == moreView) {
startIndex = i+1;
}
else if (child.getVisibility() != GONE) {
@@ -67,7 +81,11 @@ public class IconMerger extends LinearLayout {
}
if (moreView == null || startIndex < 0) {
- throw new RuntimeException("Status Bar / IconMerger moreView == null");
+ return;
+ /*
+ throw new RuntimeException("Status Bar / IconMerger moreView == " + moreView
+ + " startIndex=" + startIndex);
+ */
}
// if it fits without the more icon, then hide the more icon and update fitLeft
@@ -85,14 +103,14 @@ public class IconMerger extends LinearLayout {
int breakingPoint = fitLeft + extra + adjust;
int number = 0;
for (i=startIndex; i<N; i++) {
- final View child = getChildAt(i);
+ final StatusBarIconView child = (StatusBarIconView)getChildAt(i);
if (child.getVisibility() != GONE) {
int childLeft = child.getLeft();
int childRight = child.getRight();
if (childLeft < breakingPoint) {
// hide this one
child.layout(0, child.getTop(), 0, child.getBottom());
- int n = 0; // XXX this.service.getIconNumberForView(child);
+ int n = child.getStatusBarIcon().number;
if (n == 0) {
number += 1;
} else if (n > 0) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
index e7d8282..155b7d7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/PhoneStatusBarService.java
@@ -233,7 +233,6 @@ public class PhoneStatusBarService extends StatusBarService {
mStatusBarView = sb;
mStatusIcons = (LinearLayout)sb.findViewById(R.id.statusIcons);
mNotificationIcons = (IconMerger)sb.findViewById(R.id.notificationIcons);
- mNotificationIcons.service = this;
mIcons = (LinearLayout)sb.findViewById(R.id.icons);
mTickerView = sb.findViewById(R.id.ticker);
mDateView = (DateView)sb.findViewById(R.id.date);
@@ -268,6 +267,12 @@ public class PhoneStatusBarService extends StatusBarService {
mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);
+ // the more notifications icon
+ StatusBarIconView moreView = new StatusBarIconView(this, "more");
+ moreView.set(new StatusBarIcon(null, R.drawable.stat_notify_more, 0));
+ mNotificationIcons.addMoreView(moreView,
+ new LinearLayout.LayoutParams(mIconWidth, mHeight));
+
// set the inital view visibility
setAreThereNotifications();
mDateView.setVisibility(View.INVISIBLE);
@@ -414,13 +419,13 @@ public class PhoneStatusBarService extends StatusBarService {
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
}
- private int chooseIconIndex(boolean isOngoing, int index) {
- final int ongoingSize = mOngoing.size();
+ private int chooseIconIndex(boolean isOngoing, int viewIndex) {
final int latestSize = mLatest.size();
- if (!isOngoing) {
- index = mLatest.size() + index;
+ if (isOngoing) {
+ return latestSize + (mOngoing.size() - viewIndex);
+ } else {
+ return latestSize - viewIndex;
}
- return (ongoingSize + latestSize) - index - 1;
}
View[] makeNotificationView(StatusBarNotification notification, ViewGroup parent) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 959ac7c..ca5db88 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -124,4 +124,8 @@ public class StatusBarIconView extends AnimatedImageView {
return null;
}
+
+ public StatusBarIcon getStatusBarIcon() {
+ return mIcon;
+ }
}