Checkpoint. Data structures for Notifications in place.
Change-Id: I146fb9bc1d349112541368e2c99a667821dfdf6e
This commit is contained in:
@@ -341,6 +341,44 @@ public class Notification implements Parcelable
|
||||
iconLevel = parcel.readInt();
|
||||
}
|
||||
|
||||
public Notification clone() {
|
||||
Notification that = new Notification();
|
||||
|
||||
that.when = this.when;
|
||||
that.icon = this.icon;
|
||||
that.number = this.number;
|
||||
|
||||
// PendingIntents are global, so there's no reason (or way) to clone them.
|
||||
that.contentIntent = this.contentIntent;
|
||||
that.deleteIntent = this.deleteIntent;
|
||||
|
||||
if (this.tickerText != null) {
|
||||
that.tickerText = this.tickerText.toString();
|
||||
}
|
||||
if (this.contentView != null) {
|
||||
that.contentView = this.contentView.clone();
|
||||
}
|
||||
that.iconLevel = that.iconLevel;
|
||||
that.sound = this.sound; // android.net.Uri is immutable
|
||||
that.audioStreamType = this.audioStreamType;
|
||||
|
||||
final long[] vibrate = this.vibrate;
|
||||
if (vibrate != null) {
|
||||
final int N = vibrate.length;
|
||||
final long[] vib = that.vibrate = new long[N];
|
||||
System.arraycopy(vibrate, 0, vib, 0, N);
|
||||
}
|
||||
|
||||
that.ledARGB = this.ledARGB;
|
||||
that.ledOnMS = this.ledOnMS;
|
||||
that.ledOffMS = this.ledOffMS;
|
||||
that.defaults = this.defaults;
|
||||
|
||||
that.flags = this.flags;
|
||||
|
||||
return that;
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
* Base class for all actions that can be performed on an
|
||||
* inflated view.
|
||||
*
|
||||
* SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!!
|
||||
*/
|
||||
private abstract static class Action implements Parcelable {
|
||||
public abstract void apply(View root) throws ActionException;
|
||||
@@ -568,6 +569,14 @@ public class RemoteViews implements Parcelable, Filter {
|
||||
}
|
||||
}
|
||||
|
||||
public RemoteViews clone() {
|
||||
final RemoteViews that = new RemoteViews(mPackage, mLayoutId);
|
||||
if (mActions != null) {
|
||||
that.mActions = (ArrayList<Action>)mActions.clone();
|
||||
}
|
||||
return that;
|
||||
}
|
||||
|
||||
public String getPackage() {
|
||||
return mPackage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user