Search in sources :

Example 66 with PagedOrientationHandler

use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaskViewTouchController method onDragStart.

@Override
public void onDragStart(boolean start, float startDisplacement) {
    PagedOrientationHandler orientationHandler = mRecentsView.getPagedOrientationHandler();
    if (mCurrentAnimation == null) {
        reInitAnimationController(orientationHandler.isGoingUp(startDisplacement, mIsRtl));
        mDisplacementShift = 0;
    } else {
        mDisplacementShift = mCurrentAnimation.getProgressFraction() / mProgressMultiplier;
        mCurrentAnimation.pause();
    }
    mFlingBlockCheck.unblockFling();
    mOverrideVelocity = null;
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 67 with PagedOrientationHandler

use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Launcher3 by crdroidandroid.

the class SplitScreenSelectState method getSplitSelectTranslation.

@Override
public float getSplitSelectTranslation(Launcher launcher) {
    RecentsView recentsView = launcher.getOverviewPanel();
    int splitPosition = recentsView.getSplitPlaceholder().getSplitController().getActiveSplitPositionOption().mStagePosition;
    if (!recentsView.shouldShiftThumbnailsForSplitSelect(splitPosition)) {
        return 0f;
    }
    PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
    int direction = orientationHandler.getSplitTranslationDirectionFactor(splitPosition);
    return launcher.getResources().getDimension(R.dimen.split_placeholder_size) * direction;
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) RecentsView(com.android.quickstep.views.RecentsView)

Example 68 with PagedOrientationHandler

use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Launcher3 by crdroidandroid.

the class BaseRecentsViewStateController method setStateWithAnimationInternal.

/**
 * Core logic for animating the recents view UI.
 *
 * @param toState state to animate to
 * @param config current animation config
 * @param setter animator set builder
 */
void setStateWithAnimationInternal(@NonNull final LauncherState toState, @NonNull StateAnimationConfig config, @NonNull PendingAnimation setter) {
    float[] scaleAndOffset = toState.getOverviewScaleAndOffset(mLauncher);
    setter.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0], config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR));
    setter.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1], config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR));
    setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f, config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR));
    PagedOrientationHandler orientationHandler = ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler();
    FloatProperty taskViewsFloat = orientationHandler.getSplitSelectTaskOffset(TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, mLauncher.getDeviceProfile());
    setter.setFloat(mRecentsView, taskViewsFloat, toState.getSplitSelectTranslation(mLauncher), LINEAR);
    setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT));
    setter.setFloat(mRecentsView, getTaskModalnessProperty(), toState.getOverviewModalness(), config.getInterpolator(ANIM_OVERVIEW_MODAL, LINEAR));
    setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, toState.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f, LINEAR);
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) RecentsView(com.android.quickstep.views.RecentsView) FloatProperty(android.util.FloatProperty)

Example 69 with PagedOrientationHandler

use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaskOverlayFactory method addSplitOptions.

public static void addSplitOptions(List<SystemShortcut> outShortcuts, BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
    PagedOrientationHandler orientationHandler = taskView.getRecentsView().getPagedOrientationHandler();
    List<SplitPositionOption> positions = orientationHandler.getSplitPositionOptions(deviceProfile);
    for (SplitPositionOption option : positions) {
        outShortcuts.add(new SplitSelectSystemShortcut(activity, taskView, option));
    }
}
Also used : SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) SplitSelectSystemShortcut(com.android.quickstep.TaskShortcutFactory.SplitSelectSystemShortcut)

Example 70 with PagedOrientationHandler

use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Trebuchet by LineageOS.

the class TaskViewSimulator method apply.

/**
 * Applies the target to the previously set parameters
 */
public void apply(TransformParams params) {
    if (mDp == null || mThumbnailPosition.isEmpty()) {
        return;
    }
    if (!mLayoutValid) {
        mLayoutValid = true;
        getFullScreenScale();
        mThumbnailData.rotation = mOrientationState.getDisplayRotation();
        mPositionHelper.updateThumbnailMatrix(mThumbnailPosition, mThumbnailData, mTaskRect.width(), mTaskRect.height(), mDp, mOrientationState.getRecentsActivityRotation());
        mPositionHelper.getMatrix().invert(mInversePositionMatrix);
        PagedOrientationHandler poh = mOrientationState.getOrientationHandler();
        mScrollState.halfPageSize = poh.getPrimaryValue(mTaskRect.width(), mTaskRect.height()) / 2;
        mScrollState.halfScreenSize = poh.getPrimaryValue(mDp.widthPx, mDp.heightPx) / 2;
        mScrollValid = false;
    }
    if (!mScrollValid) {
        mScrollValid = true;
        int start = mOrientationState.getOrientationHandler().getPrimaryValue(mTaskRect.left, mTaskRect.top);
        mScrollState.screenCenter = start + mScrollState.scroll + mScrollState.halfPageSize;
        mScrollState.updateInterpolation(start);
        mCurveScale = TaskView.getCurveScaleForInterpolation(mScrollState.linearInterpolation);
    }
    float progress = Utilities.boundToRange(fullScreenProgress.value, 0, 1);
    mCurrentFullscreenParams.setProgress(progress, recentsViewScale.value, mTaskRect.width(), mDp, mPositionHelper);
    // Apply thumbnail matrix
    RectF insets = mCurrentFullscreenParams.mCurrentDrawnInsets;
    float scale = mCurrentFullscreenParams.mScale;
    float taskWidth = mTaskRect.width();
    float taskHeight = mTaskRect.height();
    mMatrix.set(mPositionHelper.getMatrix());
    mMatrix.postTranslate(insets.left, insets.top);
    mMatrix.postScale(scale, scale);
    // Apply TaskView matrix: translate, scale, scroll
    mMatrix.postTranslate(mTaskRect.left, mTaskRect.top);
    mMatrix.postScale(mCurveScale, mCurveScale, taskWidth / 2, taskHeight / 2);
    mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE, mScrollState.scroll);
    // Apply RecentsView matrix
    mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
    mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE, recentsViewSecondaryTranslation.value);
    applyWindowToHomeRotation(mMatrix);
    // Crop rect is the inverse of thumbnail matrix
    mTempRectF.set(-insets.left, -insets.top, taskWidth + insets.right, taskHeight + insets.bottom);
    mInversePositionMatrix.mapRect(mTempRectF);
    mTempRectF.roundOut(mTmpCropRect);
    params.applySurfaceParams(params.createSurfaceParams(this));
}
Also used : RectF(android.graphics.RectF) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) Point(android.graphics.Point)

Aggregations

PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)101 RecentsView (com.android.quickstep.views.RecentsView)25 DeviceProfile (com.android.launcher3.DeviceProfile)22 Rect (android.graphics.Rect)16 PendingAnimation (com.android.launcher3.anim.PendingAnimation)15 FloatProperty (android.util.FloatProperty)14 BaseDragLayer (com.android.launcher3.views.BaseDragLayer)12 PointF (android.graphics.PointF)11 RectF (android.graphics.RectF)11 Point (android.graphics.Point)9 TimeInterpolator (android.animation.TimeInterpolator)6 Matrix (android.graphics.Matrix)6 View (android.view.View)6 Interpolator (android.view.animation.Interpolator)6 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)6 TaskView (com.android.quickstep.views.TaskView)6 Context (android.content.Context)5 ShapeDrawable (android.graphics.drawable.ShapeDrawable)5 RectShape (android.graphics.drawable.shapes.RectShape)5 MotionEvent (android.view.MotionEvent)5