Search in sources :

Example 1 with ACCEL_0_75

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

the class RecentsView method updatePageOffsets.

private void updatePageOffsets() {
    float offset = mAdjacentPageHorizontalOffset;
    float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness);
    int count = getChildCount();
    TaskView runningTask = mRunningTaskId == -1 || !mRunningTaskTileHidden ? null : getTaskView(mRunningTaskId);
    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()) {
            mLiveTileTaskViewSimulator.taskPrimaryTranslation.value = totalTranslation;
            redrawLiveTile();
        }
    }
    updateCurveProperties();
}
Also used : FloatProperty(android.util.FloatProperty) ImageView(android.widget.ImageView) View(android.view.View) ListView(android.widget.ListView) PagedView(com.android.launcher3.PagedView) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Example 2 with ACCEL_0_75

use of com.android.launcher3.anim.Interpolators.ACCEL_0_75 in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsView method updatePageOffsets.

private void updatePageOffsets() {
    float offset = mAdjacentPageOffset;
    float modalOffset = ACCEL_0_75.getInterpolation(mTaskModalness);
    if (mIsRtl) {
        offset = -offset;
        modalOffset = -modalOffset;
    }
    int count = getChildCount();
    TaskView runningTask = mRunningTaskId == -1 || !mRunningTaskTileHidden ? null : getTaskView(mRunningTaskId);
    int midpoint = runningTask == null ? -1 : indexOfChild(runningTask);
    int modalMidpoint = getCurrentPage();
    float midpointOffsetSize = 0;
    float leftOffsetSize = midpoint - 1 >= 0 ? -getOffsetSize(midpoint - 1, midpoint, offset) : 0;
    float rightOffsetSize = midpoint + 1 < count ? getOffsetSize(midpoint + 1, midpoint, offset) : 0;
    float modalMidpointOffsetSize = 0;
    float modalLeftOffsetSize = modalMidpoint - 1 >= 0 ? -getOffsetSize(modalMidpoint - 1, modalMidpoint, modalOffset) : 0;
    float modalRightOffsetSize = modalMidpoint + 1 < count ? getOffsetSize(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 : 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 * mOrientationHandler.getPrimaryTranslationDirectionFactor());
    }
    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)

Example 3 with ACCEL_0_75

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

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)

Example 4 with ACCEL_0_75

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

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)

Example 5 with ACCEL_0_75

use of com.android.launcher3.anim.Interpolators.ACCEL_0_75 in project android_packages_apps_404Launcher by P-404.

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