use of com.android.systemui.recents.RecentsActivityLaunchState in project android_frameworks_base by AOSPA.
the class TaskStackLayoutAlgorithm method setTaskOverridesForInitialState.
/**
* Creates task overrides to ensure the initial stack layout if necessary.
*/
public void setTaskOverridesForInitialState(TaskStack stack, boolean ignoreScrollToFront) {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
mTaskIndexOverrideMap.clear();
boolean scrollToFront = launchState.launchedFromHome || launchState.launchedFromBlacklistedApp || launchState.launchedViaDockGesture;
if (getInitialFocusState() == STATE_UNFOCUSED && mNumStackTasks > 1) {
if (ignoreScrollToFront || (!launchState.launchedWithAltTab && !scrollToFront)) {
// Set the initial scroll to the predefined state (which differs from the stack)
float[] initialNormX = null;
float minBottomTaskNormX = getNormalizedXFromUnfocusedY(mSystemInsets.bottom + mInitialBottomOffset, FROM_BOTTOM);
float maxBottomTaskNormX = getNormalizedXFromUnfocusedY(mFocusedTopPeekHeight + mTaskRect.height() - mMinMargin, FROM_TOP);
if (mNumStackTasks <= 2) {
// For small stacks, position the tasks so that they are top aligned to under
// the action button, but ensure that it is at least a certain offset from the
// bottom of the stack
initialNormX = new float[] { Math.min(maxBottomTaskNormX, minBottomTaskNormX), getNormalizedXFromUnfocusedY(mFocusedTopPeekHeight, FROM_TOP) };
} else {
initialNormX = new float[] { minBottomTaskNormX, getNormalizedXFromUnfocusedY(mInitialTopOffset, FROM_TOP) };
}
mUnfocusedRange.offset(0f);
List<Task> tasks = stack.getStackTasks();
int taskCount = tasks.size();
for (int i = taskCount - 1; i >= 0; i--) {
int indexFromFront = taskCount - i - 1;
if (indexFromFront >= initialNormX.length) {
break;
}
float newTaskProgress = mInitialScrollP + mUnfocusedRange.getAbsoluteX(initialNormX[indexFromFront]);
mTaskIndexOverrideMap.put(tasks.get(i).key.id, newTaskProgress);
}
}
}
}
use of com.android.systemui.recents.RecentsActivityLaunchState in project android_frameworks_base by AOSPA.
the class TaskStackView method onBusEvent.
public final void onBusEvent(final MultiWindowStateChangedEvent event) {
if (event.inMultiWindow || !event.showDeferredAnimation) {
setTasks(event.stack, true);
} else {
// Reset the launch state before handling the multiwindow change
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
launchState.reset();
// Defer until the next frame to ensure that we have received all the system insets, and
// initial layout updates
event.getAnimationTrigger().increment();
post(new Runnable() {
@Override
public void run() {
// Scroll the stack to the front to see the undocked task
mAnimationHelper.startNewStackScrollAnimation(event.stack, event.getAnimationTrigger());
event.getAnimationTrigger().decrement();
}
});
}
}
use of com.android.systemui.recents.RecentsActivityLaunchState in project android_frameworks_base by AOSPA.
the class RecentsView method onLayout.
/**
* This is called with the full size of the window since we are handling our own insets.
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mTaskStackView.getVisibility() != GONE) {
mTaskStackView.layout(left, top, left + getMeasuredWidth(), top + getMeasuredHeight());
}
// Layout the empty view
if (mEmptyView.getVisibility() != GONE) {
int leftRightInsets = mSystemInsets.left + mSystemInsets.right;
int topBottomInsets = mSystemInsets.top + mSystemInsets.bottom;
int childWidth = mEmptyView.getMeasuredWidth();
int childHeight = mEmptyView.getMeasuredHeight();
int childLeft = left + mSystemInsets.left + Math.max(0, (right - left - leftRightInsets - childWidth)) / 2;
int childTop = top + mSystemInsets.top + Math.max(0, (bottom - top - topBottomInsets - childHeight)) / 2;
mEmptyView.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
}
if (RecentsDebugFlags.Static.EnableStackActionButton) {
// Layout the stack action button such that its drawable is start-aligned with the
// stack, vertically centered in the available space above the stack
Rect buttonBounds = getStackActionButtonBoundsFromStackLayout();
mStackActionButton.layout(buttonBounds.left, buttonBounds.top, buttonBounds.right, buttonBounds.bottom);
}
if (mAwaitingFirstLayout) {
mAwaitingFirstLayout = false;
// If launched via dragging from the nav bar, then we should translate the whole view
// down offscreen
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
if (launchState.launchedViaDragGesture) {
setTranslationY(getMeasuredHeight());
} else {
setTranslationY(0f);
}
}
}
use of com.android.systemui.recents.RecentsActivityLaunchState in project android_frameworks_base by AOSPA.
the class RecentsTvView method init.
/**
* Initialize the view.
*/
public void init(TaskStack stack) {
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
mStack = stack;
mTaskStackHorizontalView.init(stack);
if (stack.getStackTaskCount() > 0) {
hideEmptyView();
} else {
showEmptyView();
}
// Layout with the new stack
requestLayout();
}
use of com.android.systemui.recents.RecentsActivityLaunchState in project android_frameworks_base by AOSPA.
the class RecentsView method onReload.
/**
* Called from RecentsActivity when it is relaunched.
*/
public void onReload(boolean isResumingFromVisible, boolean isTaskStackEmpty) {
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
if (mTaskStackView == null) {
isResumingFromVisible = false;
mTaskStackView = new TaskStackView(getContext());
mTaskStackView.setSystemInsets(mSystemInsets);
addView(mTaskStackView);
}
// Reset the state
mAwaitingFirstLayout = !isResumingFromVisible;
mLastTaskLaunchedWasFreeform = false;
// Update the stack
mTaskStackView.onReload(isResumingFromVisible);
if (isResumingFromVisible) {
// If we are already visible, then restore the background scrim
animateBackgroundScrim(1f, DEFAULT_UPDATE_SCRIM_DURATION);
} else {
// the tasks for the home animation.
if (launchState.launchedViaDockGesture || launchState.launchedFromApp || isTaskStackEmpty) {
mBackgroundScrim.setAlpha(255);
} else {
mBackgroundScrim.setAlpha(0);
}
}
}
Aggregations