Taskpublic class Task extends Object A task represents the top most task in the system's task stack. |
Fields Summary |
---|
public TaskKey | key | public TaskGrouping | group | public int | taskAffiliation | public int | taskAffiliationColor | public boolean | isLaunchTarget | public android.graphics.drawable.Drawable | applicationIcon | public android.graphics.drawable.Drawable | activityIcon | public String | activityLabel | public int | colorPrimary | public boolean | useLightOnPrimaryColor | public android.graphics.Bitmap | thumbnail | public boolean | isActive | public boolean | lockToThisTask | public boolean | lockToTaskEnabled | public android.graphics.Bitmap | icon | public String | iconFilename | TaskCallbacks | mCb |
Constructors Summary |
---|
public Task()
// Do nothing
| public Task(TaskKey key, boolean isActive, int taskAffiliation, int taskAffiliationColor, String activityTitle, android.graphics.drawable.Drawable activityIcon, int colorPrimary, boolean lockToThisTask, boolean lockToTaskEnabled, android.graphics.Bitmap icon, String iconFilename)
boolean isInAffiliationGroup = (taskAffiliation != key.id);
boolean hasAffiliationGroupColor = isInAffiliationGroup && (taskAffiliationColor != 0);
this.key = key;
this.taskAffiliation = taskAffiliation;
this.taskAffiliationColor = taskAffiliationColor;
this.activityLabel = activityTitle;
this.activityIcon = activityIcon;
this.colorPrimary = hasAffiliationGroupColor ? taskAffiliationColor : colorPrimary;
this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(this.colorPrimary,
Color.WHITE) > 3f;
this.isActive = isActive;
this.lockToThisTask = lockToTaskEnabled && lockToThisTask;
this.lockToTaskEnabled = lockToTaskEnabled;
this.icon = icon;
this.iconFilename = iconFilename;
|
Methods Summary |
---|
public void | copyFrom(com.android.systemui.recents.model.Task o)Copies the other task.
this.key = o.key;
this.taskAffiliation = o.taskAffiliation;
this.taskAffiliationColor = o.taskAffiliationColor;
this.activityLabel = o.activityLabel;
this.activityIcon = o.activityIcon;
this.colorPrimary = o.colorPrimary;
this.useLightOnPrimaryColor = o.useLightOnPrimaryColor;
this.isActive = o.isActive;
this.lockToThisTask = o.lockToThisTask;
this.lockToTaskEnabled = o.lockToTaskEnabled;
| public boolean | equals(java.lang.Object o)
// Check that the id matches
Task t = (Task) o;
return key.equals(t.key);
| public void | notifyTaskDataLoaded(android.graphics.Bitmap thumbnail, android.graphics.drawable.Drawable applicationIcon)Notifies the callback listeners that this task has been loaded
this.applicationIcon = applicationIcon;
this.thumbnail = thumbnail;
if (mCb != null) {
mCb.onTaskDataLoaded();
}
| public void | notifyTaskDataUnloaded(android.graphics.Bitmap defaultThumbnail, android.graphics.drawable.Drawable defaultApplicationIcon)Notifies the callback listeners that this task has been unloaded
applicationIcon = defaultApplicationIcon;
thumbnail = defaultThumbnail;
if (mCb != null) {
mCb.onTaskDataUnloaded();
}
| public void | setCallbacks(com.android.systemui.recents.model.Task$TaskCallbacks cb)Set the callbacks
mCb = cb;
| public void | setGroup(TaskGrouping group)Set the grouping
if (group != null && this.group != null) {
throw new RuntimeException("This task is already assigned to a group.");
}
this.group = group;
| public java.lang.String | toString()
String groupAffiliation = "no group";
if (group != null) {
groupAffiliation = Integer.toString(group.affiliation);
}
return "Task (" + groupAffiliation + "): " + key.baseIntent.getComponent().getPackageName() +
" [" + super.toString() + "]";
|
|