Search in sources :

Example 6 with ACCEL_0_75

use of com.android.launcher3.anim.Interpolators.ACCEL_0_75 in project android_packages_apps_Launcher3 by AOSPA.

the class RecentsView method updatePageOffsets.

private void updatePageOffsets() {
    float offset = mAdjacentPageHorizontalOffset;
    float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness);
    int count = getChildCount();
    TaskView runningTask = mRunningTaskViewId == -1 || !mRunningTaskTileHidden ? null : getRunningTaskView();
    int midpoint = runningTask == null ? -1 : indexOfChild(runningTask);
    int modalMidpoint = getCurrentPage();
    float midpointOffsetSize = 0;
    float leftOffsetSize = midpoint - 1 >= 0 ? getHorizontalOffsetSize(midpoint - 1, midpoint, offset) : 0;
    float rightOffsetSize = midpoint + 1 < count ? getHorizontalOffsetSize(midpoint + 1, midpoint, offset) : 0;
    boolean showAsGrid = showAsGrid();
    float modalMidpointOffsetSize = 0;
    float modalLeftOffsetSize = 0;
    float modalRightOffsetSize = 0;
    float gridOffsetSize = 0;
    if (showAsGrid) {
        // In grid, we only focus the task on the side. The reference index used for offset
        // calculation is the task directly next to the focus task in the grid.
        int referenceIndex = modalMidpoint == 0 ? 1 : 0;
        gridOffsetSize = referenceIndex < count ? getHorizontalOffsetSize(referenceIndex, modalMidpoint, modalOffset) : 0;
    } else {
        modalLeftOffsetSize = modalMidpoint - 1 >= 0 ? getHorizontalOffsetSize(modalMidpoint - 1, modalMidpoint, modalOffset) : 0;
        modalRightOffsetSize = modalMidpoint + 1 < count ? getHorizontalOffsetSize(modalMidpoint + 1, modalMidpoint, modalOffset) : 0;
    }
    for (int i = 0; i < count; i++) {
        float translation = i == midpoint ? midpointOffsetSize : i < midpoint ? leftOffsetSize : rightOffsetSize;
        float modalTranslation = i == modalMidpoint ? modalMidpointOffsetSize : showAsGrid ? gridOffsetSize : i < modalMidpoint ? modalLeftOffsetSize : modalRightOffsetSize;
        float totalTranslation = translation + modalTranslation;
        View child = getChildAt(i);
        FloatProperty translationProperty = child instanceof TaskView ? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty() : mOrientationHandler.getPrimaryViewTranslate();
        translationProperty.set(child, totalTranslation);
        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && mEnableDrawingLiveTile && i == getRunningTaskIndex()) {
            runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator().taskPrimaryTranslation.value = totalTranslation);
            redrawLiveTile();
        }
    }
    updateCurveProperties();
}
Also used : FloatProperty(android.util.FloatProperty) View(android.view.View) ListView(android.widget.ListView) PagedView(com.android.launcher3.PagedView) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Aggregations

Point (android.graphics.Point)6 TextPaint (android.text.TextPaint)6 FloatProperty (android.util.FloatProperty)6 View (android.view.View)6 ListView (android.widget.ListView)6 PagedView (com.android.launcher3.PagedView)6 ImageView (android.widget.ImageView)1