Search in sources :

Example 21 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration 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);
        }
    }
}
Also used : RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Example 22 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by ResurrectionRemix.

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);
    }
}
Also used : RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) Resources(android.content.res.Resources)

Example 23 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by ResurrectionRemix.

the class TaskStackAnimationHelper method startEnterAnimation.

/**
     * Starts the in-app enter animation, which animates the {@link TaskView}s to their final places
     * depending on how Recents was triggered.
     */
public void startEnterAnimation(final ReferenceCountedTrigger postAnimationTrigger) {
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    Resources res = mStackView.getResources();
    Resources appRes = mStackView.getContext().getApplicationContext().getResources();
    TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
    TaskStackViewScroller stackScroller = mStackView.getScroller();
    TaskStack stack = mStackView.getStack();
    Task launchTargetTask = stack.getLaunchTarget();
    // Break early if there are no tasks
    if (stack.getTaskCount() == 0) {
        return;
    }
    int taskViewEnterFromAppDuration = res.getInteger(R.integer.recents_task_enter_from_app_duration);
    int taskViewEnterFromAffiliatedAppDuration = res.getInteger(R.integer.recents_task_enter_from_affiliated_app_duration);
    int dockGestureAnimDuration = appRes.getInteger(R.integer.long_press_dock_anim_duration);
    // Create enter animations for each of the views from front to back
    List<TaskView> taskViews = mStackView.getTaskViews();
    int taskViewCount = taskViews.size();
    for (int i = taskViewCount - 1; i >= 0; i--) {
        int taskIndexFromFront = taskViewCount - i - 1;
        int taskIndexFromBack = i;
        final TaskView tv = taskViews.get(i);
        Task task = tv.getTask();
        boolean currentTaskOccludesLaunchTarget = launchTargetTask != null && launchTargetTask.group != null && launchTargetTask.group.isTaskAboveTask(task, launchTargetTask);
        // Get the current transform for the task, which will be updated to the final transform
        // to animate to depending on how recents was invoked
        stackLayout.getStackTransform(task, stackScroller.getStackScroll(), mTmpTransform, null);
        if (launchState.launchedFromApp && !launchState.launchedViaDockGesture) {
            if (task.isLaunchTarget) {
                tv.onStartLaunchTargetEnterAnimation(mTmpTransform, taskViewEnterFromAppDuration, mStackView.mScreenPinningEnabled, postAnimationTrigger);
            } else {
                // Animate the task up if it was occluding the launch target
                if (currentTaskOccludesLaunchTarget) {
                    AnimationProps taskAnimation = new AnimationProps(taskViewEnterFromAffiliatedAppDuration, Interpolators.ALPHA_IN, new AnimatorListenerAdapter() {

                        @Override
                        public void onAnimationEnd(Animator animation) {
                            postAnimationTrigger.decrement();
                            tv.setClipViewInStack(true);
                        }
                    });
                    postAnimationTrigger.increment();
                    mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
                }
            }
        } else if (launchState.launchedFromHome) {
            // Animate the tasks up, but offset the animations to be relative to the front-most
            // task animation
            AnimationProps taskAnimation = new AnimationProps().setInitialPlayTime(AnimationProps.BOUNDS, Math.min(ENTER_EXIT_NUM_ANIMATING_TASKS, taskIndexFromFront) * mEnterAndExitFromHomeTranslationOffset).setStartDelay(AnimationProps.ALPHA, Math.min(ENTER_EXIT_NUM_ANIMATING_TASKS, taskIndexFromFront) * FRAME_OFFSET_MS).setDuration(AnimationProps.BOUNDS, ENTER_FROM_HOME_TRANSLATION_DURATION).setDuration(AnimationProps.ALPHA, ENTER_FROM_HOME_ALPHA_DURATION).setInterpolator(AnimationProps.BOUNDS, ENTER_FROM_HOME_TRANSLATION_INTERPOLATOR).setInterpolator(AnimationProps.ALPHA, ENTER_FROM_HOME_ALPHA_INTERPOLATOR).setListener(postAnimationTrigger.decrementOnAnimationEnd());
            postAnimationTrigger.increment();
            mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
            if (i == taskViewCount - 1) {
                tv.onStartFrontTaskEnterAnimation(mStackView.mScreenPinningEnabled);
            }
        } else if (launchState.launchedViaDockGesture) {
            // Animate the tasks up - add some delay to match the divider animation
            AnimationProps taskAnimation = new AnimationProps().setDuration(AnimationProps.BOUNDS, dockGestureAnimDuration + (taskIndexFromBack * DOUBLE_FRAME_OFFSET_MS)).setInterpolator(AnimationProps.BOUNDS, ENTER_WHILE_DOCKING_INTERPOLATOR).setStartDelay(AnimationProps.BOUNDS, 48).setListener(postAnimationTrigger.decrementOnAnimationEnd());
            postAnimationTrigger.increment();
            mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
        }
    }
}
Also used : Task(com.android.systemui.recents.model.Task) TaskStack(com.android.systemui.recents.model.TaskStack) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Resources(android.content.res.Resources)

Example 24 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by ResurrectionRemix.

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;
    }
}
Also used : RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Example 25 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by ResurrectionRemix.

the class RecentsView method startFABanimation.

public void startFABanimation() {
    RecentsConfiguration config = Recents.getConfiguration();
    // Animate the action button in
    mFloatingButton = ((View) getParent()).findViewById(R.id.floating_action_button);
    mFloatingButton.animate().alpha(1f).setStartDelay(config.fabEnterAnimDelay).setDuration(config.fabEnterAnimDuration).setInterpolator(Interpolators.ALPHA_IN).withLayer().start();
}
Also used : RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Aggregations

RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)86 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)45 Resources (android.content.res.Resources)20 Task (com.android.systemui.recents.model.Task)20 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)15 TaskStack (com.android.systemui.recents.model.TaskStack)15 ValueAnimator (android.animation.ValueAnimator)10 RecentsVisibilityChangedEvent (com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent)10 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 ActivityOptions (android.app.ActivityOptions)5 Intent (android.content.Intent)5 ActivityInfo (android.content.pm.ActivityInfo)5 BitmapDrawable (android.graphics.drawable.BitmapDrawable)5 Drawable (android.graphics.drawable.Drawable)5 View (android.view.View)5 EnterRecentsWindowAnimationCompletedEvent (com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent)5 RecentsActivityStartingEvent (com.android.systemui.recents.events.activity.RecentsActivityStartingEvent)5 DeleteTaskDataEvent (com.android.systemui.recents.events.ui.DeleteTaskDataEvent)5 RecentsTaskLoadPlan (com.android.systemui.recents.model.RecentsTaskLoadPlan)5