use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.
the class TaskStackView method onReturnViewToPool.
@Override
public void onReturnViewToPool(TaskView tv) {
final Task task = tv.getTask();
// Unbind the task from the task view
unbindTaskView(tv, task);
// Reset the view properties and view state
tv.clearAccessibilityFocus();
tv.resetViewProperties();
tv.setFocusedState(false, false);
tv.setClipViewInStack(false);
if (mScreenPinningEnabled) {
tv.hideActionButton(false, /* fadeOut */
0, /* duration */
false, /* scaleDown */
null);
}
// Detach the view from the hierarchy
detachViewFromParent(tv);
// Update the task views list after removing the task view
updateTaskViewsList();
}
use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.
the class TaskStackView method onBusEvent.
public final void onBusEvent(UpdateFreeformTaskViewVisibilityEvent event) {
List<TaskView> taskViews = getTaskViews();
int taskViewCount = taskViews.size();
for (int i = 0; i < taskViewCount; i++) {
TaskView tv = taskViews.get(i);
Task task = tv.getTask();
if (task.isFreeformTask()) {
tv.setVisibility(event.visible ? View.VISIBLE : View.INVISIBLE);
}
}
}
use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.
the class TaskStackView method setFocusedTask.
/**
* Sets the focused task to the provided (bounded focusTaskIndex).
*
* @return whether or not the stack will scroll as a part of this focus change
*/
public boolean setFocusedTask(int focusTaskIndex, boolean scrollToTask, boolean requestViewFocus, int timerIndicatorDuration) {
// Find the next task to focus
int newFocusedTaskIndex = mStack.getTaskCount() > 0 ? Utilities.clamp(focusTaskIndex, 0, mStack.getTaskCount() - 1) : -1;
final Task newFocusedTask = (newFocusedTaskIndex != -1) ? mStack.getStackTasks().get(newFocusedTaskIndex) : null;
// Reset the last focused task state if changed
if (mFocusedTask != null) {
// Cancel the timer indicator, if applicable
if (timerIndicatorDuration > 0) {
final TaskView tv = getChildViewForTask(mFocusedTask);
if (tv != null) {
tv.getHeaderView().cancelFocusTimerIndicator();
}
}
resetFocusedTask(mFocusedTask);
}
boolean willScroll = false;
mFocusedTask = newFocusedTask;
if (newFocusedTask != null) {
// Start the timer indicator, if applicable
if (timerIndicatorDuration > 0) {
final TaskView tv = getChildViewForTask(mFocusedTask);
if (tv != null) {
tv.getHeaderView().startFocusTimerIndicator(timerIndicatorDuration);
} else {
// The view is null; set a flag for later
mStartTimerIndicatorDuration = timerIndicatorDuration;
}
}
if (scrollToTask) {
// Cancel any running enter animations at this point when we scroll or change focus
if (!mEnterAnimationComplete) {
cancelAllTaskViewAnimations();
}
mLayoutAlgorithm.clearUnfocusedTaskOverrides();
willScroll = mAnimationHelper.startScrollToFocusedTaskAnimation(newFocusedTask, requestViewFocus);
} else {
// Focus the task view
TaskView newFocusedTaskView = getChildViewForTask(newFocusedTask);
if (newFocusedTaskView != null) {
newFocusedTaskView.setFocusedState(true, requestViewFocus);
}
}
// Any time a task view gets the focus, we move the focus frame around it.
if (mTaskViewFocusFrame != null) {
mTaskViewFocusFrame.moveGridTaskViewFocus(getChildViewForTask(newFocusedTask));
}
}
return willScroll;
}
use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.
the class TaskStackView method getCurrentTaskTransforms.
/**
* Returns the current task transforms of all tasks, falling back to the stack layout if there
* is no {@link TaskView} for the task.
*/
public void getCurrentTaskTransforms(ArrayList<Task> tasks, ArrayList<TaskViewTransform> transformsOut) {
Utilities.matchTaskListSize(tasks, transformsOut);
int focusState = mLayoutAlgorithm.getFocusState();
for (int i = tasks.size() - 1; i >= 0; i--) {
Task task = tasks.get(i);
TaskViewTransform transform = transformsOut.get(i);
TaskView tv = getChildViewForTask(task);
if (tv != null) {
transform.fillIn(tv);
} else {
mLayoutAlgorithm.getStackTransform(task, mStackScroller.getStackScroll(), focusState, transform, null, true, /* forceUpdate */
false);
}
transform.visible = true;
}
}
use of com.android.systemui.recents.model.Task in project android_frameworks_base by AOSPA.
the class TaskStackView method computeVisibleTaskTransforms.
/**
* Computes the task transforms at the current stack scroll for all visible tasks. If a valid
* target stack scroll is provided (ie. is different than {@param curStackScroll}), then the
* visible range includes all tasks at the target stack scroll. This is useful for ensure that
* all views necessary for a transition or animation will be visible at the start.
*
* This call ignores freeform tasks.
*
* @param taskTransforms The set of task view transforms to reuse, this list will be sized to
* match the size of {@param tasks}
* @param tasks The set of tasks for which to generate transforms
* @param curStackScroll The current stack scroll
* @param targetStackScroll The stack scroll that we anticipate we are going to be scrolling to.
* The range of the union of the visible views at the current and
* target stack scrolls will be returned.
* @param ignoreTasksSet The set of tasks to skip for purposes of calculaing the visible range.
* Transforms will still be calculated for the ignore tasks.
* @return the front and back most visible task indices (there may be non visible tasks in
* between this range)
*/
int[] computeVisibleTaskTransforms(ArrayList<TaskViewTransform> taskTransforms, ArrayList<Task> tasks, float curStackScroll, float targetStackScroll, ArraySet<Task.TaskKey> ignoreTasksSet, boolean ignoreTaskOverrides) {
int taskCount = tasks.size();
int[] visibleTaskRange = mTmpIntPair;
visibleTaskRange[0] = -1;
visibleTaskRange[1] = -1;
boolean useTargetStackScroll = Float.compare(curStackScroll, targetStackScroll) != 0;
// We can reuse the task transforms where possible to reduce object allocation
Utilities.matchTaskListSize(tasks, taskTransforms);
// Update the stack transforms
TaskViewTransform frontTransform = null;
TaskViewTransform frontTransformAtTarget = null;
TaskViewTransform transform = null;
TaskViewTransform transformAtTarget = null;
for (int i = taskCount - 1; i >= 0; i--) {
Task task = tasks.get(i);
// Calculate the current and (if necessary) the target transform for the task
transform = mLayoutAlgorithm.getStackTransform(task, curStackScroll, taskTransforms.get(i), frontTransform, ignoreTaskOverrides);
if (useTargetStackScroll && !transform.visible) {
// If we have a target stack scroll and the task is not currently visible, then we
// just update the transform at the new scroll
// TODO: Optimize this
transformAtTarget = mLayoutAlgorithm.getStackTransform(task, targetStackScroll, new TaskViewTransform(), frontTransformAtTarget);
if (transformAtTarget.visible) {
transform.copyFrom(transformAtTarget);
}
}
// visible stack indices
if (ignoreTasksSet.contains(task.key)) {
continue;
}
// the visible stack indices
if (task.isFreeformTask()) {
continue;
}
frontTransform = transform;
frontTransformAtTarget = transformAtTarget;
if (transform.visible) {
if (visibleTaskRange[0] < 0) {
visibleTaskRange[0] = i;
}
visibleTaskRange[1] = i;
}
}
return visibleTaskRange;
}
Aggregations