use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by DirtyUnicorns.
the class RecentsTvActivity method updateRecentsTasks.
private void updateRecentsTasks() {
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoadPlan plan = RecentsImpl.consumeInstanceLoadPlan();
if (plan == null) {
plan = loader.createLoadPlan(this);
}
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
if (!plan.hasTasks()) {
loader.preloadTasks(plan, -1, !launchState.launchedFromHome);
}
int numVisibleTasks = TaskCardView.getNumberOfVisibleTasks(getApplicationContext());
mLaunchedFromHome = launchState.launchedFromHome;
TaskStack stack = plan.getTaskStack();
RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
loadOpts.runningTaskId = launchState.launchedToTaskId;
loadOpts.numVisibleTasks = numVisibleTasks;
loadOpts.numVisibleTaskThumbnails = numVisibleTasks;
loader.loadTasks(this, plan, loadOpts);
List stackTasks = stack.getStackTasks();
Collections.reverse(stackTasks);
if (mTaskStackViewAdapter == null) {
mTaskStackViewAdapter = new TaskStackHorizontalViewAdapter(stackTasks);
mTaskStackHorizontalGridView = mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
mHomeRecentsEnterExitAnimationHolder = new HomeRecentsEnterExitAnimationHolder(getApplicationContext(), mTaskStackHorizontalGridView);
} else {
mTaskStackViewAdapter.setNewStackTasks(stackTasks);
}
mRecentsView.init(stack);
if (launchState.launchedToTaskId != -1) {
ArrayList<Task> tasks = stack.getStackTasks();
int taskCount = tasks.size();
for (int i = 0; i < taskCount; i++) {
Task t = tasks.get(i);
if (t.key.id == launchState.launchedToTaskId) {
t.isLaunchTarget = true;
break;
}
}
}
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by DirtyUnicorns.
the class RecentsTaskLoadPlan method executePlan.
/**
* Called to apply the actual loading based on the specified conditions.
*/
public synchronized void executePlan(Options opts, RecentsTaskLoader loader, TaskResourceLoadQueue loadQueue) {
RecentsConfiguration config = Recents.getConfiguration();
Resources res = mContext.getResources();
// Iterate through each of the tasks and load them according to the load conditions.
ArrayList<Task> tasks = mStack.getStackTasks();
int taskCount = tasks.size();
for (int i = 0; i < taskCount; i++) {
Task task = tasks.get(i);
Task.TaskKey taskKey = task.key;
boolean isRunningTask = (task.key.id == opts.runningTaskId);
boolean isVisibleTask = i >= (taskCount - opts.numVisibleTasks);
boolean isVisibleThumbnail = i >= (taskCount - opts.numVisibleTaskThumbnails);
// If requested, skip the running task
if (opts.onlyLoadPausedActivities && isRunningTask) {
continue;
}
if (opts.loadIcons && (isRunningTask || isVisibleTask)) {
if (task.icon == null) {
task.icon = loader.getAndUpdateActivityIcon(taskKey, task.taskDescription, res, true);
}
}
if (opts.loadThumbnails && (isRunningTask || isVisibleThumbnail)) {
if (task.thumbnail == null || isRunningTask) {
if (config.svelteLevel <= RecentsConfiguration.SVELTE_LIMIT_CACHE) {
task.thumbnail = loader.getAndUpdateThumbnail(taskKey, true);
} else if (config.svelteLevel == RecentsConfiguration.SVELTE_DISABLE_CACHE) {
loadQueue.addTask(task);
}
}
}
}
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by DirtyUnicorns.
the class TaskStackLayoutAlgorithm method getDimensionForDevice.
/**
* Retrieves resources that are constant regardless of the current configuration of the device.
*/
public static int getDimensionForDevice(Context ctx, int phonePortResId, int phoneLandResId, int tabletPortResId, int tabletLandResId, int xlargeTabletPortResId, int xlargeTabletLandResId, int gridLayoutResId) {
RecentsConfiguration config = Recents.getConfiguration();
Resources res = ctx.getResources();
boolean isLandscape = Utilities.getAppConfiguration(ctx).orientation == Configuration.ORIENTATION_LANDSCAPE;
if (config.isGridEnabled) {
return res.getDimensionPixelSize(gridLayoutResId);
} else if (config.isXLargeScreen) {
return res.getDimensionPixelSize(isLandscape ? xlargeTabletLandResId : xlargeTabletPortResId);
} else if (config.isLargeScreen) {
return res.getDimensionPixelSize(isLandscape ? tabletLandResId : tabletPortResId);
} else {
return res.getDimensionPixelSize(isLandscape ? phoneLandResId : phonePortResId);
}
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by DirtyUnicorns.
the class TaskView method updateViewPropertiesToTaskTransform.
void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform, AnimationProps toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
RecentsConfiguration config = Recents.getConfiguration();
cancelTransformAnimation();
// Compose the animations for the transform
mTmpAnimators.clear();
toTransform.applyToTaskView(this, mTmpAnimators, toAnimation, !config.fakeShadows);
if (toAnimation.isImmediate()) {
if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
setDimAlpha(toTransform.dimAlpha);
}
if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
mViewBounds.setAlpha(toTransform.viewOutlineAlpha);
}
// Manually call back to the animator listener and update callback
if (toAnimation.getListener() != null) {
toAnimation.getListener().onAnimationEnd(null);
}
if (updateCallback != null) {
updateCallback.onAnimationUpdate(null);
}
} else {
// Both the progress and the update are a function of the bounds movement of the task
if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
mDimAnimator = ObjectAnimator.ofFloat(this, DIM_ALPHA, getDimAlpha(), toTransform.dimAlpha);
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mDimAnimator));
}
if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
mOutlineAnimator = ObjectAnimator.ofFloat(this, VIEW_OUTLINE_ALPHA, mViewBounds.getAlpha(), toTransform.viewOutlineAlpha);
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mOutlineAnimator));
}
if (updateCallback != null) {
ValueAnimator updateCallbackAnim = ValueAnimator.ofInt(0, 1);
updateCallbackAnim.addUpdateListener(updateCallback);
mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, updateCallbackAnim));
}
// Create the animator
mTransformAnimation = toAnimation.createAnimator(mTmpAnimators);
mTransformAnimation.start();
mTargetAnimationTransform.copyFrom(toTransform);
}
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by DirtyUnicorns.
the class RecentsViewTouchHandler method getDockStatesForCurrentOrientation.
/**
* Returns the preferred dock states for the current orientation.
*/
public TaskStack.DockState[] getDockStatesForCurrentOrientation() {
boolean isLandscape = mRv.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
RecentsConfiguration config = Recents.getConfiguration();
if (config.isLargeScreen) {
return isLandscape ? DockRegion.TABLET_LANDSCAPE : DockRegion.TABLET_PORTRAIT;
} else {
return isLandscape ? DockRegion.PHONE_LANDSCAPE : DockRegion.PHONE_PORTRAIT;
}
}
Aggregations