|
|
|
@ -6,9 +6,7 @@
|
|
|
|
|
package com.todoroo.astrid.api;
|
|
|
|
|
|
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
|
import android.os.Parcel;
|
|
|
|
|
import android.os.Parcelable;
|
|
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Represents an intent that can be called on a task
|
|
|
|
@ -16,7 +14,7 @@ import android.os.Parcelable;
|
|
|
|
|
* @author Tim Su <tim@todoroo.com>
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public class TaskAction implements Parcelable {
|
|
|
|
|
public class TaskAction {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Label
|
|
|
|
@ -31,7 +29,7 @@ public class TaskAction implements Parcelable {
|
|
|
|
|
/**
|
|
|
|
|
* Quick action icon
|
|
|
|
|
*/
|
|
|
|
|
public Bitmap icon = null;
|
|
|
|
|
public BitmapDrawable icon = null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Quick action drawable resource
|
|
|
|
@ -46,7 +44,7 @@ public class TaskAction implements Parcelable {
|
|
|
|
|
* @param intent
|
|
|
|
|
* intent to invoke. {@link #EXTRAS_TASK_ID} will be passed
|
|
|
|
|
*/
|
|
|
|
|
public TaskAction(String text, PendingIntent intent, Bitmap icon) {
|
|
|
|
|
public TaskAction(String text, PendingIntent intent, BitmapDrawable icon) {
|
|
|
|
|
super();
|
|
|
|
|
this.text = text;
|
|
|
|
|
this.intent = intent;
|
|
|
|
@ -61,38 +59,38 @@ public class TaskAction implements Parcelable {
|
|
|
|
|
public int describeContents() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
public void writeToParcel(Parcel dest, int flags) {
|
|
|
|
|
dest.writeString(text);
|
|
|
|
|
dest.writeParcelable(intent, 0);
|
|
|
|
|
dest.writeParcelable(icon, 0);
|
|
|
|
|
dest.writeInt(drawable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parcelable creator
|
|
|
|
|
*/
|
|
|
|
|
public static final Parcelable.Creator<TaskAction> CREATOR = new Parcelable.Creator<TaskAction>() {
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
public TaskAction createFromParcel(Parcel source) {
|
|
|
|
|
TaskAction action = new TaskAction(source.readString(),
|
|
|
|
|
(PendingIntent)source.readParcelable(PendingIntent.class.getClassLoader()),
|
|
|
|
|
(Bitmap)source.readParcelable(Bitmap.class.getClassLoader()));
|
|
|
|
|
action.drawable = source.readInt();
|
|
|
|
|
return action;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
public TaskAction[] newArray(int size) {
|
|
|
|
|
return new TaskAction[size];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * {@inheritDoc}
|
|
|
|
|
// */
|
|
|
|
|
// public void writeToParcel(Parcel dest, int flags) {
|
|
|
|
|
// dest.writeString(text);
|
|
|
|
|
// dest.writeParcelable(intent, 0);
|
|
|
|
|
// dest.writeParcelable(icon, 0);
|
|
|
|
|
// dest.writeInt(drawable);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * Parcelable creator
|
|
|
|
|
// */
|
|
|
|
|
// public static final Parcelable.Creator<TaskAction> CREATOR = new Parcelable.Creator<TaskAction>() {
|
|
|
|
|
// /**
|
|
|
|
|
// * {@inheritDoc}
|
|
|
|
|
// */
|
|
|
|
|
// public TaskAction createFromParcel(Parcel source) {
|
|
|
|
|
// TaskAction action = new TaskAction(source.readString(),
|
|
|
|
|
// (PendingIntent)source.readParcelable(PendingIntent.class.getClassLoader()),
|
|
|
|
|
// (Bitmap)source.readParcelable(Bitmap.class.getClassLoader()));
|
|
|
|
|
// action.drawable = source.readInt();
|
|
|
|
|
// return action;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * {@inheritDoc}
|
|
|
|
|
// */
|
|
|
|
|
// public TaskAction[] newArray(int size) {
|
|
|
|
|
// return new TaskAction[size];
|
|
|
|
|
// };
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|