* commit '19d6dae447860c332501f7284e97c2734f7a040e': Icon-related Notifications API changes:
This commit is contained in:
@@ -4772,9 +4772,9 @@ package android.app {
|
|||||||
field public int flags;
|
field public int flags;
|
||||||
field public android.app.PendingIntent fullScreenIntent;
|
field public android.app.PendingIntent fullScreenIntent;
|
||||||
field public android.widget.RemoteViews headsUpContentView;
|
field public android.widget.RemoteViews headsUpContentView;
|
||||||
field public int icon;
|
field public deprecated int icon;
|
||||||
field public int iconLevel;
|
field public int iconLevel;
|
||||||
field public android.graphics.Bitmap largeIcon;
|
field public deprecated android.graphics.Bitmap largeIcon;
|
||||||
field public int ledARGB;
|
field public int ledARGB;
|
||||||
field public int ledOffMS;
|
field public int ledOffMS;
|
||||||
field public int ledOnMS;
|
field public int ledOnMS;
|
||||||
@@ -4790,20 +4790,22 @@ package android.app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Notification.Action implements android.os.Parcelable {
|
public static class Notification.Action implements android.os.Parcelable {
|
||||||
ctor public Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent);
|
ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
method public android.app.Notification.Action clone();
|
method public android.app.Notification.Action clone();
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public android.os.Bundle getExtras();
|
method public android.os.Bundle getExtras();
|
||||||
|
method public android.graphics.drawable.Icon getIcon();
|
||||||
method public android.app.RemoteInput[] getRemoteInputs();
|
method public android.app.RemoteInput[] getRemoteInputs();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field public static final android.os.Parcelable.Creator<android.app.Notification.Action> CREATOR;
|
field public static final android.os.Parcelable.Creator<android.app.Notification.Action> CREATOR;
|
||||||
field public android.app.PendingIntent actionIntent;
|
field public android.app.PendingIntent actionIntent;
|
||||||
field public int icon;
|
field public deprecated int icon;
|
||||||
field public java.lang.CharSequence title;
|
field public java.lang.CharSequence title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Notification.Action.Builder {
|
public static final class Notification.Action.Builder {
|
||||||
ctor public Notification.Action.Builder(int, java.lang.CharSequence, android.app.PendingIntent);
|
ctor public deprecated Notification.Action.Builder(int, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
|
ctor public Notification.Action.Builder(android.graphics.drawable.Icon, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
ctor public Notification.Action.Builder(android.app.Notification.Action);
|
ctor public Notification.Action.Builder(android.app.Notification.Action);
|
||||||
method public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
|
method public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
|
||||||
method public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
|
method public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
|
||||||
@@ -4851,7 +4853,7 @@ package android.app {
|
|||||||
|
|
||||||
public static class Notification.Builder {
|
public static class Notification.Builder {
|
||||||
ctor public Notification.Builder(android.content.Context);
|
ctor public Notification.Builder(android.content.Context);
|
||||||
method public android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
|
method public deprecated android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
|
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
|
||||||
method public android.app.Notification.Builder addExtras(android.os.Bundle);
|
method public android.app.Notification.Builder addExtras(android.os.Bundle);
|
||||||
method public android.app.Notification.Builder addPerson(java.lang.String);
|
method public android.app.Notification.Builder addPerson(java.lang.String);
|
||||||
|
|||||||
@@ -4890,9 +4890,9 @@ package android.app {
|
|||||||
field public int flags;
|
field public int flags;
|
||||||
field public android.app.PendingIntent fullScreenIntent;
|
field public android.app.PendingIntent fullScreenIntent;
|
||||||
field public android.widget.RemoteViews headsUpContentView;
|
field public android.widget.RemoteViews headsUpContentView;
|
||||||
field public int icon;
|
field public deprecated int icon;
|
||||||
field public int iconLevel;
|
field public int iconLevel;
|
||||||
field public android.graphics.Bitmap largeIcon;
|
field public deprecated android.graphics.Bitmap largeIcon;
|
||||||
field public int ledARGB;
|
field public int ledARGB;
|
||||||
field public int ledOffMS;
|
field public int ledOffMS;
|
||||||
field public int ledOnMS;
|
field public int ledOnMS;
|
||||||
@@ -4908,20 +4908,22 @@ package android.app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Notification.Action implements android.os.Parcelable {
|
public static class Notification.Action implements android.os.Parcelable {
|
||||||
ctor public Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent);
|
ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
method public android.app.Notification.Action clone();
|
method public android.app.Notification.Action clone();
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public android.os.Bundle getExtras();
|
method public android.os.Bundle getExtras();
|
||||||
|
method public android.graphics.drawable.Icon getIcon();
|
||||||
method public android.app.RemoteInput[] getRemoteInputs();
|
method public android.app.RemoteInput[] getRemoteInputs();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field public static final android.os.Parcelable.Creator<android.app.Notification.Action> CREATOR;
|
field public static final android.os.Parcelable.Creator<android.app.Notification.Action> CREATOR;
|
||||||
field public android.app.PendingIntent actionIntent;
|
field public android.app.PendingIntent actionIntent;
|
||||||
field public int icon;
|
field public deprecated int icon;
|
||||||
field public java.lang.CharSequence title;
|
field public java.lang.CharSequence title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Notification.Action.Builder {
|
public static final class Notification.Action.Builder {
|
||||||
ctor public Notification.Action.Builder(int, java.lang.CharSequence, android.app.PendingIntent);
|
ctor public deprecated Notification.Action.Builder(int, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
|
ctor public Notification.Action.Builder(android.graphics.drawable.Icon, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
ctor public Notification.Action.Builder(android.app.Notification.Action);
|
ctor public Notification.Action.Builder(android.app.Notification.Action);
|
||||||
method public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
|
method public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
|
||||||
method public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
|
method public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
|
||||||
@@ -4969,7 +4971,7 @@ package android.app {
|
|||||||
|
|
||||||
public static class Notification.Builder {
|
public static class Notification.Builder {
|
||||||
ctor public Notification.Builder(android.content.Context);
|
ctor public Notification.Builder(android.content.Context);
|
||||||
method public android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
|
method public deprecated android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
|
||||||
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
|
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
|
||||||
method public android.app.Notification.Builder addExtras(android.os.Bundle);
|
method public android.app.Notification.Builder addExtras(android.os.Bundle);
|
||||||
method public android.app.Notification.Builder addPerson(java.lang.String);
|
method public android.app.Notification.Builder addPerson(java.lang.String);
|
||||||
|
|||||||
@@ -166,8 +166,10 @@ public class Notification implements Parcelable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The resource id of a drawable to use as the icon in the status bar.
|
* The resource id of a drawable to use as the icon in the status bar.
|
||||||
* This is required; notifications with an invalid icon resource will not be shown.
|
*
|
||||||
|
* @deprecated Use {@link Builder#setSmallIcon(Icon)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
public int icon;
|
public int icon;
|
||||||
|
|
||||||
@@ -269,8 +271,11 @@ public class Notification implements Parcelable
|
|||||||
public RemoteViews headsUpContentView;
|
public RemoteViews headsUpContentView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bitmap that may escape the bounds of the panel and bar.
|
* A large bitmap to be shown in the notification content area.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link Builder#setLargeIcon(Icon)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public Bitmap largeIcon;
|
public Bitmap largeIcon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -900,11 +905,15 @@ public class Notification implements Parcelable
|
|||||||
*/
|
*/
|
||||||
public static class Action implements Parcelable {
|
public static class Action implements Parcelable {
|
||||||
private final Bundle mExtras;
|
private final Bundle mExtras;
|
||||||
|
private Icon mIcon;
|
||||||
private final RemoteInput[] mRemoteInputs;
|
private final RemoteInput[] mRemoteInputs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Small icon representing the action.
|
* Small icon representing the action.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link Action#getIcon()} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public int icon;
|
public int icon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -919,7 +928,12 @@ public class Notification implements Parcelable
|
|||||||
public PendingIntent actionIntent;
|
public PendingIntent actionIntent;
|
||||||
|
|
||||||
private Action(Parcel in) {
|
private Action(Parcel in) {
|
||||||
icon = in.readInt();
|
if (in.readInt() != 0) {
|
||||||
|
mIcon = Icon.CREATOR.createFromParcel(in);
|
||||||
|
}
|
||||||
|
if (mIcon.getType() == Icon.TYPE_RESOURCE) {
|
||||||
|
icon = mIcon.getResId();
|
||||||
|
}
|
||||||
title = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
|
title = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
|
||||||
if (in.readInt() == 1) {
|
if (in.readInt() == 1) {
|
||||||
actionIntent = PendingIntent.CREATOR.createFromParcel(in);
|
actionIntent = PendingIntent.CREATOR.createFromParcel(in);
|
||||||
@@ -929,21 +943,33 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use {@link Notification.Builder#addAction(int, CharSequence, PendingIntent)}.
|
* @deprecated Use {@link android.app.Notification.Action.Builder}.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public Action(int icon, CharSequence title, PendingIntent intent) {
|
public Action(int icon, CharSequence title, PendingIntent intent) {
|
||||||
this(icon, title, intent, new Bundle(), null);
|
this(Icon.createWithResource("", icon), title, intent, new Bundle(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Action(int icon, CharSequence title, PendingIntent intent, Bundle extras,
|
private Action(Icon icon, CharSequence title, PendingIntent intent, Bundle extras,
|
||||||
RemoteInput[] remoteInputs) {
|
RemoteInput[] remoteInputs) {
|
||||||
this.icon = icon;
|
this.mIcon = icon;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.actionIntent = intent;
|
this.actionIntent = intent;
|
||||||
this.mExtras = extras != null ? extras : new Bundle();
|
this.mExtras = extras != null ? extras : new Bundle();
|
||||||
this.mRemoteInputs = remoteInputs;
|
this.mRemoteInputs = remoteInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an icon representing the action.
|
||||||
|
*/
|
||||||
|
public Icon getIcon() {
|
||||||
|
if (mIcon == null && icon != 0) {
|
||||||
|
// you snuck an icon in here without using the builder; let's try to keep it
|
||||||
|
mIcon = Icon.createWithResource("", icon);
|
||||||
|
}
|
||||||
|
return mIcon;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get additional metadata carried around with this Action.
|
* Get additional metadata carried around with this Action.
|
||||||
*/
|
*/
|
||||||
@@ -963,7 +989,7 @@ public class Notification implements Parcelable
|
|||||||
* Builder class for {@link Action} objects.
|
* Builder class for {@link Action} objects.
|
||||||
*/
|
*/
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private final int mIcon;
|
private final Icon mIcon;
|
||||||
private final CharSequence mTitle;
|
private final CharSequence mTitle;
|
||||||
private final PendingIntent mIntent;
|
private final PendingIntent mIntent;
|
||||||
private final Bundle mExtras;
|
private final Bundle mExtras;
|
||||||
@@ -975,7 +1001,18 @@ public class Notification implements Parcelable
|
|||||||
* @param title the title of the action
|
* @param title the title of the action
|
||||||
* @param intent the {@link PendingIntent} to fire when users trigger this action
|
* @param intent the {@link PendingIntent} to fire when users trigger this action
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public Builder(int icon, CharSequence title, PendingIntent intent) {
|
public Builder(int icon, CharSequence title, PendingIntent intent) {
|
||||||
|
this(Icon.createWithResource("", icon), title, intent, new Bundle(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new builder for {@link Action} object.
|
||||||
|
* @param icon icon to show for this action
|
||||||
|
* @param title the title of the action
|
||||||
|
* @param intent the {@link PendingIntent} to fire when users trigger this action
|
||||||
|
*/
|
||||||
|
public Builder(Icon icon, CharSequence title, PendingIntent intent) {
|
||||||
this(icon, title, intent, new Bundle(), null);
|
this(icon, title, intent, new Bundle(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,11 +1022,11 @@ public class Notification implements Parcelable
|
|||||||
* @param action the action to read fields from.
|
* @param action the action to read fields from.
|
||||||
*/
|
*/
|
||||||
public Builder(Action action) {
|
public Builder(Action action) {
|
||||||
this(action.icon, action.title, action.actionIntent, new Bundle(action.mExtras),
|
this(action.getIcon(), action.title, action.actionIntent, new Bundle(action.mExtras),
|
||||||
action.getRemoteInputs());
|
action.getRemoteInputs());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Builder(int icon, CharSequence title, PendingIntent intent, Bundle extras,
|
private Builder(Icon icon, CharSequence title, PendingIntent intent, Bundle extras,
|
||||||
RemoteInput[] remoteInputs) {
|
RemoteInput[] remoteInputs) {
|
||||||
mIcon = icon;
|
mIcon = icon;
|
||||||
mTitle = title;
|
mTitle = title;
|
||||||
@@ -1063,7 +1100,7 @@ public class Notification implements Parcelable
|
|||||||
@Override
|
@Override
|
||||||
public Action clone() {
|
public Action clone() {
|
||||||
return new Action(
|
return new Action(
|
||||||
icon,
|
getIcon(),
|
||||||
title,
|
title,
|
||||||
actionIntent, // safe to alias
|
actionIntent, // safe to alias
|
||||||
new Bundle(mExtras),
|
new Bundle(mExtras),
|
||||||
@@ -1075,7 +1112,13 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel out, int flags) {
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
out.writeInt(icon);
|
final Icon ic = getIcon();
|
||||||
|
if (ic != null) {
|
||||||
|
out.writeInt(1);
|
||||||
|
ic.writeToParcel(out, 0);
|
||||||
|
} else {
|
||||||
|
out.writeInt(0);
|
||||||
|
}
|
||||||
TextUtils.writeToParcel(title, out, flags);
|
TextUtils.writeToParcel(title, out, flags);
|
||||||
if (actionIntent != null) {
|
if (actionIntent != null) {
|
||||||
out.writeInt(1);
|
out.writeInt(1);
|
||||||
@@ -2725,7 +2768,10 @@ public class Notification implements Parcelable
|
|||||||
* @param icon Resource ID of a drawable that represents the action.
|
* @param icon Resource ID of a drawable that represents the action.
|
||||||
* @param title Text describing the action.
|
* @param title Text describing the action.
|
||||||
* @param intent PendingIntent to be fired when the action is invoked.
|
* @param intent PendingIntent to be fired when the action is invoked.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link #addAction(Action)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public Builder addAction(int icon, CharSequence title, PendingIntent intent) {
|
public Builder addAction(int icon, CharSequence title, PendingIntent intent) {
|
||||||
mActions.add(new Action(icon, safeCharSequence(title), intent));
|
mActions.add(new Action(icon, safeCharSequence(title), intent));
|
||||||
return this;
|
return this;
|
||||||
@@ -4265,7 +4311,7 @@ public class Notification implements Parcelable
|
|||||||
*
|
*
|
||||||
* In the expanded form, {@link Notification#bigContentView}, up to 5
|
* In the expanded form, {@link Notification#bigContentView}, up to 5
|
||||||
* {@link Notification.Action}s specified with
|
* {@link Notification.Action}s specified with
|
||||||
* {@link Notification.Builder#addAction(int, CharSequence, PendingIntent) addAction} will be
|
* {@link Notification.Builder#addAction(Action) addAction} will be
|
||||||
* shown as icon-only pushbuttons, suitable for transport controls. The Bitmap given to
|
* shown as icon-only pushbuttons, suitable for transport controls. The Bitmap given to
|
||||||
* {@link Notification.Builder#setLargeIcon(android.graphics.Bitmap) setLargeIcon()} will be
|
* {@link Notification.Builder#setLargeIcon(android.graphics.Bitmap) setLargeIcon()} will be
|
||||||
* treated as album artwork.
|
* treated as album artwork.
|
||||||
|
|||||||
Reference in New Issue
Block a user