Search in sources :

Example 11 with PagedOrientationHandler

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

the class TaskViewTouchController method reInitAnimationController.

private void reInitAnimationController(boolean goingUp) {
    if (mCurrentAnimation != null && mCurrentAnimationIsGoingUp == goingUp) {
        // No need to init
        return;
    }
    if ((goingUp && !mAllowGoingUp) || (!goingUp && !mAllowGoingDown)) {
        // Trying to re-init in an unsupported direction.
        return;
    }
    if (mCurrentAnimation != null) {
        mCurrentAnimation.setPlayFraction(0);
        mCurrentAnimation.getTarget().removeListener(this);
        mCurrentAnimation.dispatchOnCancel();
    }
    PagedOrientationHandler orientationHandler = mRecentsView.getPagedOrientationHandler();
    mCurrentAnimationIsGoingUp = goingUp;
    BaseDragLayer dl = mActivity.getDragLayer();
    final int secondaryLayerDimension = orientationHandler.getSecondaryDimension(dl);
    long maxDuration = 2 * secondaryLayerDimension;
    int verticalFactor = orientationHandler.getTaskDragDisplacementFactor(mIsRtl);
    int secondaryTaskDimension = orientationHandler.getSecondaryDimension(mTaskBeingDragged);
    // The interpolator controlling the most prominent visual movement. We use this to determine
    // whether we passed SUCCESS_TRANSITION_PROGRESS.
    final Interpolator currentInterpolator;
    PendingAnimation pa;
    if (goingUp) {
        currentInterpolator = Interpolators.LINEAR;
        pa = mRecentsView.createTaskDismissAnimation(mTaskBeingDragged, true, /* animateTaskView */
        true, /* removeTask */
        maxDuration, false);
        mEndDisplacement = -secondaryTaskDimension;
    } else {
        currentInterpolator = Interpolators.ZOOM_IN;
        pa = mRecentsView.createTaskLaunchAnimation(mTaskBeingDragged, maxDuration, currentInterpolator);
        // Since the thumbnail is what is filling the screen, based the end displacement on it.
        View thumbnailView = mTaskBeingDragged.getThumbnail();
        mTempCords[1] = orientationHandler.getSecondaryDimension(thumbnailView);
        dl.getDescendantCoordRelativeToSelf(thumbnailView, mTempCords);
        mEndDisplacement = secondaryLayerDimension - mTempCords[1];
    }
    mEndDisplacement *= verticalFactor;
    mCurrentAnimation = pa.createPlaybackController();
    // Setting this interpolator doesn't affect the visual motion, but is used to determine
    // whether we successfully reached the target state in onDragEnd().
    mCurrentAnimation.getTarget().setInterpolator(currentInterpolator);
    onUserControlledAnimationCreated(mCurrentAnimation);
    mCurrentAnimation.getTarget().addListener(this);
    mCurrentAnimation.dispatchOnStart();
    mProgressMultiplier = 1 / mEndDisplacement;
}
Also used : BaseDragLayer(com.android.launcher3.views.BaseDragLayer) PendingAnimation(com.android.launcher3.anim.PendingAnimation) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) Interpolator(android.view.animation.Interpolator) TaskView(com.android.quickstep.views.TaskView) View(android.view.View) RecentsView(com.android.quickstep.views.RecentsView) AbstractFloatingView(com.android.launcher3.AbstractFloatingView)

Example 12 with PagedOrientationHandler

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

the class QuickstepTransitionManager method getDefaultWindowTargetRect.

@NonNull
private RectF getDefaultWindowTargetRect() {
    RecentsView recentsView = mLauncher.getOverviewPanel();
    PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
    DeviceProfile dp = mLauncher.getDeviceProfile();
    final int halfIconSize = dp.iconSizePx / 2;
    float primaryDimension = orientationHandler.getPrimaryValue(dp.availableWidthPx, dp.availableHeightPx);
    float secondaryDimension = orientationHandler.getSecondaryValue(dp.availableWidthPx, dp.availableHeightPx);
    final float targetX = primaryDimension / 2f;
    final float targetY = secondaryDimension - dp.hotseatBarSizePx;
    return new RectF(targetX - halfIconSize, targetY - halfIconSize, targetX + halfIconSize, targetY + halfIconSize);
}
Also used : RectF(android.graphics.RectF) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) RecentsView(com.android.quickstep.views.RecentsView) Point(android.graphics.Point) NonNull(androidx.annotation.NonNull)

Example 13 with PagedOrientationHandler

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

the class TaskMenuView method orientAroundTaskView.

private void orientAroundTaskView(TaskIdAttributeContainer taskContainer) {
    RecentsView recentsView = mActivity.getOverviewPanel();
    PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
    measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
    orientationHandler.setTaskMenuAroundTaskView(this, mTaskInsetMargin);
    // Get Position
    DeviceProfile deviceProfile = mActivity.getDeviceProfile();
    mActivity.getDragLayer().getDescendantRectRelativeToSelf(mTaskView, sTempRect);
    Rect insets = mActivity.getDragLayer().getInsets();
    BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams();
    int padding = getResources().getDimensionPixelSize(R.dimen.task_menu_vertical_padding);
    params.width = orientationHandler.getTaskMenuWidth(taskContainer.getThumbnailView(), deviceProfile) - (2 * padding);
    // Gravity set to Left instead of Start as sTempRect.left measures Left distance not Start
    params.gravity = Gravity.LEFT;
    setLayoutParams(params);
    setScaleX(mTaskView.getScaleX());
    setScaleY(mTaskView.getScaleY());
    // Set divider spacing
    ShapeDrawable divider = new ShapeDrawable(new RectShape());
    divider.getPaint().setColor(getResources().getColor(android.R.color.transparent));
    int dividerSpacing = (int) getResources().getDimension(R.dimen.task_menu_spacing);
    mOptionLayout.setShowDividers(SHOW_DIVIDER_MIDDLE);
    orientationHandler.setTaskOptionsMenuLayoutOrientation(deviceProfile, mOptionLayout, dividerSpacing, divider);
    setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top, 0);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) BaseDragLayer(com.android.launcher3.views.BaseDragLayer) Rect(android.graphics.Rect) RectShape(android.graphics.drawable.shapes.RectShape) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Example 14 with PagedOrientationHandler

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

the class RecentsView method updateOrientationHandler.

private void updateOrientationHandler(boolean forceRecreateDragLayerControllers) {
    // Handle orientation changes.
    PagedOrientationHandler oldOrientationHandler = mOrientationHandler;
    mOrientationHandler = mOrientationState.getOrientationHandler();
    mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
    setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
    mClearAllButton.setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_LTR : View.LAYOUT_DIRECTION_RTL);
    mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());
    if (forceRecreateDragLayerControllers || !mOrientationHandler.equals(oldOrientationHandler)) {
        // Changed orientations, update controllers so they intercept accordingly.
        mActivity.getDragLayer().recreateControllers();
        onOrientationChanged();
    }
    boolean isInLandscape = mOrientationState.getTouchRotation() != ROTATION_0 || mOrientationState.getRecentsActivityRotation() != ROTATION_0;
    mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, !mOrientationState.isRecentsActivityRotationAllowed() && isInLandscape);
    // Update TaskView's DeviceProfile dependent layout.
    updateChildTaskOrientations();
    // Recalculate DeviceProfile dependent layout.
    updateSizeAndPadding();
    requestLayout();
    // Reapply the current page to update page scrolls.
    setCurrentPage(mCurrentPage);
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 15 with PagedOrientationHandler

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

the class RecentsView method onRotateInSplitSelectionState.

protected void onRotateInSplitSelectionState() {
    mOrientationHandler.getInitialSplitPlaceholderBounds(mSplitPlaceholderSize, mActivity.getDeviceProfile(), mSplitSelectStateController.getActiveSplitStagePosition(), mTempRect);
    mTempRectF.set(mTempRect);
    // TODO(194414938) set correct corner radius
    mFirstFloatingTaskView.updateOrientationHandler(mOrientationHandler);
    mFirstFloatingTaskView.update(mTempRectF, /*progress=*/
    1f, /*windowRadius=*/
    0f);
    PagedOrientationHandler orientationHandler = getPagedOrientationHandler();
    Pair<FloatProperty, FloatProperty> taskViewsFloat = orientationHandler.getSplitSelectTaskOffset(TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, mActivity.getDeviceProfile());
    taskViewsFloat.first.set(this, getSplitSelectTranslation());
    taskViewsFloat.second.set(this, 0f);
    applySplitPrimaryScrollOffset();
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) FloatProperty(android.util.FloatProperty)

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