Search in sources :

Example 11 with TransactionCompat

use of com.android.systemui.shared.system.TransactionCompat in project Neo-Launcher by NeoApplications.

the class AppToOverviewAnimationProvider method createWindowAnimation.

/**
 * Create remote window animation from the currently running app to the overview panel.
 *
 * @param targetCompats the target apps
 * @return animation from app to overview
 */
@Override
public AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] targetCompats) {
    if (mRecentsView != null) {
        mRecentsView.setRunningTaskIconScaledDown(true);
    }
    AnimatorSet anim = new AnimatorSet();
    anim.addListener(new AnimationSuccessListener() {

        @Override
        public void onAnimationSuccess(Animator animator) {
            mHelper.onSwipeUpToRecentsComplete(mActivity);
            if (mRecentsView != null) {
                mRecentsView.animateUpRunningTaskIconScale();
            }
        }
    });
    if (mActivity == null) {
        Log.e(TAG, "Animation created, before activity");
        anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION));
        return anim;
    }
    RemoteAnimationTargetSet targetSet = new RemoteAnimationTargetSet(targetCompats, MODE_CLOSING);
    // Use the top closing app to determine the insets for the animation
    RemoteAnimationTargetCompat runningTaskTarget = targetSet.findTask(mTargetTaskId);
    if (runningTaskTarget == null) {
        Log.e(TAG, "No closing app");
        anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION));
        return anim;
    }
    final ClipAnimationHelper clipHelper = new ClipAnimationHelper(mActivity);
    // At this point, the activity is already started and laid-out. Get the home-bounds
    // relative to the screen using the rootView of the activity.
    int[] loc = new int[2];
    View rootView = mActivity.getRootView();
    rootView.getLocationOnScreen(loc);
    Rect homeBounds = new Rect(loc[0], loc[1], loc[0] + rootView.getWidth(), loc[1] + rootView.getHeight());
    clipHelper.updateSource(homeBounds, runningTaskTarget);
    Rect targetRect = new Rect();
    mHelper.getSwipeUpDestinationAndLength(mActivity.getDeviceProfile(), mActivity, targetRect);
    clipHelper.updateTargetRect(targetRect);
    clipHelper.prepareAnimation(mActivity.getDeviceProfile(), false);
    ClipAnimationHelper.TransformParams params = new ClipAnimationHelper.TransformParams().setSyncTransactionApplier(new SyncRtSurfaceTransactionApplierCompat(rootView));
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1);
    valueAnimator.setDuration(RECENTS_LAUNCH_DURATION);
    valueAnimator.setInterpolator(TOUCH_RESPONSE_INTERPOLATOR);
    valueAnimator.addUpdateListener((v) -> {
        params.setProgress((float) v.getAnimatedValue());
        clipHelper.applyTransform(targetSet, params);
    });
    if (targetSet.isAnimatingHome()) {
        // If we are animating home, fade in the opening targets
        RemoteAnimationTargetSet openingSet = new RemoteAnimationTargetSet(targetCompats, MODE_OPENING);
        TransactionCompat transaction = new TransactionCompat();
        valueAnimator.addUpdateListener((v) -> {
            for (RemoteAnimationTargetCompat app : openingSet.apps) {
                transaction.setAlpha(app.leash, (float) v.getAnimatedValue());
            }
            transaction.apply();
        });
    }
    anim.play(valueAnimator);
    return anim;
}
Also used : SyncRtSurfaceTransactionApplierCompat(com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat) Rect(android.graphics.Rect) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) AnimatorSet(android.animation.AnimatorSet) TransactionCompat(com.android.systemui.shared.system.TransactionCompat) ValueAnimator(android.animation.ValueAnimator) View(android.view.View) RecentsView(com.android.quickstep.views.RecentsView) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) RemoteAnimationTargetSet(com.android.quickstep.util.RemoteAnimationTargetSet) ClipAnimationHelper(com.android.quickstep.util.ClipAnimationHelper) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener)

Example 12 with TransactionCompat

use of com.android.systemui.shared.system.TransactionCompat in project Neo-Launcher by NeoApplications.

the class ClipAnimationHelper method applySurfaceParams.

private void applySurfaceParams(@Nullable SyncRtSurfaceTransactionApplierCompat syncTransactionApplier, SurfaceParams[] params) {
    if (syncTransactionApplier != null) {
        syncTransactionApplier.scheduleApply(params);
    } else {
        TransactionCompat t = new TransactionCompat();
        for (SurfaceParams param : params) {
            SyncRtSurfaceTransactionApplierCompat.applyParams(t, param);
        }
        t.setEarlyWakeup();
        t.apply();
    }
}
Also used : TransactionCompat(com.android.systemui.shared.system.TransactionCompat) SurfaceParams(com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams)

Example 13 with TransactionCompat

use of com.android.systemui.shared.system.TransactionCompat in project android_packages_apps_Trebuchet by LineageOS.

the class DepthController method setDepth.

private void setDepth(float depth) {
    depth = Utilities.boundToRange(depth, 0, 1);
    // Round out the depth to dedupe frequent, non-perceptable updates
    int depthI = (int) (depth * 256);
    float depthF = depthI / 256f;
    if (Float.compare(mDepth, depthF) == 0) {
        return;
    }
    boolean supportsBlur = BlurUtils.supportsBlursOnWindows();
    if (supportsBlur && (mSurface == null || !mSurface.isValid())) {
        return;
    }
    mDepth = depthF;
    ensureDependencies();
    IBinder windowToken = mLauncher.getRootView().getWindowToken();
    if (windowToken != null) {
        mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth);
    }
    if (supportsBlur) {
        final int blur;
        if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
            // All apps has a solid background. We don't need to draw blurs after it's fully
            // visible. This will take us out of GPU composition, saving battery and increasing
            // performance.
            blur = 0;
        } else {
            blur = (int) (mDepth * mMaxBlurRadius);
        }
        new TransactionCompat().setBackgroundBlurRadius(mSurface, blur).apply();
    }
}
Also used : IBinder(android.os.IBinder) TransactionCompat(com.android.systemui.shared.system.TransactionCompat)

Example 14 with TransactionCompat

use of com.android.systemui.shared.system.TransactionCompat in project android_packages_apps_Trebuchet by LineageOS.

the class RemoteFadeOutAnimationListener method onAnimationUpdate.

@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
    TransactionCompat t = new TransactionCompat();
    if (mFirstFrame) {
        for (RemoteAnimationTargetCompat target : mTarget.unfilteredApps) {
            t.show(target.leash);
        }
        mFirstFrame = false;
    }
    float alpha = 1 - valueAnimator.getAnimatedFraction();
    for (RemoteAnimationTargetCompat app : mTarget.apps) {
        t.setAlpha(app.leash, alpha);
    }
    t.apply();
}
Also used : RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) TransactionCompat(com.android.systemui.shared.system.TransactionCompat)

Example 15 with TransactionCompat

use of com.android.systemui.shared.system.TransactionCompat in project android_packages_apps_Launcher3 by ArrowOS.

the class RemoteFadeOutAnimationListener method onAnimationUpdate.

@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
    TransactionCompat t = new TransactionCompat();
    if (mFirstFrame) {
        for (RemoteAnimationTargetCompat target : mTarget.unfilteredApps) {
            t.show(target.leash);
        }
        mFirstFrame = false;
    }
    float alpha = 1 - valueAnimator.getAnimatedFraction();
    for (RemoteAnimationTargetCompat app : mTarget.apps) {
        t.setAlpha(app.leash, alpha);
    }
    t.apply();
}
Also used : RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) TransactionCompat(com.android.systemui.shared.system.TransactionCompat)

Aggregations

TransactionCompat (com.android.systemui.shared.system.TransactionCompat)16 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)8 SurfaceParams (com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams)7 Animator (android.animation.Animator)1 AnimatorSet (android.animation.AnimatorSet)1 ValueAnimator (android.animation.ValueAnimator)1 Rect (android.graphics.Rect)1 IBinder (android.os.IBinder)1 View (android.view.View)1 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)1 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)1 ClipAnimationHelper (com.android.quickstep.util.ClipAnimationHelper)1 RemoteAnimationTargetSet (com.android.quickstep.util.RemoteAnimationTargetSet)1 RecentsView (com.android.quickstep.views.RecentsView)1 SyncRtSurfaceTransactionApplierCompat (com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat)1