Search in sources :

Example 26 with PagedOrientationHandler

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

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 27 with PagedOrientationHandler

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

the class DigitalWellBeingToast method setupAndAddBanner.

private void setupAndAddBanner() {
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) mBanner.getLayoutParams();
    DeviceProfile deviceProfile = mActivity.getDeviceProfile();
    layoutParams.bottomMargin = ((ViewGroup.MarginLayoutParams) mTaskView.getThumbnail().getLayoutParams()).bottomMargin;
    PagedOrientationHandler orientationHandler = mTaskView.getPagedOrientationHandler();
    Pair<Float, Float> translations = orientationHandler.setDwbLayoutParamsAndGetTranslations(mTaskView.getMeasuredWidth(), mTaskView.getMeasuredHeight(), mStagedSplitBounds, deviceProfile, mTaskView.getThumbnails(), mTask.key.id, mBanner);
    mSplitOffsetTranslationX = translations.first;
    mSplitOffsetTranslationY = translations.second;
    updateTranslationY();
    updateTranslationX();
    mTaskView.addView(mBanner);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) ViewGroup(android.view.ViewGroup) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) FrameLayout(android.widget.FrameLayout)

Example 28 with PagedOrientationHandler

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

the class ClearAllButton method onRecentsViewScroll.

public void onRecentsViewScroll(int scroll, boolean gridEnabled) {
    RecentsView recentsView = getRecentsView();
    if (recentsView == null) {
        return;
    }
    PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler();
    float orientationSize = orientationHandler.getPrimaryValue(getWidth(), getHeight());
    if (orientationSize == 0) {
        return;
    }
    int clearAllScroll = recentsView.getClearAllScroll();
    int adjustedScrollFromEdge = Math.abs(scroll - clearAllScroll);
    float shift = Math.min(adjustedScrollFromEdge, orientationSize);
    mNormalTranslationPrimary = mIsRtl ? -shift : shift;
    if (!gridEnabled) {
        mNormalTranslationPrimary += mSidePadding;
    }
    applyPrimaryTranslation();
    applySecondaryTranslation();
    mScrollAlpha = 1 - shift / orientationSize;
    updateAlpha();
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 29 with PagedOrientationHandler

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

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 30 with PagedOrientationHandler

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

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)

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