summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2014-02-28 16:28:52 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-28 16:28:53 +0000
commit9f6a372ca08c657447ef4b8dc6c80a89202247f8 (patch)
tree528c564c15d2a101c52e610165f9d258f9eac447 /core/java
parent595c2c58d54d9bc2bcda6eac92960075806931bd (diff)
parent8fd39ec46b056c88f0d08758d04badab29a8786a (diff)
Merge "create a synthetic 2U heads up notification"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Notification.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 79265959c7d7..b067cd004770 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -204,6 +204,15 @@ public class Notification implements Parcelable
*/
public RemoteViews bigContentView;
+
+ /**
+ * @hide
+ * A medium-format version of {@link #contentView}, giving the Notification an
+ * opportunity to add action buttons to contentView. The system UI may
+ * choose to show this as a popup notification at its discretion.
+ */
+ public RemoteViews headsUpContentView;
+
/**
* The bitmap that may escape the bounds of the panel and bar.
*/
@@ -809,6 +818,10 @@ public class Notification implements Parcelable
bigContentView = RemoteViews.CREATOR.createFromParcel(parcel);
}
+ if (parcel.readInt() != 0) {
+ headsUpContentView = RemoteViews.CREATOR.createFromParcel(parcel);
+ }
+
visibility = parcel.readInt();
if (parcel.readInt() != 0) {
@@ -899,6 +912,10 @@ public class Notification implements Parcelable
that.bigContentView = this.bigContentView.clone();
}
+ if (heavy && this.headsUpContentView != null) {
+ that.headsUpContentView = this.headsUpContentView.clone();
+ }
+
that.visibility = this.visibility;
if (this.publicVersion != null) {
@@ -920,6 +937,7 @@ public class Notification implements Parcelable
tickerView = null;
contentView = null;
bigContentView = null;
+ headsUpContentView = null;
largeIcon = null;
if (extras != null) {
extras.remove(Notification.EXTRA_LARGE_ICON);
@@ -1032,6 +1050,13 @@ public class Notification implements Parcelable
parcel.writeInt(0);
}
+ if (headsUpContentView != null) {
+ parcel.writeInt(1);
+ headsUpContentView.writeToParcel(parcel, 0);
+ } else {
+ parcel.writeInt(0);
+ }
+
parcel.writeInt(visibility);
if (publicVersion != null) {
@@ -1182,6 +1207,9 @@ public class Notification implements Parcelable
if (bigContentView != null) {
bigContentView.setUser(user);
}
+ if (headsUpContentView != null) {
+ headsUpContentView.setUser(user);
+ }
}
/**
@@ -1881,6 +1909,13 @@ public class Notification implements Parcelable
return applyStandardTemplateWithActions(R.layout.notification_template_big_base);
}
+ private RemoteViews makeHEadsUpContentView() {
+ if (mActions.size() == 0) return null;
+
+ return applyStandardTemplateWithActions(R.layout.notification_template_big_base);
+ }
+
+
private RemoteViews generateActionButton(Action action) {
final boolean tombstone = (action.actionIntent == null);
RemoteViews button = new RemoteViews(mContext.getPackageName(),
@@ -1921,6 +1956,7 @@ public class Notification implements Parcelable
n.defaults = mDefaults;
n.flags = mFlags;
n.bigContentView = makeBigContentView();
+ n.headsUpContentView = makeHEadsUpContentView();
if (mLedOnMs != 0 || mLedOffMs != 0) {
n.flags |= FLAG_SHOW_LIGHTS;
}