Search in sources :

Example 71 with PagedOrientationHandler

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

the class ClearAllButton method onLayout.

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);
    PagedOrientationHandler orientationHandler = getRecentsView().getPagedOrientationHandler();
    mScrollOffset = orientationHandler.getClearAllScrollOffset(getRecentsView(), mIsRtl);
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 72 with PagedOrientationHandler

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

the class ClearAllButton method onPageScroll.

@Override
public void onPageScroll(ScrollState scrollState) {
    PagedOrientationHandler orientationHandler = getRecentsView().getPagedOrientationHandler();
    float orientationSize = orientationHandler.getPrimaryValue(getWidth(), getHeight());
    if (orientationSize == 0) {
        return;
    }
    float shift = Math.min(scrollState.scrollFromEdge, orientationSize);
    float translation = mIsRtl ? (mScrollOffset - shift) : (mScrollOffset + shift);
    orientationHandler.setPrimaryAndResetSecondaryTranslate(this, translation);
    mScrollAlpha = 1 - shift / orientationSize;
    updateAlpha();
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 73 with PagedOrientationHandler

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

the class TaskView method onPageScroll.

@Override
public void onPageScroll(ScrollState scrollState) {
    // Don't do anything if it's modal.
    if (mModalness > 0) {
        return;
    }
    float curveInterpolation = CURVE_INTERPOLATOR.getInterpolation(scrollState.linearInterpolation);
    float curveScaleForCurveInterpolation = getCurveScaleForCurveInterpolation(curveInterpolation);
    mSnapshotView.setDimAlpha(curveInterpolation * MAX_PAGE_SCRIM_ALPHA);
    setCurveScale(curveScaleForCurveInterpolation);
    mFooterAlpha = Utilities.boundToRange(1.0f - 2 * scrollState.linearInterpolation, 0f, 1f);
    for (FooterWrapper footer : mFooters) {
        if (footer != null) {
            footer.mView.setAlpha(mFooterAlpha);
        }
    }
    if (mMenuView != null) {
        PagedOrientationHandler pagedOrientationHandler = getPagedOrientationHandler();
        RecentsView recentsView = getRecentsView();
        mMenuView.setPosition(getX() - recentsView.getScrollX(), getY() - recentsView.getScrollY(), pagedOrientationHandler);
        mMenuView.setScaleX(getScaleX());
        mMenuView.setScaleY(getScaleY());
    }
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 74 with PagedOrientationHandler

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

the class TaskView method setOrientationState.

public void setOrientationState(RecentsOrientedState orientationState) {
    PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
    boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
    LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
    int thumbnailPadding = (int) getResources().getDimension(R.dimen.task_thumbnail_top_margin);
    LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
    switch(orientationHandler.getRotation()) {
        case ROTATION_90:
            iconParams.gravity = (isRtl ? START : END) | CENTER_VERTICAL;
            iconParams.rightMargin = -thumbnailPadding;
            iconParams.leftMargin = 0;
            iconParams.topMargin = snapshotParams.topMargin / 2;
            break;
        case ROTATION_180:
            iconParams.gravity = BOTTOM | CENTER_HORIZONTAL;
            iconParams.bottomMargin = -thumbnailPadding;
            iconParams.leftMargin = iconParams.topMargin = iconParams.rightMargin = 0;
            break;
        case ROTATION_270:
            iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL;
            iconParams.leftMargin = -thumbnailPadding;
            iconParams.rightMargin = 0;
            iconParams.topMargin = snapshotParams.topMargin / 2;
            break;
        case Surface.ROTATION_0:
        default:
            iconParams.gravity = TOP | CENTER_HORIZONTAL;
            iconParams.leftMargin = iconParams.topMargin = iconParams.rightMargin = 0;
            break;
    }
    mIconView.setLayoutParams(iconParams);
    mIconView.setRotation(orientationHandler.getDegreesRotated());
    if (mMenuView != null) {
        mMenuView.onRotationChanged();
    }
}
Also used : PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler)

Example 75 with PagedOrientationHandler

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

the class DiscoveryBounce method showForOverviewIfNeeded.

private static void showForOverviewIfNeeded(Launcher launcher, boolean withDelay, PagedOrientationHandler orientationHandler) {
    OnboardingPrefs onboardingPrefs = launcher.getOnboardingPrefs();
    if (!launcher.isInState(OVERVIEW) || !launcher.hasBeenResumed() || launcher.isForceInvisible() || launcher.getDeviceProfile().isVerticalBarLayout() || !orientationHandler.isLayoutNaturalToLauncher() || onboardingPrefs.getBoolean(OnboardingPrefs.SHELF_BOUNCE_SEEN) || launcher.getSystemService(UserManager.class).isDemoUser() || Utilities.IS_RUNNING_IN_TEST_HARNESS) {
        return;
    }
    if (withDelay) {
        new Handler().postDelayed(() -> showForOverviewIfNeeded(launcher, false, orientationHandler), DELAY_MS);
        return;
    } else if (AbstractFloatingView.getTopOpenView(launcher) != null) {
        // TODO: Move these checks to the top and call this method after invalidate handler.
        return;
    }
    onboardingPrefs.incrementEventCount(OnboardingPrefs.SHELF_BOUNCE_COUNT);
    new DiscoveryBounce(launcher, (1 - OVERVIEW.getVerticalProgress(launcher))).show(PREDICTION);
}
Also used : OnboardingPrefs(com.android.launcher3.util.OnboardingPrefs) UserManager(android.os.UserManager) Handler(android.os.Handler) 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