diff options
| author | Joe Onorato <joeo@google.com> | 2010-11-19 18:12:07 -0800 |
|---|---|---|
| committer | Joe Onorato <joeo@google.com> | 2010-11-21 16:16:28 -0800 |
| commit | 8595a3dd9a6feff70f8ddbad924d79b591d611e4 (patch) | |
| tree | 4812cf3728cfd931cdfaa0e87746369d645325aa /core/java/android/app/Notification.java | |
| parent | 46439cec0eb0da4d0f853f2d8712d0c00c98475b (diff) | |
| download | frameworks_base-8595a3dd9a6feff70f8ddbad924d79b591d611e4.zip frameworks_base-8595a3dd9a6feff70f8ddbad924d79b591d611e4.tar.gz frameworks_base-8595a3dd9a6feff70f8ddbad924d79b591d611e4.tar.bz2 | |
Show the number in the expanded notification instead of in the bar.
Change-Id: I248b4fe1732ed290e9f3f9c094de4544a0e396ab
Diffstat (limited to 'core/java/android/app/Notification.java')
| -rw-r--r-- | core/java/android/app/Notification.java | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 09319b9..7eab7c8 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -16,6 +16,7 @@ package android.app; +import java.text.NumberFormat; import java.util.Date; import android.app.PendingIntent; @@ -30,6 +31,7 @@ import android.text.TextUtils; import android.text.format.DateFormat; import android.text.format.DateUtils; import android.util.Slog; +import android.view.View; import android.widget.RemoteViews; /** @@ -607,7 +609,7 @@ public class Notification implements Parcelable private long mWhen; private int mSmallIcon; private int mSmallIconLevel; - private int mSmallIconNumber; + private int mNumber; private CharSequence mContentTitle; private CharSequence mContentText; private CharSequence mContentInfo; @@ -648,11 +650,6 @@ public class Notification implements Parcelable return this; } - public Builder setSmallIconNumber(int number) { - mSmallIconNumber = number; - return this; - } - public Builder setContentTitle(CharSequence title) { mContentTitle = title; return this; @@ -663,6 +660,11 @@ public class Notification implements Parcelable return this; } + public Builder setNumber(int number) { + mNumber = number; + return this; + } + public Builder setContentInfo(CharSequence info) { mContentInfo = info; return this; @@ -767,10 +769,17 @@ public class Notification implements Parcelable if (mContentText != null) { contentView.setTextViewText(com.android.internal.R.id.text, mContentText); } - //TODO - //if (mContentInfo) { - // contentVeiw.setTextViewText(com.android.internal.R.id.info, mContentInfo); - //} + if (mContentInfo != null) { + contentView.setTextViewText(com.android.internal.R.id.info, mContentInfo); + } else if (mNumber > 0) { + NumberFormat f = NumberFormat.getIntegerInstance(); + contentView.setTextViewText(com.android.internal.R.id.info, f.format(mNumber)); + contentView.setFloat(com.android.internal.R.id.info, "setTextSize", + mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.status_bar_content_number_size)); + } else { + contentView.setViewVisibility(com.android.internal.R.id.info, View.GONE); + } if (mWhen != 0) { contentView.setLong(com.android.internal.R.id.time, "setTime", mWhen); } @@ -791,7 +800,7 @@ public class Notification implements Parcelable n.when = mWhen; n.icon = mSmallIcon; n.iconLevel = mSmallIconLevel; - n.number = mSmallIconNumber; + n.number = mNumber; n.contentView = makeContentView(); n.contentIntent = mContentIntent; n.deleteIntent = mDeleteIntent; |
